Skip to content

Commit

Permalink
Add changelog & extend unit test for parsing facts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vito committed May 20, 2024
1 parent 7e03630 commit de56071
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/static_routes_facts_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ios_static_routes - Fix gathering facts by properly distinguising routes.
55 changes: 53 additions & 2 deletions tests/unit/modules/network/ios/test_ios_static_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,11 @@ 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 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
ipv6 route 2001:DB8:0:3::/128 2001:DB8:0:3::33
ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::3
""",
)
set_module_args(dict(state="gathered"))
Expand All @@ -2150,16 +2155,62 @@ def test_ios_static_route_gathered(self):
{
"dest": "10.0.0.0/8",
"next_hops": [
{"interface": "Null0", "permanent": True},
{
"interface": "Null0",
"permanent": True
},
],
},
{
"dest": "192.168.1.0/24",
"next_hops": [
{
"forward_router_address": "10.0.0.1",
"interface": "GigabitEthernet0/1.22",
"tag": 30
},
{
"forward_router_address": "10.0.0.2"
}
]
},
{
"dest": "192.168.1.0/29",
"next_hops": [
{
"forward_router_address": "10.0.0.3",
"interface": "GigabitEthernet0/1.23",
"tag": 30
}
]
}
],
},
{
"afi": "ipv6",
"routes": [
{
"dest": "2001:DB8:0:3::/128",
"next_hops": [
{
"forward_router_address": "2001:DB8:0:3::33"
}
]
},
{
"dest": "2001:DB8:0:3::/64",
"next_hops": [
{
"forward_router_address": "2001:DB8:0:3::3"
}
]
},
]
}
],
},
]
result = self.execute_module(changed=False)
self.maxDiff = None
print(result["gathered"])
self.assertEqual(sorted(result["gathered"]), sorted(gathered))
# self.assertEqual(result["gathered"], gathered)

0 comments on commit de56071

Please sign in to comment.