Reorganize code
This commit is contained in:
parent
ac2c1a89a8
commit
7de09a4652
1 changed files with 24 additions and 24 deletions
|
@ -260,29 +260,6 @@ def main():
|
|||
policy_group = module.params['policy_group']
|
||||
state = module.params['state']
|
||||
|
||||
aci = ACIModule(module)
|
||||
aci.construct_url(
|
||||
root_class=dict(
|
||||
aci_class='infraNodeP',
|
||||
aci_rn='infra/nprof-{0}'.format(leaf_profile),
|
||||
module_object=leaf_profile,
|
||||
target_filter={'name': leaf_profile},
|
||||
),
|
||||
subclass_1=dict(
|
||||
aci_class='infraLeafS',
|
||||
# NOTE: normal rn: leaves-{name}-typ-{type}, hence here hardcoded to range for purposes of module
|
||||
aci_rn='leaves-{0}-typ-range'.format(leaf),
|
||||
module_object=leaf,
|
||||
target_filter={'name': leaf},
|
||||
),
|
||||
# NOTE: infraNodeBlk is not made into a subclass because there is a 1-1 mapping between node block and leaf selector name
|
||||
child_classes=['infraNodeBlk', 'infraRsAccNodePGrp'],
|
||||
|
||||
)
|
||||
|
||||
aci.get_existing()
|
||||
|
||||
if state == 'present':
|
||||
# Build child_configs dynamically
|
||||
child_configs = [
|
||||
dict(
|
||||
|
@ -307,6 +284,29 @@ def main():
|
|||
),
|
||||
))
|
||||
|
||||
aci = ACIModule(module)
|
||||
aci.construct_url(
|
||||
root_class=dict(
|
||||
aci_class='infraNodeP',
|
||||
aci_rn='infra/nprof-{0}'.format(leaf_profile),
|
||||
module_object=leaf_profile,
|
||||
target_filter={'name': leaf_profile},
|
||||
),
|
||||
subclass_1=dict(
|
||||
aci_class='infraLeafS',
|
||||
# NOTE: normal rn: leaves-{name}-typ-{type}, hence here hardcoded to range for purposes of module
|
||||
aci_rn='leaves-{0}-typ-range'.format(leaf),
|
||||
module_object=leaf,
|
||||
target_filter={'name': leaf},
|
||||
),
|
||||
# NOTE: infraNodeBlk is not made into a subclass because there is a 1-1 mapping between node block and leaf selector name
|
||||
child_classes=['infraNodeBlk', 'infraRsAccNodePGrp'],
|
||||
|
||||
)
|
||||
|
||||
aci.get_existing()
|
||||
|
||||
if state == 'present':
|
||||
aci.payload(
|
||||
aci_class='infraLeafS',
|
||||
class_config=dict(
|
||||
|
|
Loading…
Reference in a new issue