Skip to content

Commit

Permalink
tests: add a new topotest to bgp_aigp
Browse files Browse the repository at this point in the history
Add a new topotest for getting the aigp from the "igp-metric"
for a redistributed route (ospf route in the test).

Signed-off-by: Enke Chen <[email protected]>
  • Loading branch information
enkechen-panw committed Oct 16, 2024
1 parent f65356d commit 5161259
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/topotests/bgp_aigp/r4/bgpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ router bgp 65001
neighbor 10.0.0.6 update-source lo
address-family ipv4
redistribute connected route-map connected-to-bgp
redistribute ospf route-map ospf-to-bgp
neighbor 192.168.24.2 route-map set-nexthop out
exit-address-family
!
ip prefix-list p66 seq 5 permit 10.0.6.6/32
!
route-map ospf-to-bgp permit 10
match ip address prefix-list p66
set aigp igp-metric
!
! Two OSPF domains should be isolated - otherwise the connected routes
! on r4 would be advertised to r3 (via r4 -> r6 -> r5 -> r3), and can
! mess up bgp bestpath calculation (igp metrics for the BGP nexthops).
Expand Down
1 change: 1 addition & 0 deletions tests/topotests/bgp_aigp/r6/zebra.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!
interface lo
ip address 10.0.0.6/32
ip address 10.0.6.6/32
!
interface r6-eth0
ip address 192.168.46.6/24
Expand Down
5 changes: 5 additions & 0 deletions tests/topotests/bgp_aigp/test_bgp_aigp.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ def _bgp_check_aigp_metric_bestpath():
"""
)

# r4, 10.0.6.6/32 with aigp-metric 20
test_func = functools.partial(_bgp_check_aigp_metric, r4, "10.0.6.6/32", 20)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
assert result is None, "aigp-metric for 10.0.6.6/32 is not 20"

# r4, 10.0.0.71/32 with aigp-metric 71
test_func = functools.partial(_bgp_check_aigp_metric, r4, "10.0.0.71/32", 71)
_, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
Expand Down

0 comments on commit 5161259

Please sign in to comment.