-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
SUMMARY
cisco.nxos.nxos_static_routes module cannot delete static routes when the next-hop with Vlan interface. This seems to stem from the regex used in the rm_template, which does not recognize Vlan interfaces.
- https://github.com/ansible-collections/cisco.nxos/blob/main/plugins/module_utils/network/nxos/rm_templates/static_routes.py#L53
- https://github.com/ansible-collections/cisco.nxos/blob/main/plugins/module_utils/network/nxos/rm_templates/static_routes.py#L94
ISSUE TYPE
- Bug Report
COMPONENT NAME
nxos_static_routes module
ANSIBLE VERSION
ansible [core 2.18.2]
COLLECTION VERSION
cisco.nxos 10.2.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
Tested only in a mocked unit-test environment.
STEPS TO REPRODUCE
Add the following test case to tests/unit/modules/network/nxos/test_nxos_static_routes:TestNxosStaticRoutesModule and run the tests.
def test_nxos_static_routes_deletedroute_vlan(self):
self.execute_show_command.return_value = dedent(
"""\
ip route 192.0.2.20/28 Vlan274 192.0.2.21 name vlan_route1
ip route 192.0.2.22/28 Vlan275 192.0.2.23 name vlan_route2
ip route 192.0.2.17/28 192.0.2.23 name replaced_route1 3
ip route 192.0.2.17/28 Ethernet1/2 192.0.2.45 vrf destinationVRF name replaced_route2
ip route 192.0.2.79/28 192.0.2.26 tag 12
vrf context Test
ip route 192.0.2.48/28 192.0.2.13
ip route 192.0.2.48/28 192.0.2.14 5
""",
)
set_module_args(
dict(
config=[
{
"address_families": [
{
"afi": "ipv4",
"routes": [
{
"next_hops": [
{
"interface": "Vlan274",
"forward_router_address": "192.0.2.21",
"route_name": "vlan_route1",
},
],
"dest": "192.0.2.20/28",
},
],
},
],
},
],
state="deleted",
),
)
commands = [
"no ip route 192.0.2.20/28 Vlan274 192.0.2.21 name vlan_route1",
]
result = self.execute_module(changed=True)
self.assertEqual(result["commands"], commands)EXPECTED RESULTS
The tests passed.
ACTUAL RESULTS
The following exception raised.
AssertionError: Lists differ: ['no ip route 192.0.2.17/28 192.0.2.23 name replaced_route1 3',[134 chars] 12'] != ['no ip route 192.0.2.20/28 Vlan274 192.0.2.21 name vlan_route1']
First differing element 0:
'no ip route 192.0.2.17/28 192.0.2.23 name replaced_route1 3'
'no ip route 192.0.2.20/28 Vlan274 192.0.2.21 name vlan_route1'
First list contains 2 additional elements.
First extra element 1:
'no ip route 192.0.2.17/28 Ethernet1/2 192.0.2.45 vrf destinationVRF name replaced_route2'
+ ['no ip route 192.0.2.20/28 Vlan274 192.0.2.21 name vlan_route1']
- ['no ip route 192.0.2.17/28 192.0.2.23 name replaced_route1 3',
- 'no ip route 192.0.2.17/28 Ethernet1/2 192.0.2.45 vrf destinationVRF name '
- 'replaced_route2',
- 'no ip route 192.0.2.79/28 192.0.2.26 tag 12']
tests/unit/modules/network/nxos/test_nxos_static_routes.py:1371: AssertionError
The deletion of routes not specified in the module args has been reported in #985.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels