From 1d7e5d054290e082c414d7081b9273f7a7763bfe Mon Sep 17 00:00:00 2001 From: Vito Date: Mon, 15 Jul 2024 10:23:02 +0200 Subject: [PATCH 1/3] Add missing interface names in static_routes parser --- .../module_utils/network/ios/rm_templates/static_routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/network/ios/rm_templates/static_routes.py b/plugins/module_utils/network/ios/rm_templates/static_routes.py index bee1aed63..beab71183 100644 --- a/plugins/module_utils/network/ios/rm_templates/static_routes.py +++ b/plugins/module_utils/network/ios/rm_templates/static_routes.py @@ -37,7 +37,7 @@ def __init__(self, lines=None, module=None): (\svrf\s(?P\S+))? (\s(?P\S+)) (\s(?P\S+)) - (\s(?P(ACR|ATM-ACR|Analysis-Module|AppNav-Compress|AppNav-UnCompress|Async|Auto-Template|BD-VIF|BDI|BVI|Bluetooth|CDMA-Ix|CEM-ACR|CEM-PG|CTunnel|Container|Dialer|EsconPhy|Ethernet-Internal|Fcpa|Filter|Filtergroup|GigabitEthernet|IMA-ACR|LongReachEthernet|Loopback|Lspvif|MFR|Multilink|NVI|Null|PROTECTION_GROUP|Port-channel|Portgroup|Pos-channel|SBC|SDH_ACR|SERIAL-ACR|SONET_ACR|SSLVPN-VIF|SYSCLOCK|Serial-PG|Service-Engine|TLS-VIF|Tunnel|VPN|Vif|Vir-cem-ACR|Virtual-PPP|Virtual-TokenRing)\S+))? + (\s(?P(ACR|ATM-ACR|Analysis-Module|AppNav-Compress|AppNav-UnCompress|Async|Auto-Template|BD-VIF|BDI|BVI|Bluetooth|CDMA-Ix|CEM-ACR|CEM-PG|CTunnel|Container|Dialer|EsconPhy|Ethernet-Internal|FastEthernet|Fcpa|Filter|Filtergroup|FiveGigabitEthernet|FortyGigabitEthernet|GigabitEthernet|HundredGigE|IMA-ACR|LongReachEthernet|Loopback|Lspvif|MFR|Multilink|NVI|Null|PROTECTION_GROUP|Port-channel|Portgroup|Pos-channel|SBC|SDH_ACR|SERIAL-ACR|SONET_ACR|SSLVPN-VIF|SYSCLOCK|Serial|Serial-PG|Service-Engine|TenGigabitEthernet|TLS-VIF|Tunnel|TwentyFiveGigE|TwoGigabitEthernet|VPN|Vif|Vir-cem-ACR|Virtual-PPP|Virtual-TokenRing|Vlan)\S+))? (\s(?P(?!multicast|dhcp|global|tag|track|permanent|name)\S+))? (\s(?P\d+))? (\stag\s(?P\d+))? @@ -93,7 +93,7 @@ def __init__(self, lines=None, module=None): (\stopology\s(?P\S+))? (\svrf\s(?P\S+))? (\s(?P\S+)) - (\s(?P(ACR|ATM-ACR|Analysis-Module|AppNav-Compress|AppNav-UnCompress|Async|Auto-Template|BD-VIF|BDI|BVI|Bluetooth|CDMA-Ix|CEM-ACR|CEM-PG|CTunnel|Container|Dialer|EsconPhy|Ethernet-Internal|Fcpa|Filter|Filtergroup|GigabitEthernet|IMA-ACR|LongReachEthernet|Loopback|Lspvif|MFR|Multilink|NVI|Null|PROTECTION_GROUP|Port-channel|Portgroup|Pos-channel|SBC|SDH_ACR|SERIAL-ACR|SONET_ACR|SSLVPN-VIF|SYSCLOCK|Serial-PG|Service-Engine|TLS-VIF|Tunnel|VPN|Vif|Vir-cem-ACR|Virtual-PPP|Virtual-TokenRing)\S+))? + (\s(?P(ACR|ATM-ACR|Analysis-Module|AppNav-Compress|AppNav-UnCompress|Async|Auto-Template|BD-VIF|BDI|BVI|Bluetooth|CDMA-Ix|CEM-ACR|CEM-PG|CTunnel|Container|Dialer|EsconPhy|Ethernet-Internal|FastEthernet|Fcpa|Filter|Filtergroup|FiveGigabitEthernet|FortyGigabitEthernet|GigabitEthernet|HundredGigE|IMA-ACR|LongReachEthernet|Loopback|Lspvif|MFR|Multilink|NVI|Null|PROTECTION_GROUP|Port-channel|Portgroup|Pos-channel|SBC|SDH_ACR|SERIAL-ACR|SONET_ACR|SSLVPN-VIF|SYSCLOCK|Serial|Serial-PG|Service-Engine|TenGigabitEthernet|TLS-VIF|Tunnel|TwentyFiveGigE|TwoGigabitEthernet|VPN|Vif|Vir-cem-ACR|Virtual-PPP|Virtual-TokenRing|Vlan)\S+))? (\s(?P(?!multicast|unicast|tag|track|permanent|name)\S+))? (\s(?P\d+))? (\s(?Pmulticast))? From c9cf25ba53c6aaeb20c9a98d0a1fdb35f09922b1 Mon Sep 17 00:00:00 2001 From: Vito Date: Mon, 15 Jul 2024 10:34:49 +0200 Subject: [PATCH 2/3] Add changelog & update unit test --- .../static_routes_missing_interface_names.yml | 3 +++ .../unit/modules/network/ios/test_ios_static_routes.py | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/static_routes_missing_interface_names.yml diff --git a/changelogs/fragments/static_routes_missing_interface_names.yml b/changelogs/fragments/static_routes_missing_interface_names.yml new file mode 100644 index 000000000..b141a3941 --- /dev/null +++ b/changelogs/fragments/static_routes_missing_interface_names.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ios_static_routes - Add missing interface names in parser \ No newline at end of file diff --git a/tests/unit/modules/network/ios/test_ios_static_routes.py b/tests/unit/modules/network/ios/test_ios_static_routes.py index 4bb89cc79..34d9f69a7 100644 --- a/tests/unit/modules/network/ios/test_ios_static_routes.py +++ b/tests/unit/modules/network/ios/test_ios_static_routes.py @@ -2138,6 +2138,7 @@ def test_ios_static_route_gathered(self): self.execute_show_command.return_value = dedent( """\ ip route 10.0.0.0 255.0.0.0 Null0 permanent + ip route 10.10.0.0 255.255.0.0 Vlan10 10.0.0.1 ip route 192.168.1.0 255.255.255.0 GigabitEthernet0/1.22 10.0.0.1 tag 30 ip route 192.168.1.0 255.255.255.0 10.0.0.2 ip route 192.168.1.0 255.255.255.248 GigabitEthernet0/1.23 10.0.0.3 tag 30 @@ -2161,6 +2162,15 @@ def test_ios_static_route_gathered(self): }, ], }, + { + "dest": "10.10.0.0/16", + "next_hops": [ + { + "forward_router_address": "10.0.0.1", + "interface": "Vlan10", + }, + ], + }, { "dest": "192.168.1.0/24", "next_hops": [ From 37b3706c0004922da26aa178f7870f32a5ea491f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2024 08:39:14 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- changelogs/fragments/static_routes_missing_interface_names.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/static_routes_missing_interface_names.yml b/changelogs/fragments/static_routes_missing_interface_names.yml index b141a3941..b8586226b 100644 --- a/changelogs/fragments/static_routes_missing_interface_names.yml +++ b/changelogs/fragments/static_routes_missing_interface_names.yml @@ -1,3 +1,3 @@ --- bugfixes: - - ios_static_routes - Add missing interface names in parser \ No newline at end of file + - ios_static_routes - Add missing interface names in parser