From 3a65be4c08b0defa9d73a6ef9f7f056b377753c0 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Tue, 6 Feb 2024 21:42:22 +0530 Subject: [PATCH] [interfaces] correctly enable interfaces on N3K (#813) Signed-off-by: NilashishC --- changelogs/fragments/fix_749.yaml | 3 +++ .../module_utils/network/nxos/config/interfaces/interfaces.py | 4 ++-- tests/unit/modules/network/nxos/test_nxos_interfaces.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/fix_749.yaml diff --git a/changelogs/fragments/fix_749.yaml b/changelogs/fragments/fix_749.yaml new file mode 100644 index 000000000..d01fd54f7 --- /dev/null +++ b/changelogs/fragments/fix_749.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - "nxos_interfaces - Correctly enable L3 interfaces on supported N3K platforms (https://github.com/ansible-collections/cisco.nxos/issues/749)." diff --git a/plugins/module_utils/network/nxos/config/interfaces/interfaces.py b/plugins/module_utils/network/nxos/config/interfaces/interfaces.py index 8bd4f66e7..400f0432f 100644 --- a/plugins/module_utils/network/nxos/config/interfaces/interfaces.py +++ b/plugins/module_utils/network/nxos/config/interfaces/interfaces.py @@ -470,13 +470,13 @@ def render_interface_defaults(self, config, intfs): and enabled/shutdown states. The default values for user-defined-default configurations may be different for legacy platforms. Notes: - - L3 enabled default state is False on N9K,N7K but True for N3K,N6K + - L3 enabled default state is False on N9K,N7K,N3K but True for N5K,N6K - Changing L2-L3 modes may change the default enabled value. - '(no) system default switchport shutdown' only applies to L2 interfaces. Run through the gathered interfaces and tag their default enabled state. """ intf_defs = {} - L3_enabled = True if re.search("N[356]K", self.get_platform()) else False + L3_enabled = True if re.search("N[56]K", self.get_platform()) else False intf_defs = { "sysdefs": { "mode": None, diff --git a/tests/unit/modules/network/nxos/test_nxos_interfaces.py b/tests/unit/modules/network/nxos/test_nxos_interfaces.py index fb8dae234..a1d491af1 100644 --- a/tests/unit/modules/network/nxos/test_nxos_interfaces.py +++ b/tests/unit/modules/network/nxos/test_nxos_interfaces.py @@ -84,7 +84,7 @@ def load_fixtures(self, commands=None, device=""): self.edit_config.return_value = None if device == "legacy": # call execute_module() with device='legacy' to use this codepath - self.get_platform.return_value = "N3K-Cxxx" + self.get_platform.return_value = "N5K-Cxxx" else: self.get_platform.return_value = "N9K-Cxxx"