aci_switch_leaf_selector: Support empty policy_group

This commit is contained in:
Dag Wieers 2018-11-02 17:07:50 +01:00 committed by Toshio Kuratomi
parent b0b9b4f7dd
commit ac2c1a89a8
2 changed files with 27 additions and 19 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- aci_switch_leaf_selector - Support empty policy_group

View file

@ -283,31 +283,37 @@ def main():
aci.get_existing() aci.get_existing()
if state == 'present': if state == 'present':
# Build child_configs dynamically
child_configs = [
dict(
infraNodeBlk=dict(
attributes=dict(
descr=leaf_node_blk_description,
name=leaf_node_blk,
from_=from_,
to_=to_,
),
),
),
]
# Add infraRsAccNodePGrp only when policy_group was defined
if policy_group is not None:
child_configs.append(dict(
infraRsAccNodePGrp=dict(
attributes=dict(
tDn='uni/infra/funcprof/accnodepgrp-{0}'.format(policy_group),
),
),
))
aci.payload( aci.payload(
aci_class='infraLeafS', aci_class='infraLeafS',
class_config=dict( class_config=dict(
descr=description, descr=description,
name=leaf, name=leaf,
), ),
child_configs=[ child_configs=child_configs,
dict(
infraNodeBlk=dict(
attributes=dict(
descr=leaf_node_blk_description,
name=leaf_node_blk,
from_=from_,
to_=to_,
),
),
),
dict(
infraRsAccNodePGrp=dict(
attributes=dict(
tDn='uni/infra/funcprof/accnodepgrp-{0}'.format(policy_group),
),
),
),
],
) )
aci.get_diff(aci_class='infraLeafS') aci.get_diff(aci_class='infraLeafS')