Skip to content

Commit

Permalink
Merge pull request FRRouting#14151 from opensourcerouting/fix/improve…
Browse files Browse the repository at this point in the history
…_addpath_selected_test

tests: Improve bgp_addpath_best_selected topotest
  • Loading branch information
donaldsharp authored Aug 6, 2023
2 parents 4735bad + 0ba5225 commit 5292039
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
1 change: 0 additions & 1 deletion tests/topotests/bgp_addpath_best_selected/r2/bgpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ router bgp 65002
timers bgp 3 10
no bgp ebgp-requires-policy
neighbor 192.168.1.1 remote-as external
neighbor 192.168.1.1 remote-as external
neighbor 192.168.7.7 remote-as external
neighbor 192.168.7.7 timers connect 5
neighbor 192.168.2.3 remote-as external
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,42 @@ def test_bgp_addpath_best_selected():

r2 = tgen.gears["r2"]

def _bgp_converge():
output = json.loads(r2.vtysh_cmd("show bgp ipv4 unicast 172.16.16.254/32 json"))
expected = {
"paths": [
{
"aspath": {
"string": "65006",
},
"weight": 6,
},
{
"aspath": {
"string": "65005",
},
"weight": 5,
},
{
"aspath": {
"string": "65004",
},
"weight": 4,
},
{
"aspath": {
"string": "65003",
},
"weight": 3,
},
]
}
return topotest.json_cmp(output, expected)

test_func = functools.partial(_bgp_converge)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, "Can't converge initially"

def check_bgp_advertised_routes_to_r1():
output = json.loads(
r2.vtysh_cmd(
Expand Down Expand Up @@ -104,7 +140,7 @@ def check_bgp_advertised_routes_to_r1():
return topotest.json_cmp(output, expected)

test_func = functools.partial(check_bgp_advertised_routes_to_r1)
success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
), "Received more/less Add-Path best paths, but should be only 1+1 (real best path)"
Expand Down Expand Up @@ -143,7 +179,7 @@ def check_bgp_advertised_routes_to_r7():
return topotest.json_cmp(output, expected)

test_func = functools.partial(check_bgp_advertised_routes_to_r7)
success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
), "Received more/less Add-Path best paths, but should be only 2+1 (real best path)"
Expand Down

0 comments on commit 5292039

Please sign in to comment.