Skip to content

Conversation

ChrisPortman
Copy link

SUMMARY

v10.2.0 removed the use of module_utils.network.nxos.nxos.default_intf_enabled() to determine the targets default state of various interface types.

This change re-instates that behaviour, to resolve idempotency issues. Tests are adjusted to suit.

Fixes #974

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

Module: interfaces

no_cmd = True if self.defaults.get("default_mode") == "layer3" else False
self.addcmd(have, "mode", no_cmd)

# Handle the 'enabled' state separately
Copy link
Author

Choose a reason for hiding this comment

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

Moves the resolution of the state to after the interface mode, so that we can feed the final have_mode into the enabled state resolution.

"interface port-channel4",
"no shutdown",
]
result = self.execute_module(changed=True, device="legacy")
Copy link
Author

Choose a reason for hiding this comment

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

This actually appears to be ineffective. The parent class does not process the "device" arg at all from what I can see. Or load any fixtures one way or another

v10.2.0 removed the use of `module_utils.network.nxos.nxos.default_intf_enabled()` to determine the
targets default state of various interface types.

This change re-instates that behaviour, to resolve idempotency issues.  Tests are adjusted to suit.
"result": {
'{{ name }}': {
'enabled': "{{ False if shutdown is defined and negate is not defined else True }}",
'enabled': "{{ True if negate is defined and shutdown is defined else False if shutdown is defined else None }}",
Copy link
Author

@ChrisPortman ChrisPortman Aug 18, 2025

Choose a reason for hiding this comment

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

Dont assume at this point that the absence of (no)? shutdown implies either enabled or disabled.

This change means we only set enabled True|False if it is explicit in the show run output, other wise its None.

Copy link
Author

@ChrisPortman ChrisPortman Aug 18, 2025

Choose a reason for hiding this comment

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

Perhaps the logic that resolves facts should handle the system default shutdown logic such that the facts are complete. But that's not the previous convention.

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.

nxos_interfaces no longer idempotent with enable and disable

1 participant