mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
Merge pull request #12841 from opensourcerouting/topofix_bgp_gr_retain_routes
tests: Change bgp_gr_retained_routes to use json output of "ip route"
This commit is contained in:
commit
19d5895827
@ -83,18 +83,9 @@ def test_bgp_gr_restart_retain_routes():
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
def _bgp_check_kernel_retained_routes():
|
||||
output = (
|
||||
r2.cmd("ip route show 172.16.255.1/32 proto bgp dev r2-eth0")
|
||||
.replace("\n", "")
|
||||
.rstrip()
|
||||
)
|
||||
expected = "172.16.255.1 via 192.168.255.1 metric 20"
|
||||
diff = topotest.get_textdiff(
|
||||
output, expected, "Actual IP Routing Table", "Expected IP RoutingTable"
|
||||
)
|
||||
if diff:
|
||||
return False
|
||||
return True
|
||||
output = json.loads(r2.cmd("ip -j route show 172.16.255.1/32 proto bgp dev r2-eth0"))
|
||||
expected = [{"dst":"172.16.255.1","gateway":"192.168.255.1","metric":20}]
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
step("Initial BGP converge")
|
||||
test_func = functools.partial(_bgp_converge)
|
||||
@ -110,7 +101,7 @@ def test_bgp_gr_restart_retain_routes():
|
||||
assert result is None, "Failed to see BGP retained routes on R2"
|
||||
|
||||
step("Check if routes (Kernel) are retained at R2")
|
||||
assert _bgp_check_kernel_retained_routes() == True
|
||||
assert _bgp_check_kernel_retained_routes() is None, "Failed to retain BGP routes in kernel on R2"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user