[2.7] aci_iplpg: Support missing aep (#48115)

* aci_iplpg: Support missing aep

* Adapt integration tests to fix

* Add changelog fragment

* Fix PEP8 issue
This commit is contained in:
Dag Wieers 2018-11-05 19:52:04 +01:00 committed by Toshio Kuratomi
parent c78945d184
commit 5dfd7c181f
3 changed files with 124 additions and 117 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- aci_interface_policy_leaf_policy_group - Support missing aep

View file

@ -370,48 +370,7 @@ def main():
lagT=lag_type, lagT=lag_type,
) )
aci = ACIModule(module) child_configs = [
aci.construct_url(
root_class=dict(
aci_class=aci_class_name,
aci_rn='infra/funcprof/{0}-{1}'.format(dn_name, policy_group),
module_object=policy_group,
target_filter={'name': policy_group, 'lagT': lag_type},
),
child_classes=[
'infraRsAttEntP',
'infraRsCdpIfPol',
'infraRsFcIfPol',
'infraRsHIfPol',
'infraRsL2IfPol',
'infraRsL2PortSecurityPol',
'infraRsLacpPol',
'infraRsLldpIfPol',
'infraRsMcpIfPol',
'infraRsMonIfInfraPol',
'infraRsQosEgressDppIfPol',
'infraRsQosIngressDppIfPol',
'infraRsQosPfcIfPol',
'infraRsQosSdIfPol',
'infraRsStormctrlIfPol',
'infraRsStpIfPol',
],
)
aci.get_existing()
if state == 'present':
aci.payload(
aci_class=aci_class_name,
class_config=class_config_dict,
child_configs=[
dict(
infraRsAttEntP=dict(
attributes=dict(
tDn='uni/infra/attentp-{0}'.format(aep),
),
),
),
dict( dict(
infraRsCdpIfPol=dict( infraRsCdpIfPol=dict(
attributes=dict( attributes=dict(
@ -517,9 +476,55 @@ def main():
), ),
), ),
), ),
]
# Add infraRsattEntP binding only when aep was defined
if aep is not None:
child_configs.append(dict(
infraRsAttEntP=dict(
attributes=dict(
tDn='uni/infra/attentp-{0}'.format(aep),
),
),
))
aci = ACIModule(module)
aci.construct_url(
root_class=dict(
aci_class=aci_class_name,
aci_rn='infra/funcprof/{0}-{1}'.format(dn_name, policy_group),
module_object=policy_group,
target_filter={'name': policy_group, 'lagT': lag_type},
),
child_classes=[
'infraRsAttEntP',
'infraRsCdpIfPol',
'infraRsFcIfPol',
'infraRsHIfPol',
'infraRsL2IfPol',
'infraRsL2PortSecurityPol',
'infraRsLacpPol',
'infraRsLldpIfPol',
'infraRsMcpIfPol',
'infraRsMonIfInfraPol',
'infraRsQosEgressDppIfPol',
'infraRsQosIngressDppIfPol',
'infraRsQosPfcIfPol',
'infraRsQosSdIfPol',
'infraRsStormctrlIfPol',
'infraRsStpIfPol',
], ],
) )
aci.get_existing()
if state == 'present':
aci.payload(
aci_class=aci_class_name,
class_config=class_config_dict,
child_configs=child_configs,
)
aci.get_diff(aci_class=aci_class_name) aci.get_diff(aci_class=aci_class_name)
aci.post_config() aci.post_config()

View file

@ -90,7 +90,7 @@
- intf_policy_leaf_polgrp_check_mode_present is changed - intf_policy_leaf_polgrp_check_mode_present is changed
- intf_policy_leaf_polgrp_present is changed - intf_policy_leaf_polgrp_present is changed
- intf_policy_leaf_polgrp_present.previous == [] - intf_policy_leaf_polgrp_present.previous == []
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "link","name": "policygroupname_link"},"children": [{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}},{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "link","name": "policygroupname_link"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}'
- intf_policy_leaf_polgrp_idempotent is not changed - intf_policy_leaf_polgrp_idempotent is not changed
- intf_policy_leaf_polgrp_idempotent.sent == {} - intf_policy_leaf_polgrp_idempotent.sent == {}
- intf_policy_leaf_polgrp_update is changed - intf_policy_leaf_polgrp_update is changed
@ -209,7 +209,7 @@
- intf_policy_leaf_polgrp_check_mode_present is changed - intf_policy_leaf_polgrp_check_mode_present is changed
- intf_policy_leaf_polgrp_present is changed - intf_policy_leaf_polgrp_present is changed
- intf_policy_leaf_polgrp_present.previous == [] - intf_policy_leaf_polgrp_present.previous == []
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "node","name": "policygroupname_node"},"children": [{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}},{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "node","name": "policygroupname_node"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}'
- intf_policy_leaf_polgrp_idempotent is not changed - intf_policy_leaf_polgrp_idempotent is not changed
- intf_policy_leaf_polgrp_idempotent.sent == {} - intf_policy_leaf_polgrp_idempotent.sent == {}
- intf_policy_leaf_polgrp_update is changed - intf_policy_leaf_polgrp_update is changed
@ -363,7 +363,7 @@
- intf_policy_leaf_polgrp_check_mode_present is changed - intf_policy_leaf_polgrp_check_mode_present is changed
- intf_policy_leaf_polgrp_present is changed - intf_policy_leaf_polgrp_present is changed
- intf_policy_leaf_polgrp_present.previous == [] - intf_policy_leaf_polgrp_present.previous == []
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccPortGrp": {"attributes": {"name": "policygroupname_leaf"},"children": [{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}},{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}' - 'intf_policy_leaf_polgrp_present.sent == {"infraAccPortGrp": {"attributes": {"name": "policygroupname_leaf"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}}]}}'
- intf_policy_leaf_polgrp_idempotent is not changed - intf_policy_leaf_polgrp_idempotent is not changed
- intf_policy_leaf_polgrp_idempotent.sent == {} - intf_policy_leaf_polgrp_idempotent.sent == {}
- intf_policy_leaf_polgrp_update is changed - intf_policy_leaf_polgrp_update is changed