mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-13 23:32:58 +00:00
tests: Check if set metric aigp
works
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
e94f48498d
commit
3105ceaee9
@ -16,6 +16,13 @@ router bgp 65001
|
|||||||
neighbor 192.168.18.8 route-map r8 out
|
neighbor 192.168.18.8 route-map r8 out
|
||||||
exit-address-family
|
exit-address-family
|
||||||
!
|
!
|
||||||
|
ip prefix-list p71 seq 5 permit 10.0.0.71/32
|
||||||
|
ip prefix-list p72 seq 5 permit 10.0.0.72/32
|
||||||
|
!
|
||||||
route-map r8 permit 10
|
route-map r8 permit 10
|
||||||
|
match ip address prefix-list p71
|
||||||
set metric igp
|
set metric igp
|
||||||
|
route-map r8 permit 20
|
||||||
|
match ip address prefix-list p72
|
||||||
|
set metric aigp
|
||||||
exit
|
exit
|
||||||
|
@ -17,6 +17,8 @@ and 10 appropriately.
|
|||||||
r1 receives routes with aigp-metric TLV 81, 91 and 82, 92 respectively.
|
r1 receives routes with aigp-metric TLV 81, 91 and 82, 92 respectively.
|
||||||
|
|
||||||
r1 advertises MED from IGP protocol (set metric igp) to r8.
|
r1 advertises MED from IGP protocol (set metric igp) to r8.
|
||||||
|
|
||||||
|
r1 advertises MED from AIGP (set metric aigp) to r8.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -150,9 +152,16 @@ def test_bgp_aigp():
|
|||||||
expected = {"paths": [{"aigpMetric": aigp, "valid": True}]}
|
expected = {"paths": [{"aigpMetric": aigp, "valid": True}]}
|
||||||
return topotest.json_cmp(output, expected)
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
def _bgp_check_received_med(med):
|
def _bgp_check_received_med():
|
||||||
output = json.loads(r8.vtysh_cmd("show bgp ipv4 unicast 10.0.0.71/32 json"))
|
output = json.loads(
|
||||||
expected = {"paths": [{"metric": med, "valid": True}]}
|
r8.vtysh_cmd("show bgp ipv4 unicast 10.0.0.64/28 longer-prefixes json")
|
||||||
|
)
|
||||||
|
expected = {
|
||||||
|
"routes": {
|
||||||
|
"10.0.0.71/32": [{"valid": True, "metric": 20}],
|
||||||
|
"10.0.0.72/32": [{"valid": True, "metric": 112}],
|
||||||
|
}
|
||||||
|
}
|
||||||
return topotest.json_cmp(output, expected)
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
def _bgp_check_aigp_metric_bestpath():
|
def _bgp_check_aigp_metric_bestpath():
|
||||||
@ -264,23 +273,12 @@ def test_bgp_aigp():
|
|||||||
_, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
|
_, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
|
||||||
assert result is None, "AIGP attribute is not considered in best-path selection"
|
assert result is None, "AIGP attribute is not considered in best-path selection"
|
||||||
|
|
||||||
# r8, check if MED is set to 20 (derived from `set metric igp`)
|
# r8, check if MED is set derived from `set metric igp`, and `set metric aigp`
|
||||||
test_func = functools.partial(_bgp_check_received_med, 20)
|
test_func = functools.partial(_bgp_check_received_med)
|
||||||
_, 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, "MED attribute value is not 20"
|
assert (
|
||||||
|
result is None
|
||||||
r1.vtysh_cmd(
|
), "MED attribute values are not derived from `set metric [a]igp`"
|
||||||
"""
|
|
||||||
configure terminal
|
|
||||||
route-map r8 permit 10
|
|
||||||
set metric aigp
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
# r8, check if MED is set to 111 (derived from `set metric aigp`)
|
|
||||||
test_func = functools.partial(_bgp_check_received_med, 111)
|
|
||||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
|
||||||
assert result is None, "MED attribute value is not 111"
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user