diff --git a/changelogs/fragments/fix_ana_599.yaml b/changelogs/fragments/fix_ana_599.yaml new file mode 100644 index 000000000..6d74ad926 --- /dev/null +++ b/changelogs/fragments/fix_ana_599.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - "[l3_interfaces] - fix the no ipv6_redirects command to run when explicitly configured in the playbook, regardless of the device's current behavior." diff --git a/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py index e9aa2ee02..e3479e007 100644 --- a/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py +++ b/plugins/module_utils/network/nxos/config/l3_interfaces/l3_interfaces.py @@ -482,10 +482,10 @@ def add_commands(self, diff, name=""): self.cmd_order_fixup(commands, name) if "ipv6_redirects" in diff: # Note: device will auto-disable redirects when secondaries are present - if diff["ipv6_redirects"] != self.check_existing(name, "ipv6_redirects"): - no_cmd = "no " if diff["ipv6_redirects"] is False else "" - commands.append(no_cmd + "ipv6 redirects") - self.cmd_order_fixup(commands, name) + # if diff["ipv6_redirects"] != self.check_existing(name, "ipv6_redirects"): + no_cmd = "no " if diff["ipv6_redirects"] is False else "" + commands.append(no_cmd + "ipv6 redirects") + self.cmd_order_fixup(commands, name) if "unreachables" in diff: if diff["unreachables"] != self.check_existing(name, "unreachables"): no_cmd = "no " if diff["unreachables"] is False else "" diff --git a/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py b/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py index 7bb5da30e..b5bf2aa67 100644 --- a/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py +++ b/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py @@ -1044,3 +1044,26 @@ def test_replaced_tag(self): playbook["state"] = "replaced" set_module_args(playbook, ignore_provider_arg) self.execute_module(changed=True, commands=commands) + + def test_ipv6_redirects(self): + existing = dedent( + """\ + interface Ethernet1/2 + ipv6 redirects + """, + ) + self.get_resource_connection_facts.return_value = {self.SHOW_CMD: existing} + playbook = dict( + config=[ + dict( + name="Ethernet1/2", + ipv6_redirects=False, + ), + ], + state="merged", + ) + + commands = ["interface Ethernet1/2", "no ipv6 redirects"] + playbook["state"] = "merged" + set_module_args(playbook, ignore_provider_arg) + self.execute_module(changed=True, commands=commands)