ACI Module: Update modules to provide match criteria; allows more complex matching (#33756)

This commit is contained in:
Jacob McGill 2017-12-11 13:43:11 -05:00 committed by John R Barker
parent c2b4fd7f1e
commit c26a528b21
32 changed files with 69 additions and 69 deletions

View file

@ -381,7 +381,7 @@ class ACIModule(object):
# Query for all objects of the module's class that match the provided ID value
else:
path = 'api/class/{}.json'.format(obj_class)
filter_string = '?query-target-filter=eq{}'.format(obj_filter) + child_includes
filter_string = '?query-target-filter={}'.format(obj_filter) + child_includes
# Append child_includes to filter_string if filter string is empty
if child_includes is not None and filter_string == '':
@ -437,7 +437,7 @@ class ACIModule(object):
# Query for all objects of the module's class that match the provided ID value and belong to a specefic root object
elif mo is not None:
path = 'api/mo/uni/{}.json'.format(root_rn)
filter_string = '?rsp-subtree-filter=eq{}{}'.format(obj_filter, self_child_includes)
filter_string = '?rsp-subtree-filter={}{}'.format(obj_filter, self_child_includes)
# Query for all objects of the module's class that belong to a specific root object
else:
path = 'api/mo/uni/{}.json'.format(root_rn)
@ -448,17 +448,17 @@ class ACIModule(object):
# matching the provided ID values for both object and parent object
if mo is not None:
path = 'api/class/{}.json'.format(parent_class)
filter_string = '?query-target-filter=eq{}{}&rsp-subtree-filter=eq{}'.format(
filter_string = '?query-target-filter={}{}&rsp-subtree-filter={}'.format(
parent_filter, self_child_includes, obj_filter)
# Query for all objects of the module's class that belong to any parent class
# matching the provided ID value for the parent object
else:
path = 'api/class/{}.json'.format(parent_class)
filter_string = '?query-target-filter=eq{}{}'.format(parent_filter, self_child_includes)
filter_string = '?query-target-filter={}{}'.format(parent_filter, self_child_includes)
# Query for all objects of the module's class matching the provided ID value of the object
else:
path = 'api/class/{}.json'.format(obj_class)
filter_string = '?query-target-filter=eq{}'.format(obj_filter) + child_includes
filter_string = '?query-target-filter={}'.format(obj_filter) + child_includes
# append child_includes to filter_string if filter string is empty
if child_includes is not None and filter_string == '':

View file

@ -112,7 +112,7 @@ def main():
root_class=dict(
aci_class='infraAttEntityP',
aci_rn='infra/attentp-{}'.format(aep),
filter_target='(infraAttEntityP.name, "{}")'.format(aep),
filter_target='eq(infraAttEntityP.name, "{}")'.format(aep),
module_object=aep,
),
)

View file

@ -127,13 +127,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvAp',
aci_rn='ap-{}'.format(ap),
filter_target='(fvAp.name, "{}")'.format(ap),
filter_target='eq(fvAp.name, "{}")'.format(ap),
module_object=ap,
),
)

View file

@ -283,13 +283,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvBD',
aci_rn='BD-{}'.format(bd),
filter_target='(fvBD.name, "{}")'.format(bd),
filter_target='eq(fvBD.name, "{}")'.format(bd),
module_object=bd,
),
child_classes=['fvRsCtx', 'fvRsIgmpsn', 'fvRsBDToNdP', 'fvRsBdToEpRet'],

View file

@ -272,19 +272,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, \"{}\")'.format(tenant),
filter_target='eq(fvTenant.name, \"{}\")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvBD',
aci_rn='BD-{}'.format(bd),
filter_target='(fvBD.name, \"{}\")'.format(bd),
filter_target='eq(fvBD.name, \"{}\")'.format(bd),
module_object=bd,
),
subclass_2=dict(
aci_class='fvSubnet',
aci_rn='subnet-[{}]'.format(gateway),
filter_target='(fvSubnet.ip, \"{}\")'.format(gateway),
filter_target='eq(fvSubnet.ip, \"{}\")'.format(gateway),
module_object=gateway,
),
child_classes=['fvRsBDSubnetToProfile', 'fvRsNdPfxPol'],

View file

@ -89,19 +89,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvBD',
aci_rn='BD-{}'.format(bd),
filter_target='(fvBD.name, "{}")'.format(bd),
filter_target='eq(fvBD.name, "{}")'.format(bd),
module_object=bd,
),
subclass_2=dict(
aci_class='fvRsBDToOut',
aci_rn='rsBDToOut-{}'.format(l3out),
filter_target='(fvRsBDToOut.tnL3extOutName, "{}")'.format(l3out),
filter_target='eq(fvRsBDToOut.tnL3extOutName, "{}")'.format(l3out),
module_object=l3out,
),
)

View file

@ -200,7 +200,7 @@ def main():
root_class=dict(
aci_class='configImportP',
aci_rn='fabric/configimp-{}'.format(import_policy),
filter_target='(configImportP.name, "{}")'.format(import_policy),
filter_target='eq(configImportP.name, "{}")'.format(import_policy),
module_object=import_policy,
),
)

View file

@ -156,7 +156,7 @@ def main():
root_class=dict(
aci_class='configExportP',
aci_rn='fabric/configexp-{}'.format(export_policy),
filter_target='(configExportP.name, "{}")'.format(export_policy),
filter_target='eq(configExportP.name, "{}")'.format(export_policy),
module_object=export_policy,
),
)

View file

@ -130,13 +130,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzBrCP',
aci_rn='brc-{}'.format(contract),
filter_target='(vzBrCP.name, "{}")'.format(contract),
filter_target='eq(vzBrCP.name, "{}")'.format(contract),
module_object=contract,
),
)

View file

@ -191,19 +191,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzBrCP',
aci_rn='brc-{}'.format(contract),
filter_target='(vzBrCP.name, "{}")'.format(contract),
filter_target='eq(vzBrCP.name, "{}")'.format(contract),
module_object=contract,
),
subclass_2=dict(
aci_class='vzSubj',
aci_rn='subj-{}'.format(subject),
filter_target='(vzSubj.name, "{}")'.format(subject),
filter_target='eq(vzSubj.name, "{}")'.format(subject),
module_object=subject,
),
)

View file

@ -122,25 +122,25 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzBrCP',
aci_rn='brc-{}'.format(contract),
filter_target='(vzBrCP.name, "{}")'.format(contract),
filter_target='eq(vzBrCP.name, "{}")'.format(contract),
module_object=contract,
),
subclass_2=dict(
aci_class='vzSubj',
aci_rn='subj-{}'.format(subject),
filter_target='(vzSubj.name, "{}")'.format(subject),
filter_target='eq(vzSubj.name, "{}")'.format(subject),
module_object=subject,
),
subclass_3=dict(
aci_class='vzRsSubjFiltAtt',
aci_rn='rssubjFiltAtt-{}'.format(filter_name),
filter_target='(vzRsSubjFiltAtt.tnVzFilterName, "{}")'.format(filter_name),
filter_target='eq(vzRsSubjFiltAtt.tnVzFilterName, "{}")'.format(filter_name),
module_object=filter_name,
),
)

View file

@ -201,19 +201,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvAp',
aci_rn='ap-{}'.format(ap),
filter_target='(fvAp.name, "{}")'.format(ap),
filter_target='eq(fvAp.name, "{}")'.format(ap),
module_object=ap,
),
subclass_2=dict(
aci_class='fvAEPg',
aci_rn='epg-{}'.format(epg),
filter_target='(fvAEPg.name, "{}")'.format(epg),
filter_target='eq(fvAEPg.name, "{}")'.format(epg),
module_object=epg,
),
child_classes=['fvRsBd'],

View file

@ -100,13 +100,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='monEPGPol',
aci_rn='monepg-{}'.format(monitoring_policy),
filter_target='(monEPGPol.name, "{}")'.format(monitoring_policy),
filter_target='eq(monEPGPol.name, "{}")'.format(monitoring_policy),
module_object=monitoring_policy,
),
)

View file

@ -128,25 +128,25 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvAp',
aci_rn='ap-{}'.format(ap),
filter_target='(fvAp.name, "{}")'.format(ap),
filter_target='eq(fvAp.name, "{}")'.format(ap),
module_object=ap,
),
subclass_2=dict(
aci_class='fvAEPg',
aci_rn='epg-{}'.format(epg),
filter_target='(fvAEPg.name, "{}")'.format(epg),
filter_target='eq(fvAEPg.name, "{}")'.format(epg),
module_object=epg,
),
subclass_3=dict(
aci_class=aci_class,
aci_rn='{}{}'.format(aci_rn, contract),
filter_target='({}.tnVzBrCPName, "{}'.format(aci_class, contract),
filter_target='eq({}.tnVzBrCPName, "{}'.format(aci_class, contract),
module_object=contract,
),
)

View file

@ -183,25 +183,25 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvAp',
aci_rn='ap-{}'.format(ap),
filter_target='(fvAp.name, "{}")'.format(ap),
filter_target='eq(fvAp.name, "{}")'.format(ap),
module_object=ap,
),
subclass_2=dict(
aci_class='fvAEPg',
aci_rn='epg-{}'.format(epg),
filter_target='(fvTenant.name, "{}")'.format(epg),
filter_target='eq(fvTenant.name, "{}")'.format(epg),
module_object=epg,
),
subclass_3=dict(
aci_class='fvRsDomAtt',
aci_rn='rsdomAtt-[{}]'.format(epg_domain),
filter_target='(fvRsDomAtt.tDn, "{}")'.format(epg_domain),
filter_target='eq(fvRsDomAtt.tDn, "{}")'.format(epg_domain),
module_object=epg_domain,
),
)

View file

@ -128,13 +128,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzFilter',
aci_rn='flt-{}'.format(filter_name),
filter_target='(vzFilter.name, "{}")'.format(filter_name),
filter_target='eq(vzFilter.name, "{}")'.format(filter_name),
module_object=filter_name,
),
)

View file

@ -208,19 +208,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzFilter',
aci_rn='flt-{}'.format(filter_name),
filter_target='(vzFilter.name, "{}")'.format(filter_name),
filter_target='eq(vzFilter.name, "{}")'.format(filter_name),
module_object=filter_name,
),
subclass_2=dict(
aci_class='vzEntry',
aci_rn='e-{}'.format(entry),
filter_target='(vzEntry.name, "{}")'.format(entry),
filter_target='eq(vzEntry.name, "{}")'.format(entry),
module_object=entry
),
)

View file

@ -97,7 +97,7 @@ def main():
root_class=dict(
aci_class='fcIfPol',
aci_rn='infra/fcIfPol-{}'.format(fc_policy),
filter_target='(fcIfPol.name, "{}")'.format(fc_policy),
filter_target='eq(fcIfPol.name, "{}")'.format(fc_policy),
module_object=fc_policy,
),
)

View file

@ -115,7 +115,7 @@ def main():
root_class=dict(
aci_class='l2IfPol',
aci_rn='infra/l2IfP-{}'.format(l2_policy),
filter_target='(l2IfPol.name, "{}")'.format(l2_policy),
filter_target='eq(l2IfPol.name, "{}")'.format(l2_policy),
module_object=l2_policy,
),
)

View file

@ -106,7 +106,7 @@ def main():
root_class=dict(
aci_class='lldpIfPol',
aci_rn='infra/lldpIfP-{}'.format(lldp_policy),
filter_target='(lldpIfPol.name, "{}")'.format(lldp_policy),
filter_target='eq(lldpIfPol.name, "{}")'.format(lldp_policy),
module_object=lldp_policy,
),
)

View file

@ -97,7 +97,7 @@ def main():
root_class=dict(
aci_class='mcpIfPol',
aci_rn='infra/mcpIfP-{}'.format(mcp),
filter_target='(mcpIfPol.name, "{}")'.format(mcp),
filter_target='eq(mcpIfPol.name, "{}")'.format(mcp),
module_object=mcp,
),
)

View file

@ -182,7 +182,7 @@ def main():
root_class=dict(
aci_class='lacpLagPol',
aci_rn='infra/lacplagp-{}'.format(port_channel),
filter_target='(lacpLagPol.name, "{}")'.format(port_channel),
filter_target='eq(lacpLagPol.name, "{}")'.format(port_channel),
module_object=port_channel,
),
)

View file

@ -98,7 +98,7 @@ def main():
root_class=dict(
aci_class='l2PortSecurityPol',
aci_rn='infra/portsecurityP-{}'.format(port_security),
filter_target='(l2PortSecurityPol.name, "{}")'.format(port_security),
filter_target='eq(l2PortSecurityPol.name, "{}")'.format(port_security),
module_object=port_security,
),
)

View file

@ -107,13 +107,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='l3extRouteTagPol',
aci_rn='rttag-{}'.format(rtp),
filter_target='(l3extRouteTagPol.name, "{}")'.format(rtp),
filter_target='eq(l3extRouteTagPol.name, "{}")'.format(rtp),
module_object=rtp,
),
)

View file

@ -108,13 +108,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='vzTaboo',
aci_rn='taboo-{}'.format(taboo_contract),
filter_target='(vzTaboo.name, "{}")'.format(taboo_contract),
filter_target='eq(vzTaboo.name, "{}")'.format(taboo_contract),
module_object=taboo_contract,
),
)

View file

@ -113,7 +113,7 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
)

View file

@ -98,13 +98,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='rtctrlAttrP',
aci_rn='attr-{}'.format(action_rule),
filter_target='(rtctrlAttrP.name, "{}")'.format(action_rule),
filter_target='eq(rtctrlAttrP.name, "{}")'.format(action_rule),
module_object=action_rule,
),
)

View file

@ -192,13 +192,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvEpRetPol',
aci_rn='epRPol-{}'.format(epr_policy),
filter_target='(fvEpRetPol.name, "{}")'.format(epr_policy),
filter_target='eq(fvEpRetPol.name, "{}")'.format(epr_policy),
module_object=epr_policy,
),
)

View file

@ -100,13 +100,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='spanDestGrp',
aci_rn='destgrp-{}'.format(dst_group),
filter_target='(spanDestGrp.name, "{}")'.format(dst_group),
filter_target='eq(spanDestGrp.name, "{}")'.format(dst_group),
module_object=dst_group,
),
)

View file

@ -111,13 +111,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='spanSrcGrp',
aci_rn='srcgrp-{}'.format(src_group),
filter_target='(spanSrcGrp.name, "{}")'.format(src_group),
filter_target='eq(spanSrcGrp.name, "{}")'.format(src_group),
module_object=src_group,
),
child_classes=['spanSpanLbl'],

View file

@ -102,19 +102,19 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='spanSrcGrp',
aci_rn='srcgrp-{}'.format(src_group),
filter_target='(spanSrcGrp.name, "{}")'.format(src_group),
filter_target='eq(spanSrcGrp.name, "{}")'.format(src_group),
module_object=src_group,
),
subclass_2=dict(
aci_class='spanSpanLbl',
aci_rn='spanlbl-{}'.format(dst_group),
filter_target='(spanSpanLbl.name, "{}")'.format(dst_group),
filter_target='eq(spanSpanLbl.name, "{}")'.format(dst_group),
module_object=dst_group,
),
)

View file

@ -136,13 +136,13 @@ def main():
root_class=dict(
aci_class='fvTenant',
aci_rn='tn-{}'.format(tenant),
filter_target='(fvTenant.name, "{}")'.format(tenant),
filter_target='eq(fvTenant.name, "{}")'.format(tenant),
module_object=tenant,
),
subclass_1=dict(
aci_class='fvCtx',
aci_rn='ctx-{}'.format(vrf),
filter_target='(fvCtx.name, "{}")'.format(vrf),
filter_target='eq(fvCtx.name, "{}")'.format(vrf),
module_object=vrf,
),
)