aci_iplpg: Various fixes to integration tests/module (#36460)
This commit is contained in:
parent
6402a3e504
commit
5635c50f9b
2 changed files with 130 additions and 123 deletions
|
@ -22,9 +22,6 @@ description:
|
||||||
author:
|
author:
|
||||||
- Bruno Calogero (@brunocalogero)
|
- Bruno Calogero (@brunocalogero)
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
notes:
|
|
||||||
- When using the module please select the appropriate link_aggregation_type (lag_type).
|
|
||||||
C(link) for Port Channel(PC), C(node) for Virtual Port Channel(VPC) and C(leaf) for Leaf Access Port Policy Group.
|
|
||||||
options:
|
options:
|
||||||
policy_group:
|
policy_group:
|
||||||
description:
|
description:
|
||||||
|
@ -37,7 +34,11 @@ options:
|
||||||
lag_type:
|
lag_type:
|
||||||
description:
|
description:
|
||||||
- Selector for the type of leaf policy group we want to create.
|
- Selector for the type of leaf policy group we want to create.
|
||||||
|
- C(leaf) for Leaf Access Port Policy Group
|
||||||
|
- C(link) for Port Channel (PC)
|
||||||
|
- C(node) for Virtual Port Channel (VPC)
|
||||||
aliases: [ lag_type_name ]
|
aliases: [ lag_type_name ]
|
||||||
|
choices: [ leaf, link, node ]
|
||||||
link_level_policy:
|
link_level_policy:
|
||||||
description:
|
description:
|
||||||
- Choice of link_level_policy to be used as part of the leaf policy group to be created.
|
- Choice of link_level_policy to be used as part of the leaf policy group to be created.
|
||||||
|
@ -271,9 +272,9 @@ def main():
|
||||||
argument_spec.update({
|
argument_spec.update({
|
||||||
'policy_group': dict(type='str', aliases=['name', 'policy_group_name']),
|
'policy_group': dict(type='str', aliases=['name', 'policy_group_name']),
|
||||||
'description': dict(type='str', aliases=['descr']),
|
'description': dict(type='str', aliases=['descr']),
|
||||||
# NOTE: Since this module needs to include both infra:AccBndlGrp (for PC andVPC) and infra:AccPortGrp (for leaf access port policy group):
|
# NOTE: Since this module needs to include both infra:AccBndlGrp (for PC and VPC) and infra:AccPortGrp (for leaf access port policy group):
|
||||||
# NOTE: I'll allow the user to make the choice here (link(PC), node(VPC), leaf(leaf-access port policy group))
|
# NOTE: I'll allow the user to make the choice here (link(PC), node(VPC), leaf(leaf-access port policy group))
|
||||||
'lag_type': dict(type='str', aliases=['lag_type_name']),
|
'lag_type': dict(type='str', aliases=['lag_type_name'], choices=['leaf', 'link', 'node']),
|
||||||
'link_level_policy': dict(type='str', aliases=['link_level_policy_name']),
|
'link_level_policy': dict(type='str', aliases=['link_level_policy_name']),
|
||||||
'cdp_policy': dict(type='str', aliases=['cdp_policy_name']),
|
'cdp_policy': dict(type='str', aliases=['cdp_policy_name']),
|
||||||
'mcp_policy': dict(type='str', aliases=['mcp_policy_name']),
|
'mcp_policy': dict(type='str', aliases=['mcp_policy_name']),
|
||||||
|
@ -290,16 +291,16 @@ def main():
|
||||||
'l2_interface_policy': dict(type='str', aliases=['l2_interface_policy_name']),
|
'l2_interface_policy': dict(type='str', aliases=['l2_interface_policy_name']),
|
||||||
'port_security_policy': dict(type='str', aliases=['port_security_policy_name']),
|
'port_security_policy': dict(type='str', aliases=['port_security_policy_name']),
|
||||||
'aep': dict(type='str', aliases=['aep_name']),
|
'aep': dict(type='str', aliases=['aep_name']),
|
||||||
'state': dict(type='str', default='present', choices=['absent', 'present', 'query'])
|
'state': dict(type='str', default='present', choices=['absent', 'present', 'query']),
|
||||||
})
|
})
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=[
|
required_if=[
|
||||||
['state', 'absent', ['policy_group', 'lag_type']],
|
['state', 'absent', ['lag_type', 'policy_group']],
|
||||||
['state', 'present', ['policy_group', 'lag_type']]
|
['state', 'present', ['lag_type', 'policy_group']],
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
policy_group = module.params['policy_group']
|
policy_group = module.params['policy_group']
|
||||||
|
@ -322,9 +323,6 @@ def main():
|
||||||
port_security_policy = module.params['port_security_policy']
|
port_security_policy = module.params['port_security_policy']
|
||||||
aep = module.params['aep']
|
aep = module.params['aep']
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
aci_class_name = ''
|
|
||||||
dn_name = ''
|
|
||||||
class_config_dict = {}
|
|
||||||
|
|
||||||
if lag_type == 'leaf':
|
if lag_type == 'leaf':
|
||||||
aci_class_name = 'infraAccPortGrp'
|
aci_class_name = 'infraAccPortGrp'
|
||||||
|
@ -332,7 +330,6 @@ def main():
|
||||||
class_config_dict = dict(
|
class_config_dict = dict(
|
||||||
name=policy_group,
|
name=policy_group,
|
||||||
descr=description,
|
descr=description,
|
||||||
dn='uni/infra/funcprof/{0}-{1}'.format(dn_name, policy_group)
|
|
||||||
)
|
)
|
||||||
elif lag_type == 'link' or lag_type == 'node':
|
elif lag_type == 'link' or lag_type == 'node':
|
||||||
aci_class_name = 'infraAccBndlGrp'
|
aci_class_name = 'infraAccBndlGrp'
|
||||||
|
@ -341,7 +338,6 @@ def main():
|
||||||
name=policy_group,
|
name=policy_group,
|
||||||
descr=description,
|
descr=description,
|
||||||
lagT=lag_type,
|
lagT=lag_type,
|
||||||
dn='uni/infra/funcprof/{0}-{1}'.format(dn_name, policy_group)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
aci = ACIModule(module)
|
aci = ACIModule(module)
|
||||||
|
@ -350,15 +346,26 @@ def main():
|
||||||
aci_class=aci_class_name,
|
aci_class=aci_class_name,
|
||||||
aci_rn='infra/funcprof/{0}-{1}'.format(dn_name, policy_group),
|
aci_rn='infra/funcprof/{0}-{1}'.format(dn_name, policy_group),
|
||||||
filter_target='eq({0}.name, "{1}")'.format(aci_class_name, policy_group),
|
filter_target='eq({0}.name, "{1}")'.format(aci_class_name, policy_group),
|
||||||
module_object=policy_group
|
module_object=policy_group,
|
||||||
),
|
),
|
||||||
child_classes=[
|
child_classes=[
|
||||||
'infraRsMonIfInfraPol', 'infraRsLldpIfPol', 'infraRsFcIfPol',
|
'infraRsAttEntP',
|
||||||
'infraRsLacpPol', 'infraRsL2PortSecurityPol', 'infraRsHIfPol',
|
'infraRsCdpIfPol',
|
||||||
'infraRsQosPfcIfPol', 'infraRsStpIfPol', 'infraRsQosIngressDppIfPol',
|
'infraRsFcIfPol',
|
||||||
'infraRsStormctrlIfPol', 'infraRsQosEgressDppIfPol', 'infraRsQosSdIfPol',
|
'infraRsHIfPol',
|
||||||
'infraRsAttEntP', 'infraRsMcpIfPol', 'infraRsCdpIfPol', 'infraRsL2IfPol'
|
'infraRsL2IfPol',
|
||||||
]
|
'infraRsL2PortSecurityPol',
|
||||||
|
'infraRsLacpPol',
|
||||||
|
'infraRsLldpIfPol',
|
||||||
|
'infraRsMcpIfPol',
|
||||||
|
'infraRsMonIfInfraPol',
|
||||||
|
'infraRsQosEgressDppIfPol',
|
||||||
|
'infraRsQosIngressDppIfPol',
|
||||||
|
'infraRsQosPfcIfPol',
|
||||||
|
'infraRsQosSdIfPol',
|
||||||
|
'infraRsStormctrlIfPol',
|
||||||
|
'infraRsStpIfPol',
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
aci.get_existing()
|
aci.get_existing()
|
||||||
|
@ -370,117 +377,117 @@ def main():
|
||||||
class_config=class_config_dict,
|
class_config=class_config_dict,
|
||||||
child_configs=[
|
child_configs=[
|
||||||
dict(
|
dict(
|
||||||
infraRsMonIfInfraPol=dict(
|
infraRsAttEntP=dict(
|
||||||
attributes=dict(
|
attributes=dict(
|
||||||
tnMonInfraPolName=monitoring_policy
|
tDn='uni/infra/attentp-{0}'.format(aep),
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
dict(
|
|
||||||
infraRsLldpIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnLldpIfPolName=lldp_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
dict(
|
|
||||||
infraRsFcIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnFcIfPolName=fibre_channel_interface_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsLacpPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnLacpLagPolName=port_channel_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsL2PortSecurityPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnL2PortSecurityPolName=port_security_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsHIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnFabricHIfPolName=link_level_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsQosPfcIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnQosPfcIfPolName=priority_flow_control_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsStpIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnStpIfPolName=stp_interface_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsQosIngressDppIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnQosDppPolName=ingress_data_plane_policing_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsStormctrlIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnStormctrlIfPolName=storm_control_interface_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsQosEgressDppIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnQosDppPolName=egress_data_plane_policing_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsQosSdIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnQosSdIfPolName=slow_drain_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
infraRsMcpIfPol=dict(
|
|
||||||
attributes=dict(
|
|
||||||
tnMcpIfPolName=mcp_policy
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
infraRsCdpIfPol=dict(
|
infraRsCdpIfPol=dict(
|
||||||
attributes=dict(
|
attributes=dict(
|
||||||
tnCdpIfPolName=cdp_policy
|
tnCdpIfPolName=cdp_policy,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsFcIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnFcIfPolName=fibre_channel_interface_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsHIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnFabricHIfPolName=link_level_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
infraRsL2IfPol=dict(
|
infraRsL2IfPol=dict(
|
||||||
attributes=dict(
|
attributes=dict(
|
||||||
tnL2IfPolName=l2_interface_policy
|
tnL2IfPolName=l2_interface_policy,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
dict(
|
dict(
|
||||||
infraRsAttEntP=dict(
|
infraRsL2PortSecurityPol=dict(
|
||||||
attributes=dict(
|
attributes=dict(
|
||||||
tDn='uni/infra/attentp-{0}'.format(aep)
|
tnL2PortSecurityPolName=port_security_policy,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
|
dict(
|
||||||
|
infraRsLacpPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnLacpLagPolName=port_channel_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsLldpIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnLldpIfPolName=lldp_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsMcpIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnMcpIfPolName=mcp_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsMonIfInfraPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnMonInfraPolName=monitoring_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsQosEgressDppIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnQosDppPolName=egress_data_plane_policing_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsQosIngressDppIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnQosDppPolName=ingress_data_plane_policing_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsQosPfcIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnQosPfcIfPolName=priority_flow_control_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsQosSdIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnQosSdIfPolName=slow_drain_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsStormctrlIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnStormctrlIfPolName=storm_control_interface_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dict(
|
||||||
|
infraRsStpIfPol=dict(
|
||||||
|
attributes=dict(
|
||||||
|
tnStpIfPolName=stp_interface_policy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.changed == true
|
- intf_policy_leaf_polgrp_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.previous == []
|
- intf_policy_leaf_polgrp_present.previous == []
|
||||||
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"dn": "uni/infra/funcprof/accbundle-policygroupname","lagT": "link","name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "link","name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
||||||
- intf_policy_leaf_polgrp_idempotent.changed == false
|
- intf_policy_leaf_polgrp_idempotent.changed == false
|
||||||
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
||||||
- intf_policy_leaf_polgrp_update.changed == true
|
- intf_policy_leaf_polgrp_update.changed == true
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.changed == true
|
- intf_policy_leaf_polgrp_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.previous == []
|
- intf_policy_leaf_polgrp_present.previous == []
|
||||||
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"dn": "uni/infra/funcprof/accbundle-policygroupname","lagT": "node","name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccBndlGrp": {"attributes": {"lagT": "node","name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
||||||
- intf_policy_leaf_polgrp_idempotent.changed == false
|
- intf_policy_leaf_polgrp_idempotent.changed == false
|
||||||
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
||||||
- intf_policy_leaf_polgrp_update.changed == true
|
- intf_policy_leaf_polgrp_update.changed == true
|
||||||
|
@ -336,7 +336,7 @@
|
||||||
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
- intf_policy_leaf_polgrp_check_mode_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.changed == true
|
- intf_policy_leaf_polgrp_present.changed == true
|
||||||
- intf_policy_leaf_polgrp_present.previous == []
|
- intf_policy_leaf_polgrp_present.previous == []
|
||||||
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccPortGrp": {"attributes": {"dn": "uni/infra/funcprof/accportgrp-policygroupname","name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
- 'intf_policy_leaf_polgrp_present.sent == {"infraAccPortGrp": {"attributes": {"name": "policygroupname"},"children": [{"infraRsFcIfPol": {"attributes": {"tnFcIfPolName": "fiberchannelpolicy"}}},{"infraRsHIfPol": {"attributes": {"tnFabricHIfPolName": "linklevelpolicy"}}},{"infraRsAttEntP": {"attributes": {"tDn": "uni/infra/attentp-None"}}}]}}'
|
||||||
- intf_policy_leaf_polgrp_idempotent.changed == false
|
- intf_policy_leaf_polgrp_idempotent.changed == false
|
||||||
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
- intf_policy_leaf_polgrp_idempotent.sent == {}
|
||||||
- intf_policy_leaf_polgrp_update.changed == true
|
- intf_policy_leaf_polgrp_update.changed == true
|
||||||
|
|
Loading…
Add table
Reference in a new issue