]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: bgp_aggregate_address_topo1, add test for suppressed keyword
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 24 Jan 2025 12:38:21 +0000 (13:38 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 27 Jan 2025 10:47:41 +0000 (11:47 +0100)
Add a test that checks that the BGP route to 192.168.0.1 has all the
necessary json outputs. This route is chosen because it is a suppressed
route.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
tests/topotests/bgp_aggregate_address_topo1/r1/bgp_192_168_0_1.json [new file with mode: 0644]
tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py

diff --git a/tests/topotests/bgp_aggregate_address_topo1/r1/bgp_192_168_0_1.json b/tests/topotests/bgp_aggregate_address_topo1/r1/bgp_192_168_0_1.json
new file mode 100644 (file)
index 0000000..8c0da8d
--- /dev/null
@@ -0,0 +1,41 @@
+{
+  "prefix":"192.168.0.1/32",
+  "paths":[
+    {
+      "aspath":{
+        "string":"65001",
+        "segments":[
+          {
+            "type":"as-sequence",
+            "list":[
+              65001
+            ]
+          }
+        ],
+        "length":1
+      },
+      "suppressed":true,
+      "origin":"IGP",
+      "metric":10,
+      "valid":true,
+      "bestpath":{
+        "overall":true,
+        "selectionReason":"First path received"
+      },
+      "nexthops":[
+        {
+          "ip":"10.0.0.2",
+          "afi":"ipv4",
+          "metric":0,
+          "accessible":true,
+          "used":true
+        }
+      ],
+      "peer":{
+        "peerId":"10.0.0.2",
+        "routerId":"10.254.254.3",
+        "type":"external"
+      }
+    }
+  ]
+}
index 370d01e52598604a8d99de6740f3df20440a453d..a0a1027c98265bd2ad347b547a86395e2ece8d91 100644 (file)
@@ -13,6 +13,7 @@
 Test BGP aggregate address features.
 """
 
+import json
 import os
 import sys
 import pytest
@@ -265,6 +266,24 @@ match ip address acl-sup-three
     )
 
 
+def test_check_bgp_attribute():
+    "Dump the suppressed attribute of the 192.168.0.1/32 prefix in r1."
+    tgen = get_topogen()
+
+    logger.info("Test that the BGP path to 192.168.0.1 is as expected.")
+    expected = json.loads(open("{}/r1/bgp_192_168_0_1.json".format(CWD)).read())
+
+    test_func = functools.partial(
+        topotest.router_json_cmp,
+        tgen.gears["r1"],
+        "show bgp ipv4 192.168.0.1/32 json",
+        expected,
+    )
+    _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+    assertmsg = '"r1" BGP 192.168.0.1 route output failed'
+    assert result is None, assertmsg
+
+
 def test_memory_leak():
     "Run the memory leak test and report results."
     tgen = get_topogen()