From 3915dd5b53a6a9b167c3b5ee5f69932adc83ce31 Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Thu, 9 Jan 2025 15:41:41 -0600 Subject: [PATCH] tests: avoid nondeterministic route Signed-off-by: Jafar Al-Gharaibeh --- .../ospf_metric_propagation/r1/frr.conf | 9 ++++-- .../r1/show_ip_route_static.json | 31 +++---------------- .../ospf_metric_propagation/r4/frr.conf | 5 --- .../test_ospf_metric_propagation.py | 6 ++-- 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/tests/topotests/ospf_metric_propagation/r1/frr.conf b/tests/topotests/ospf_metric_propagation/r1/frr.conf index 082f7df51936..09ae6e8d1872 100644 --- a/tests/topotests/ospf_metric_propagation/r1/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r1/frr.conf @@ -1,6 +1,10 @@ ! hostname r1 ! +vrf green + ip route 10.48.48.0/24 10.0.91.2 +exit +! interface r1-eth0 ip address 10.0.1.1/24 ip ospf cost 100 @@ -61,6 +65,7 @@ router bgp 99 vrf green address-family ipv4 unicast redistribute connected redistribute ospf + redistribute static import vrf route-map rmap import vrf default import vrf blue @@ -75,7 +80,7 @@ ip prefix-list min seq 5 permit 10.0.80.0/24 route-map costmax permit 20 set metric-type type-1 set metric +1 - set metric-min 713 + set min-metric 713 match ip address prefix-list min exit ! @@ -83,7 +88,7 @@ ip prefix-list max seq 10 permit 10.0.70.0/24 route-map costplus permit 30 set metric-type type-1 set metric +1 - set metric-max 13 + set max-metric 13 match ip address prefix-list max exit ! diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route_static.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route_static.json index 628a556c622d..6060e8bd6b13 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route_static.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route_static.json @@ -1,26 +1,5 @@ { "10.48.48.0/24":[ - { - "prefix":"10.48.48.0/24", - "prefixLen":24, - "protocol":"ospf", - "vrfId":0, - "vrfName":"default", - "distance":20, - "metric":134, - "table":254, - "nexthops":[ - { - "flags":3, - "fib":true, - "ip":"10.0.1.2", - "afi":"ipv4", - "interfaceName":"r1-eth0", - "active":true, - "weight":1 - } - ] - }, { "prefix":"10.48.48.0/24", "prefixLen":24, @@ -29,18 +8,18 @@ "vrfName":"default", "selected":true, "destSelected":true, - "distance":20, - "metric":34, + "distance":1, + "metric":1, "installed":true, "table":254, "nexthops":[ { "flags":3, "fib":true, - "ip":"10.0.10.5", + "ip":"10.0.91.2", "afi":"ipv4", - "interfaceName":"r1-eth1", - "vrf":"blue", + "interfaceName":"r1-eth2", + "vrf":"green", "active":true, "weight":1 } diff --git a/tests/topotests/ospf_metric_propagation/r4/frr.conf b/tests/topotests/ospf_metric_propagation/r4/frr.conf index d9832d80b875..b02ae18fc147 100644 --- a/tests/topotests/ospf_metric_propagation/r4/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r4/frr.conf @@ -1,10 +1,6 @@ ! hostname r4 ! -vrf green - ip route 10.48.48.0/24 10.0.94.2 -exit - interface r4-eth0 ip address 10.0.3.4/24 ip ospf cost 100 @@ -63,7 +59,6 @@ router bgp 99 vrf green address-family ipv4 unicast redistribute connected redistribute ospf - redistribute static import vrf route-map rmap import vrf default import vrf blue diff --git a/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py b/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py index 4639a1e26b6e..f574dac4e25e 100644 --- a/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py +++ b/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py @@ -190,8 +190,8 @@ def test_all_links_up(): assert result is None, assertmsg -def test_static_remote(): - "Test static route at R1 configured on R4" +def test_static(): + "Test static route at R1 leaked from VRF green" tgen = get_topogen() if tgen.routers_have_failure(): @@ -201,7 +201,7 @@ def test_static_remote(): json_file = "{}/r1/show_ip_route_static.json".format(CWD) expected = json.loads(open(json_file).read()) test_func = partial( - topotest.router_json_cmp, r1, "show ip route 10.48.48.2 json", expected + topotest.router_json_cmp, r1, "show ip route 10.48.48.0/24 json", expected ) _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)