Skip to content

Commit

Permalink
tests: zebra_rib, test vrf change
Browse files Browse the repository at this point in the history
Test table ID move to a VRF and the removal of the VRF.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Oct 9, 2024
1 parent 6193674 commit c8e6bac
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/topotests/zebra_rib/r1/v4_route_table_1_no_vrf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@
]
}
],
"10.0.0.0/24": [
{
"protocol": "static",
"vrfName": "default",
"installed": true,
"table": 1,
"nexthops": [
{
"fib": true,
"unreachable": true,
"blackhole": true,
"active": true
}
]
}
],
"10.1.0.0/24": [
{
"protocol": "static",
"vrfName": "default",
"installed": true,
"table": 1,
"nexthops": [
{
"fib": true,
"ip": "192.168.211.254",
"interfaceName": "r1-eth1",
"active": true
}
]
}
],
"10.2.0.0/24": null,
"10.3.0.0/24": null,
"192.168.210.0/24": null,
Expand Down
2 changes: 2 additions & 0 deletions tests/topotests/zebra_rib/r1/v4_route_table_1_no_vrf.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
blackhole default
blackhole 10.0.0.0/24 proto XXXX metric 20
10.1.0.0/24 via 192.168.211.254 dev r1-eth1 proto XXXX metric 20
33 changes: 33 additions & 0 deletions tests/topotests/zebra_rib/r1/v4_route_table_1_vrf_red.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,39 @@
]
}
],
"10.0.0.0/24": [
{
"protocol": "static",
"vrfName": "RED",
"installed": true,
"table": 1,
"nexthops": [
{
"fib": true,
"unreachable": true,
"blackhole": true,
"active": true
}
]
}
],
"10.1.0.0/24": [
{
"protocol": "static",
"vrfName": "RED",
"installed": true,
"table": 1,
"nexthops": [
{
"fib": true,
"ip": "192.168.211.254",
"interfaceName": "r1-eth1",
"vrf": "default",
"active": true
}
]
}
],
"10.2.0.0/24": [
{
"protocol": "static",
Expand Down
2 changes: 2 additions & 0 deletions tests/topotests/zebra_rib/r1/v4_route_table_1_vrf_red.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
blackhole default
blackhole 10.0.0.0/24 proto XXXX metric 20
10.1.0.0/24 via 192.168.211.254 dev r1-eth1 proto XXXX metric 20
10.2.0.0/24 via 192.168.210.254 dev r1-eth0 proto XXXX metric 20
10.3.0.0/24 via 192.168.212.254 dev r1-eth2 proto XXXX metric 20
192.168.210.0/24 dev r1-eth0 proto XXXX scope link src 192.168.210.1
10 changes: 10 additions & 0 deletions tests/topotests/zebra_rib/test_zebra_rib.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ def test_zebra_kernel_route_vrf():
step("Add routes in table 1")
r1.run("ip route add blackhole default table {}".format(table_id))

r1.vtysh_cmd(
"""
configure terminal
ip route 10.0.0.0/24 blackhole table {}
ip route 10.1.0.0/24 192.168.211.254 nexthop-vrf default table {}
""".format(
table_id, table_id
)
)

json_file = "{}/r1/v4_route_table_1_no_vrf.json".format(CWD)
expected = json.loads(open(json_file).read())
test_func = partial(
Expand Down

0 comments on commit c8e6bac

Please sign in to comment.