Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Fix no ipv6_redirects command not being sent from module to device" #913

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Ruchip16
Copy link
Contributor

@Ruchip16 Ruchip16 commented Dec 7, 2024

SUMMARY

When an interface is already configured with both an ipv4 address and ipv6 address (dual stacked), the no ipv6 redirect command is NOT sent from the module to the device.

ISSUE TYPE
  • Bugfix Pull Request
  • link: ANA-599
COMPONENT NAME

nxos.l3_interfaces

ADDITIONAL INFORMATION

So the NX-OS module has a built-in behaviour where the device may auto-disable IPv6 redirects in certain scenarios (e.g., dual-stack configuration), and explicitly setting both redirects and ipv6_redirects may be required to achieve the desired state.

  • Device Behavior:
    The note in the add_commands function, indicates the following:

"Device will auto-disable redirects when secondaries are present."

means that the device has a built-in behavior where it auto-disables IPv6 redirects in certain scenarios, such as dual-stacked interfaces (both IPv4 and IPv6 configured) or when multiple IP addresses are present (secondary addresses).
The no ipv6 redirects command may depend on the state of redirects (IPv4 redirects). This is an inherent behavior of the device.

1. Expected Behavior:

When ipv6_redirects: false is specified in the playbook, the module should send the command: no ipv6 redirects

2. Actual Behavior: (My observation)

If only ipv6_redirects: false is set, the no ipv6 redirects command may be skipped because the device already auto-disables IPv6 redirects.

Setting both redirects: false and ipv6_redirects: false ensures both commands (no ip redirects and no ipv6 redirects) are sent, overriding the device's implicit behavior.

3. Proposed solution 1: Update the playbook

- name: Configure interface
  hosts: nxos
  gather_facts: false
  tasks:
    - name: Disable IPv6 redirects
      cisco.nxos.nxos_l3_interfaces:
        config:
          - name: Ethernet1/2
            redirects: false
            ipv6_redirects: false
        state: merged

this would execute the following commands:

 "commands": [
        "interface Ethernet1/2",
        "no ip redirects",
        "no ipv6 redirects"
    ],

Proposed solution 2: Update the code to execute the command when explicitly configured in the playbook, regardless of the device's current behavior

@@ -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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants