]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: bgp_bmp, expose peer_distinguisher in loc-rib
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 30 Oct 2024 20:30:44 +0000 (21:30 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 11 Dec 2024 10:29:37 +0000 (11:29 +0100)
The BMP implementation currently only supports global and
loc-rib instance types. When loc-rib is selected, the
peer_distinguisher is set to the route distinguisher of
the L3VRF where the BGP instance is. This functionality has
not been tested until now, because the peer distinguisher
value had been explicitly omitted in the bmp messages.

Expose the peer distinguisher value in all BMP messages
received. This change requires to modify the expected output
for loc-rib when the BGP instance is in a L3VRF.

The handling of peer distinguisher value for RD instances
will follow in the next commits.

Link: https://www.rfc-editor.org/rfc/rfc7854.html#section-4.2
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
tests/topotests/bgp_bmp/bgpbmp.py
tests/topotests/bgp_bmp/bmp1vrf/bmp-update-loc-rib-step1.json
tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-loc-rib-step1.json
tests/topotests/bgp_bmp/r1vrf/frr.conf

index 5e8b0d9be72df746d6cce1d4134f5b9b669bff28..0a0a845b3ab3be7b607b0f22bdd9e05be1543a82 100644 (file)
@@ -164,18 +164,6 @@ def bmp_check_for_prefixes(
                 for k, v in sorted(m.items())
                 # filter out variable keys
                 if k not in ["timestamp", "seq", "nxhp_link-local"]
-                and (
-                    # When policy is loc-rib, the peer-distinguisher is 0:0
-                    # for the default VRF or the RD if any or the 0:<vrf_id>.
-                    # 0:<vrf_id> is used to distinguished. RFC7854 says: "If the
-                    # peer is a "Local Instance Peer", it is set to a unique,
-                    # locally defined value." The value is not tested because it
-                    # is variable.
-                    k != "peer_distinguisher"
-                    or policy != loc_rib
-                    or v == "0:0"
-                    or not v.startswith("0:")
-                )
             }
 
     # build expected JSON files
index ba31bf1d5df757ac8db1ed60a8111b299f1a9a57..d6c87dd4fdaa96ed01feb9e841faba9c8fe789c9 100644 (file)
@@ -10,6 +10,7 @@
                 "origin": "IGP",
                 "peer_asn": 65501,
                 "peer_bgp_id": "192.168.0.1",
+                "peer_distinguisher": "444:1",
                 "peer_type": "loc-rib instance",
                 "policy": "loc-rib"
             },
@@ -23,6 +24,7 @@
                 "origin": "IGP",
                 "peer_asn": 65501,
                 "peer_bgp_id": "192.168.0.1",
+                "peer_distinguisher": "555:1",
                 "peer_type": "loc-rib instance",
                 "policy": "loc-rib",
                 "safi": 1
index 37ddc09ff85bd641cfdeb38c56848c757a359d03..6a82f7af1af9c43d095d215e77d4bd1d2b97c08b 100644 (file)
@@ -7,6 +7,7 @@
                 "is_filtered": false,
                 "peer_asn": 65501,
                 "peer_bgp_id": "192.168.0.1",
+                "peer_distinguisher": "444:1",
                 "peer_type": "loc-rib instance",
                 "policy": "loc-rib"
             },
@@ -17,6 +18,7 @@
                 "is_filtered": false,
                 "peer_asn": 65501,
                 "peer_bgp_id": "192.168.0.1",
+                "peer_distinguisher": "555:1",
                 "peer_type": "loc-rib instance",
                 "policy": "loc-rib",
                 "safi": 1
index cb8a7d2b14e4c8954e8c019ac7d1e37091712332..87066934588e1cbc12faa7a5bed3d4d60dbea5e6 100644 (file)
@@ -23,12 +23,14 @@ router bgp 65501 vrf vrf1
  exit
 !
  address-family ipv4 unicast
+  rd vpn export 444:1
   neighbor 192.168.0.2 activate
   neighbor 192.168.0.2 soft-reconfiguration inbound
   no neighbor 192:168::2 activate
  exit-address-family
 !
  address-family ipv6 unicast
+  rd vpn export 555:1
   neighbor 192:168::2 activate
   neighbor 192:168::2 soft-reconfiguration inbound
  exit-address-family