diff --git a/plugins/modules/aci_bd_subnet.py b/plugins/modules/aci_bd_subnet.py index c10db5c8c..19a9deee7 100644 --- a/plugins/modules/aci_bd_subnet.py +++ b/plugins/modules/aci_bd_subnet.py @@ -91,6 +91,13 @@ - The name of the Subnet. type: str aliases: [ name ] + ip_data_plane_learning: + description: + - Whether IP data plane learning is enabled or disabled. + - The APIC defaults to C(enabled) when unset during creation. + type: str + choices: [ enabled, disabled ] + aliases: [ ip_dataplane_learning ] tenant: description: - The name of the Tenant. @@ -369,6 +376,7 @@ def main(): state=dict(type="str", default="present", choices=["absent", "present", "query"]), tenant=dict(type="str", aliases=["tenant_name"]), # Not required for querying all objects name_alias=dict(type="str"), + ip_data_plane_learning=dict(type="str", choices=["enabled", "disabled"], aliases=["ip_dataplane_learning"]), ) module = AnsibleModule( @@ -410,7 +418,7 @@ def main(): if subnet_control: subnet_control = SUBNET_CONTROL_MAPPING[subnet_control] name_alias = module.params.get("name_alias") - + ip_data_plane_learning = module.params.get("ip_data_plane_learning") aci.construct_url( root_class=dict( aci_class="fvTenant", @@ -447,6 +455,7 @@ def main(): scope=scope, virtual=enable_vip, nameAlias=name_alias, + ipDPLearning=ip_data_plane_learning, ), child_configs=[ {"fvRsBDSubnetToProfile": {"attributes": {"tnL3extOutName": route_profile_l3_out, "tnRtctrlProfileName": route_profile}}}, diff --git a/plugins/modules/aci_vrf.py b/plugins/modules/aci_vrf.py index 49c0c9fc1..1aa87f2a3 100644 --- a/plugins/modules/aci_vrf.py +++ b/plugins/modules/aci_vrf.py @@ -43,6 +43,13 @@ - The description for the VRF. type: str aliases: [ descr ] + ip_data_plane_learning: + description: + - Whether IP data plane learning is enabled or disabled. + - The APIC defaults to C(enabled) when unset during creation. + type: str + choices: [ enabled, disabled ] + aliases: [ ip_dataplane_learning ] state: description: - Use C(present) or C(absent) for adding or removing. @@ -256,6 +263,7 @@ def main(): preferred_group=dict(type="str", choices=["enabled", "disabled"]), match_type=dict(type="str", choices=["all", "at_least_one", "at_most_one", "none"]), name_alias=dict(type="str"), + ip_data_plane_learning=dict(type="str", choices=["enabled", "disabled"], aliases=["ip_dataplane_learning"]), ) module = AnsibleModule( @@ -276,6 +284,7 @@ def main(): name_alias = module.params.get("name_alias") preferred_group = module.params.get("preferred_group") match_type = module.params.get("match_type") + ip_data_plane_learning = module.params.get("ip_data_plane_learning") if match_type is not None: match_type = MATCH_TYPE_MAPPING[match_type] @@ -308,6 +317,7 @@ def main(): pcEnfPref=policy_control_preference, name=vrf, nameAlias=name_alias, + ipDataPlaneLearning=ip_data_plane_learning, ), child_configs=[ dict(vzAny=dict(attributes=dict(prefGrMemb=preferred_group, matchT=match_type))), diff --git a/tests/integration/targets/aci_bd_subnet/tasks/main.yml b/tests/integration/targets/aci_bd_subnet/tasks/main.yml index 10f00990c..f9833cf75 100644 --- a/tests/integration/targets/aci_bd_subnet/tasks/main.yml +++ b/tests/integration/targets/aci_bd_subnet/tasks/main.yml @@ -68,6 +68,7 @@ scope: [private, shared] route_profile: default route_profile_l3_out: default + ip_data_plane_learning: disabled register: create_subnet2 - name: create subnet again - idempotency works @@ -105,8 +106,10 @@ - create_check_mode.sent.fvSubnet.attributes.name == create_subnet.sent.fvSubnet.attributes.name == 'anstest' - create_subnet is changed - create_subnet.current.0.fvSubnet.attributes.annotation == 'orchestrator:ansible' + - create_subnet.current.0.fvSubnet.attributes.ipDPLearning == 'enabled' - create_subnet.previous == [] - create_subnet2 is changed + - create_subnet2.current.0.fvSubnet.attributes.ipDPLearning == 'disabled' - create_subnet2.sent == create_subnet2.proposed - create_subnet2.sent.fvSubnet.attributes.scope == "private,shared" - create_subnet2.sent.fvSubnet.children.0.fvRsBDSubnetToProfile.attributes.tnL3extOutName == 'default' diff --git a/tests/integration/targets/aci_vrf/tasks/main.yml b/tests/integration/targets/aci_vrf/tasks/main.yml index fa3f1057c..695f40fe7 100644 --- a/tests/integration/targets/aci_vrf/tasks/main.yml +++ b/tests/integration/targets/aci_vrf/tasks/main.yml @@ -62,6 +62,7 @@ policy_control_direction: egress preferred_group: enabled match_type: all + ip_data_plane_learning: disabled register: vrf_present_2 - name: create vrf without all necessary params - failure message works @@ -80,6 +81,7 @@ - vrf_present is changed - vrf_present.sent == vrf_present_check_mode.sent - vrf_present.current.0.fvCtx.attributes.annotation == 'orchestrator:ansible' + - vrf_present.current.0.fvCtx.attributes.ipDataPlaneLearning == 'enabled' - vrf_present.previous == [] - vrf_present_idempotent is not changed - vrf_present_idempotent.previous != [] @@ -88,9 +90,11 @@ - vrf_update.sent != vrf_update.proposed - vrf_update.sent.fvCtx.attributes.descr == 'Ansible Test Update' - vrf_update.sent.fvCtx.attributes.pcEnfPref == 'unenforced' + - vrf_update.current.0.fvCtx.attributes.ipDataPlaneLearning == 'enabled' - vrf_present_2.sent.fvCtx.attributes.name == 'anstest2' - vrf_present_2.sent.fvCtx.attributes.pcEnfDir == 'egress' - vrf_present_2.sent.fvCtx.attributes.descr == 'Ansible Test' + - vrf_present_2.current.0.fvCtx.attributes.ipDataPlaneLearning == 'disabled' - vrf_present_2.current.0.fvCtx.children.0.vzAny.attributes.matchT == 'All' - vrf_present_2.current.0.fvCtx.children.0.vzAny.attributes.prefGrMemb == 'enabled' - vrf_present_missing_param is failed