summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-01-27 23:31:46 +0200
committerGitHub <noreply@github.com>2025-01-27 23:31:46 +0200
commit95db38f394449b6a03b2b9f9e964351eef62e37f (patch)
tree7c45c69a16f3f2a2a04bef1da66c99a8f6cfcb2c
parent9890d3acce8014e0eee6cfa40295b6866c5defb0 (diff)
parente1ab99261a5fa7d6035e55703ef3dab0ba4cdd68 (diff)
Merge pull request #17919 from pguibert6WIND/bgp_suppressed_attribute
Bgp suppressed attribute
-rw-r--r--bgpd/bgp_route.c6
-rw-r--r--tests/topotests/bgp_aggregate_address_topo1/r1/bgp_192_168_0_1.json41
-rw-r--r--tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py19
3 files changed, 66 insertions, 0 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 672c43b37c..a2620a5a4c 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -10951,6 +10951,12 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
else
vty_out(vty, ", (stale)");
}
+ if (bgp_path_suppressed(path)) {
+ if (json_paths)
+ json_object_boolean_true_add(json_path, "suppressed");
+ else
+ vty_out(vty, ", (suppressed)");
+ }
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR))) {
if (json_paths) {
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
index 0000000000..8c0da8dc92
--- /dev/null
+++ b/tests/topotests/bgp_aggregate_address_topo1/r1/bgp_192_168_0_1.json
@@ -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"
+ }
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py
index 370d01e525..a0a1027c98 100644
--- a/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py
+++ b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py
@@ -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()