From 664831e40305eda0903934f09523df231f9e89da Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 18:44:30 -0600 Subject: [PATCH 1/7] Fixing error message. --- .../action/common/prepare_plugins/prep_003_list_defaults.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/action/common/prepare_plugins/prep_003_list_defaults.py b/plugins/action/common/prepare_plugins/prep_003_list_defaults.py index 0ff5ff834..5de2ce80e 100644 --- a/plugins/action/common/prepare_plugins/prep_003_list_defaults.py +++ b/plugins/action/common/prepare_plugins/prep_003_list_defaults.py @@ -206,10 +206,10 @@ def prepare(self): if fabric_type in ['VXLAN_EVPN', 'External', 'eBGP_VXLAN']: fn = self.model_data['vxlan']['fabric']['name'] if not bool(self.model_data['vxlan'].get('underlay')): - msg = "((vxlan.underlay)) data is empty! Check your host_vars model data for fabric {fn}." + msg = f"((vxlan.underlay)) data is empty! Check your host_vars model data for fabric {fn}." display.warning(msg=msg, formatted=True) if not bool(self.model_data['vxlan'].get('global')): - msg = "((vxlan.global)) data is empty! Check your host_vars model data for fabric {fn}." + msg = f"((vxlan.global)) data is empty! Check your host_vars model data for fabric {fn}." display.warning(msg=msg, formatted=True) self.kwargs['results']['model_extended'] = self.model_data From 059eff6c252adb1010fb21c8fa194e5b1c8edc8f Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 20:18:55 -0600 Subject: [PATCH 2/7] Renaming files --- ...logy_vpc_interfaces.py => prep_108_topology_vpc_interfaces.py} | 0 .../{prep_108_vrf_lites.py => prep_109_vrf_lites.py} | 0 .../{prep_109_route_control.py => prep_110_route_control.py} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename plugins/action/common/prepare_plugins/{prep_107_topology_vpc_interfaces.py => prep_108_topology_vpc_interfaces.py} (100%) rename plugins/action/common/prepare_plugins/{prep_108_vrf_lites.py => prep_109_vrf_lites.py} (100%) rename plugins/action/common/prepare_plugins/{prep_109_route_control.py => prep_110_route_control.py} (100%) diff --git a/plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py b/plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py similarity index 100% rename from plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py rename to plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py diff --git a/plugins/action/common/prepare_plugins/prep_108_vrf_lites.py b/plugins/action/common/prepare_plugins/prep_109_vrf_lites.py similarity index 100% rename from plugins/action/common/prepare_plugins/prep_108_vrf_lites.py rename to plugins/action/common/prepare_plugins/prep_109_vrf_lites.py diff --git a/plugins/action/common/prepare_plugins/prep_109_route_control.py b/plugins/action/common/prepare_plugins/prep_110_route_control.py similarity index 100% rename from plugins/action/common/prepare_plugins/prep_109_route_control.py rename to plugins/action/common/prepare_plugins/prep_110_route_control.py From a99d323ba5216edc3ffc4882b6d8d5b304c111b8 Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 20:19:09 -0600 Subject: [PATCH 3/7] Adding function to normalize interface name --- plugins/plugin_utils/helper_functions.py | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/plugins/plugin_utils/helper_functions.py b/plugins/plugin_utils/helper_functions.py index d5a636b07..7d16439bd 100644 --- a/plugins/plugin_utils/helper_functions.py +++ b/plugins/plugin_utils/helper_functions.py @@ -25,6 +25,54 @@ # For example in prepare_serice_model.py we can do the following: # from ..helper_functions import do_something +import re + +def normalize_interface_name(interface_name): + """ + Normalize the interface name to the complete syntaxis: + Ethernet + Port-channel + Loopback + + :Parameters: + :Interface Name (str): Name of the interfaces. + + :Returns: + :interface_name (str): Normalized interface name. + + :Raises: + N/A + """ + # Replace 'eth' or 'e' followed by digits with 'Ethernet' followed by the same digits + interface_name = re.sub( + r"(?i)^(?:e|eth(?:ernet)?)(\d(?:\/\d+){1,2})$", + r"Ethernet\1", + interface_name, + flags=re.IGNORECASE, + ) + # Replace 'Po' followed by digits with 'Port-channel' followed by the same digits + interface_name = re.sub( + r"(?i)^(po|port-channel)([1-9]|[1-9][0-9]{1,3}|[1-3][0-9]{3}|40([0-8][0-9]|9[0-6]))$", + r"Port-channel\2", + interface_name, + flags=re.IGNORECASE, + ) + # Replace 'eth' or 'e' followed by digits with 'Ethernet' followed by the same digits (for sub interface) + interface_name = re.sub( + r"(?i)^(?:e|eth(?:ernet)?)(\d(?:\/\d+){1,2}\.\d{1,4})$", + r"Ethernet\1", + interface_name, + flags=re.IGNORECASE, + ) + # Replace 'Lo' or 'Loopback' followed by digits with 'Loopback' followed by the same digits + interface_name = re.sub( + r"(?i)^(lo|loopback)([0-9]|[1-9][0-9]{1,2}|10[0-1][0-9]|102[0-3])$", + r"Loopback\2", + interface_name, + flags=re.IGNORECASE, + ) + return interface_name + def data_model_key_check(tested_object, keys): """ From bd16702a02f2022086d861ea38faff493f41440f Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 20:19:28 -0600 Subject: [PATCH 4/7] Adding plugin to review interface MTU --- .../prep_107_topology_interfaces_mtu.py | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py diff --git a/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py new file mode 100644 index 000000000..b51340266 --- /dev/null +++ b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py @@ -0,0 +1,171 @@ +# Copyright (c) 2025 Cisco Systems, Inc. and its affiliates +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# SPDX-License-Identifier: MIT + + +# Convert schema values of L2 MTU interfaces to the required format ('default' or 'jumbo') + +from ansible_collections.cisco.nac_dc_vxlan.plugins.plugin_utils.helper_functions import data_model_key_check +from ansible_collections.cisco.nac_dc_vxlan.plugins.plugin_utils.helper_functions import normalize_interface_name + +class PreparePlugin: + def __init__(self, **kwargs): + self.kwargs = kwargs + self.keys = [] + + def get_parent_interface_name_mtu(self, sub_interface_name, switch_interfaces, default_routed_int_mtu, default_port_channel_mtu): + parent_interface_name = normalize_interface_name(sub_interface_name).split('.')[0] + parent_interface_mtu = 0 + for interface in switch_interfaces: + if parent_interface_name == normalize_interface_name(interface.get('name')): + if interface.get('mtu'): + parent_interface_mtu = interface.get('mtu') + break + if not parent_interface_mtu: + if 'Port-channel' in parent_interface_name: + parent_interface_mtu = default_port_channel_mtu + else: + parent_interface_mtu = default_routed_int_mtu + return parent_interface_name, parent_interface_mtu + + # layer2_host_interface_mtu must be an even int + def standarize_global_l2_mtu(self, mtu): + n = None + match mtu: + case 'default': + return 1500 + case int(n) if n % 2 == 0: + return mtu + case _: + self.kwargs['results']['failed'] = True + self.kwargs['results']['msg'] = f'vxlan.underlay.general.layer2_host_interface_mtu is not a valid value ({mtu}). MTU cannot be an odd number.' + + # Validate that the interfaces mtu is correct, either 1500 or the value of layer2_host_interface_mtu (sysmtem jumbomtu) + def standarize_l2_mtu(self, switch_name, interface, system_mtu): + n = None + interface_mtu = interface.get('mtu') + interface_name = normalize_interface_name(interface.get('name')) + match interface_mtu: + case 1500: + return 'default' + case int(n) if n == system_mtu: + return 'jumbo' + case str(n) if n == 'jumbo' or n == 'default': + return interface_mtu + case _: + self.kwargs['results']['failed'] = True + # Adding space if previous errors exist if not initialize str + if self.kwargs['results']['msg']: + self.kwargs['results']['msg'] += ' ' + else: + self.kwargs['results']['msg'] = '' + + self.kwargs['results']['msg'] += f'vxlan.topology.switches.{switch_name}.interfaces.{interface_name}.mtu ({interface_mtu}) is not a valid \ +value. MTU must be 1500 or {system_mtu}.' + return None + + + def prepare(self): + model_data = self.kwargs['results']['model_extended'] + l2_jumbomtu = self.kwargs['default_values']['vxlan']['underlay']['general']['layer2_host_interface_mtu'] + default_sub_interface_mtu = self.kwargs['default_values']['vxlan']['topology']['switches']['interfaces']['topology_switch_routed_sub_interface']['mtu'] + default_routed_int_mtu = self.kwargs['default_values']['vxlan']['topology']['switches']['interfaces']['topology_switch_routed_interface']['mtu'] + default_port_channel_mtu = self.kwargs['default_values']['vxlan']['topology']['switches']['interfaces']['topology_switch_routed_po_interface']['mtu'] + + dm_check = data_model_key_check(model_data, ['vxlan', 'underlay', 'general']) + + # Check if vxlan.underlay.general is defined + if 'general' in dm_check['keys_data']: + if 'layer2_host_interface_mtu' in model_data['vxlan']['underlay']['general']: + l2_host_interface_mtu = model_data['vxlan']['underlay']['general']['layer2_host_interface_mtu'] + l2_host_interface_mtu_standardized = self.standarize_global_l2_mtu(l2_host_interface_mtu) + model_data['vxlan']['underlay']['general']['layer2_host_interface_mtu'] = l2_host_interface_mtu_standardized + l2_jumbomtu = l2_host_interface_mtu_standardized + + if 'intra_fabric_interface_mtu' in model_data['vxlan']['underlay']['general']: + intra_fabric_interface_mtu = model_data['vxlan']['underlay']['general']['intra_fabric_interface_mtu'] + # intra_fabric_interface_mtu must be an even int + if intra_fabric_interface_mtu % 2 != 0: + self.kwargs['results']['failed'] = True + + # Adding space if previous errors exist if not initialize str + if self.kwargs['results']['msg']: + self.kwargs['results']['msg'] += ' ' + else: + self.kwargs['results']['msg'] = '' + + self.kwargs['results']['msg'] += f'vxlan.underlay.general.intra_fabric_interface_mtu is not a valid value \ +({intra_fabric_interface_mtu}). MTU cannot be an odd number.' + + dm_check = data_model_key_check(model_data, ['vxlan', 'topology', 'switches']) + print(dm_check) + # Check if vxlan.topology is defined + if 'switches' in dm_check['keys_data']: + for switch_index, switch in enumerate(model_data.get('vxlan').get('topology').get('switches')): + + switch_name = switch.get('name') + + # loop through interfaces + for interface_index, interface in enumerate(switch.get('interfaces')): + interface_mode = interface.get('mode') + interface_name = normalize_interface_name(interface.get('name')) + + # L2 interfaces + if interface_mode in ['access', 'trunk', 'dot1q']: + if interface.get('mtu'): + interface_mtu = self.standarize_l2_mtu(switch_name, interface, l2_jumbomtu) + model_data['vxlan']['topology']['switches'][switch_index]['interfaces'][interface_index]['mtu'] = interface_mtu + + # L3 interfaces + if interface_mode in ['routed', 'routed_po', 'routed_sub']: + if interface.get('mtu'): + interface_mtu = interface.get('mtu') + # MTU must be an even number + if interface_mtu % 2 != 0: + self.kwargs['results']['failed'] = True + # Adding space if previous errors exist if not initialize str + if self.kwargs['results']['msg']: + self.kwargs['results']['msg'] += ' ' + else: + self.kwargs['results']['msg'] = '' + + self.kwargs['results']['msg'] += f'vxlan.topology.switches.{switch_name}.interfaces.{interface_name} is not a valid value \ +({interface_mtu}). MTU cannot be an odd number.' + + # Sub interfaces + if interface_mode == 'routed_sub': + parent_interface_name, parent_interface_mtu = self.get_parent_interface_name_mtu(interface_name, switch.get('interfaces'), + default_routed_int_mtu, + default_port_channel_mtu) + sub_interface_mtu = interface.get('mtu') if interface.get('mtu') else default_sub_interface_mtu + if parent_interface_mtu < sub_interface_mtu: + self.kwargs['results']['failed'] = True + # Adding space if previous errors exist if not initialize str + if self.kwargs['results']['msg']: + self.kwargs['results']['msg'] += ' ' + else: + self.kwargs['results']['msg'] = '' + + self.kwargs['results']['msg'] += f'vxlan.topology.switches.{switch_name}.interfaces.\ +{normalize_interface_name(interface_name)}.mtu is not a valid value. {normalize_interface_name(interface_name)} MTU ({sub_interface_mtu}) \ +cannot be greater than {parent_interface_name} MTU ({parent_interface_mtu}).' + + self.kwargs['results']['model_extended'] = model_data + return self.kwargs['results'] From 0f53099b73f5ec00e9db0359d5aeb1c686b89fec Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 20:28:08 -0600 Subject: [PATCH 5/7] Adding new plugin file --- tests/sanity/ignore-2.14.txt | 7 ++++--- tests/sanity/ignore-2.15.txt | 7 ++++--- tests/sanity/ignore-2.16.txt | 7 ++++--- tests/sanity/ignore-2.17.txt | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index 95b13a92e..cd002a272 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -6,9 +6,10 @@ plugins/action/common/prepare_plugins/prep_003_list_defaults.py action-plugin-do plugins/action/common/prepare_plugins/prep_104_topology_switches.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_105_fabric_overlay.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_106_topology_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_108_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_109_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_109_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_110_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_118_topology_edge_connections.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_999_verify.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_service_model.py action-plugin-docs # action plugin has no matching module to provide documentation diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index 95b13a92e..cd002a272 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -6,9 +6,10 @@ plugins/action/common/prepare_plugins/prep_003_list_defaults.py action-plugin-do plugins/action/common/prepare_plugins/prep_104_topology_switches.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_105_fabric_overlay.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_106_topology_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_108_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_109_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_109_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_110_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_118_topology_edge_connections.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_999_verify.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_service_model.py action-plugin-docs # action plugin has no matching module to provide documentation diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index 95b13a92e..cd002a272 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -6,9 +6,10 @@ plugins/action/common/prepare_plugins/prep_003_list_defaults.py action-plugin-do plugins/action/common/prepare_plugins/prep_104_topology_switches.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_105_fabric_overlay.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_106_topology_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_108_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_109_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_109_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_110_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_118_topology_edge_connections.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_999_verify.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_service_model.py action-plugin-docs # action plugin has no matching module to provide documentation diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index 95b13a92e..cd002a272 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -6,9 +6,10 @@ plugins/action/common/prepare_plugins/prep_003_list_defaults.py action-plugin-do plugins/action/common/prepare_plugins/prep_104_topology_switches.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_105_fabric_overlay.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_106_topology_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_107_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_108_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation -plugins/action/common/prepare_plugins/prep_109_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_108_topology_vpc_interfaces.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_109_vrf_lites.py action-plugin-docs # action plugin has no matching module to provide documentation +plugins/action/common/prepare_plugins/prep_110_route_control.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_118_topology_edge_connections.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_plugins/prep_999_verify.py action-plugin-docs # action plugin has no matching module to provide documentation plugins/action/common/prepare_service_model.py action-plugin-docs # action plugin has no matching module to provide documentation From 6c4a1037940bb83c0a2852303fb3c161f76fcdcb Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Tue, 9 Sep 2025 20:45:40 -0600 Subject: [PATCH 6/7] Fixing PEP8 Issues --- .../prepare_plugins/prep_107_topology_interfaces_mtu.py | 6 +++--- plugins/plugin_utils/helper_functions.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py index b51340266..10d2ef605 100644 --- a/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py +++ b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py @@ -25,6 +25,7 @@ from ansible_collections.cisco.nac_dc_vxlan.plugins.plugin_utils.helper_functions import data_model_key_check from ansible_collections.cisco.nac_dc_vxlan.plugins.plugin_utils.helper_functions import normalize_interface_name + class PreparePlugin: def __init__(self, **kwargs): self.kwargs = kwargs @@ -81,7 +82,6 @@ def standarize_l2_mtu(self, switch_name, interface, system_mtu): value. MTU must be 1500 or {system_mtu}.' return None - def prepare(self): model_data = self.kwargs['results']['model_extended'] l2_jumbomtu = self.kwargs['default_values']['vxlan']['underlay']['general']['layer2_host_interface_mtu'] @@ -152,8 +152,8 @@ def prepare(self): # Sub interfaces if interface_mode == 'routed_sub': parent_interface_name, parent_interface_mtu = self.get_parent_interface_name_mtu(interface_name, switch.get('interfaces'), - default_routed_int_mtu, - default_port_channel_mtu) + default_routed_int_mtu, + default_port_channel_mtu) sub_interface_mtu = interface.get('mtu') if interface.get('mtu') else default_sub_interface_mtu if parent_interface_mtu < sub_interface_mtu: self.kwargs['results']['failed'] = True diff --git a/plugins/plugin_utils/helper_functions.py b/plugins/plugin_utils/helper_functions.py index 7d16439bd..207c9a928 100644 --- a/plugins/plugin_utils/helper_functions.py +++ b/plugins/plugin_utils/helper_functions.py @@ -27,6 +27,7 @@ import re + def normalize_interface_name(interface_name): """ Normalize the interface name to the complete syntaxis: From dad1ac173388e530ee5ac6e7da0fca6c2b348d2e Mon Sep 17 00:00:00 2001 From: "J. Andres Rocha Bravo" Date: Wed, 24 Sep 2025 09:00:35 -0600 Subject: [PATCH 7/7] remove print --- .../common/prepare_plugins/prep_107_topology_interfaces_mtu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py index 10d2ef605..5259042f2 100644 --- a/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py +++ b/plugins/action/common/prepare_plugins/prep_107_topology_interfaces_mtu.py @@ -115,7 +115,7 @@ def prepare(self): ({intra_fabric_interface_mtu}). MTU cannot be an odd number.' dm_check = data_model_key_check(model_data, ['vxlan', 'topology', 'switches']) - print(dm_check) + # Check if vxlan.topology is defined if 'switches' in dm_check['keys_data']: for switch_index, switch in enumerate(model_data.get('vxlan').get('topology').get('switches')):