]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: add a test case for static route propagation 17671/head
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 18 Dec 2024 18:11:20 +0000 (12:11 -0600)
committerJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 18 Dec 2024 18:16:15 +0000 (12:16 -0600)
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
tests/topotests/ospf_metric_propagation/r1/show_ip_route_static.json [new file with mode: 0644]
tests/topotests/ospf_metric_propagation/r4/frr.conf
tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py

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
new file mode 100644 (file)
index 0000000..628a556
--- /dev/null
@@ -0,0 +1,50 @@
+{
+  "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,
+      "protocol":"bgp",
+      "vrfId":0,
+      "vrfName":"default",
+      "selected":true,
+      "destSelected":true,
+      "distance":20,
+      "metric":34,
+      "installed":true,
+      "table":254,
+      "nexthops":[
+        {
+          "flags":3,
+          "fib":true,
+          "ip":"10.0.10.5",
+          "afi":"ipv4",
+          "interfaceName":"r1-eth1",
+          "vrf":"blue",
+          "active":true,
+          "weight":1
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
index b02ae18fc1476be8aab6203e9414163926669090..d9832d80b875470d5d1d34ec48cca0a8240e35b7 100644 (file)
@@ -1,6 +1,10 @@
 !
 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
@@ -59,6 +63,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
index b97b86bff9a3e4f6e59f750dab8d5f4de702485e..4639a1e26b6e770ad12e9c2a2cb219d6778886be 100644 (file)
@@ -190,6 +190,25 @@ def test_all_links_up():
     assert result is None, assertmsg
 
 
+def test_static_remote():
+    "Test static route at R1 configured on R4"
+    tgen = get_topogen()
+
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    r1 = tgen.gears["r1"]
+    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
+    )
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+
+    assertmsg = "r1 JSON output mismatches"
+    assert result is None, assertmsg
+
+
 def test_link_1_down():
     "Test path R1 -> R2 -> Ra -> Rb -> R4"
     tgen = get_topogen()