Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/fix_ana_599.yaml
Original file line number Diff line number Diff line change
@@ -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."
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check must have been added previously for a reason and we should not drop it without a proper justification.

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 ""
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case seems to pass even without the changes in this PR. I don't think this covers the bug being solved.

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)
Loading