Reorganize code

This commit is contained in:
Dag Wieers 2018-11-02 18:30:32 +01:00 committed by Toshio Kuratomi
parent ac2c1a89a8
commit 7de09a4652

View file

@ -260,6 +260,30 @@ def main():
policy_group = module.params['policy_group']
state = module.params['state']
# 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 = ACIModule(module)
aci.construct_url(
root_class=dict(
@ -283,30 +307,6 @@ def main():
aci.get_existing()
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_class='infraLeafS',
class_config=dict(