diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index d6df56026078..3a4364c5f997 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -275,37 +275,33 @@ static inline int bmp_get_peer_type(struct peer *peer) return bmp_get_peer_type_vrf(peer->bgp->vrf_id); } -static inline int bmp_get_peer_distinguisher(struct bmp *bmp, afi_t afi, - uint8_t peer_type, +static inline int bmp_get_peer_distinguisher(struct bgp *bgp, afi_t afi, uint8_t peer_type, uint64_t *result_ref) { - - /* remove this check when the other peer types get correct peer dist. - *(RFC7854) impl. - * for now, always return no error and 0 peer distinguisher as before - */ - if (peer_type != BMP_PEER_TYPE_LOC_RIB_INSTANCE) - return (*result_ref = 0); + /* use RD if set in VRF config */ + struct prefix_rd *prd; /* sending vrf_id or rd could be turned into an option at some point */ - struct bgp *bgp = bmp->targets->bgp; + if (peer_type == BMP_PEER_TYPE_LOCAL_INSTANCE || bgp->vrf_id == VRF_UNKNOWN) + return 1; /* vrf default => ok, distinguisher 0 */ if (bgp->inst_type == VRF_DEFAULT) return (*result_ref = 0); - /* use RD if set in VRF config for this AFI */ - struct prefix_rd *prd = &bgp->vpn_policy[afi].tovpn_rd; - - if (CHECK_FLAG(bgp->vpn_policy[afi].flags, - BGP_VPN_POLICY_TOVPN_RD_SET)) { + prd = &bgp->vpn_policy[AFI_IP].tovpn_rd; + if ((afi == AFI_IP || afi == AFI_UNSPEC) && + CHECK_FLAG(bgp->vpn_policy[AFI_IP].flags, BGP_VPN_POLICY_TOVPN_RD_SET)) { memcpy(result_ref, prd->val, sizeof(prd->val)); return 0; } - /* VRF has no id => error => message should be skipped */ - if (bgp->vrf_id == VRF_UNKNOWN) - return 1; + prd = &bgp->vpn_policy[AFI_IP6].tovpn_rd; + if ((afi == AFI_IP6 || afi == AFI_UNSPEC) && + CHECK_FLAG(bgp->vpn_policy[AFI_IP6].flags, BGP_VPN_POLICY_TOVPN_RD_SET)) { + memcpy(result_ref, prd->val, sizeof(prd->val)); + return 0; + } /* use VRF id converted to ::vrf_id 64bits format */ *result_ref = ((uint64_t)htonl(bgp->vrf_id)) << 32; @@ -469,6 +465,7 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down) struct timeval uptime, uptime_real; uint8_t peer_type; bool is_locrib = false; + uint64_t peer_distinguisher = 0; uptime.tv_sec = peer->uptime; uptime.tv_usec = 0; @@ -477,9 +474,12 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down) peer_type = bmp_get_peer_type(peer); if (peer_type == BMP_PEER_TYPE_LOC_RIB_INSTANCE) is_locrib = true; - else - /* TODO: remove this when other RD and local instances supported */ - peer_type = BMP_PEER_TYPE_GLOBAL_INSTANCE; + + if (bmp_get_peer_distinguisher(peer->bgp, AFI_UNSPEC, peer_type, &peer_distinguisher)) { + zlog_warn("skipping bmp message for peer %s: can't get peer distinguisher", + peer->host); + return NULL; + } #define BGP_BMP_MAX_PACKET_SIZE 1024 #define BMP_PEERUP_INFO_TYPE_STRING 0 @@ -490,7 +490,7 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down) bmp_common_hdr(s, BMP_VERSION_3, BMP_TYPE_PEER_UP_NOTIFICATION); - bmp_per_peer_hdr(s, peer->bgp, peer, 0, peer_type, 0, &uptime_real); + bmp_per_peer_hdr(s, peer->bgp, peer, 0, peer_type, peer_distinguisher, &uptime_real); /* Local Address (16 bytes) */ if (is_locrib) @@ -552,9 +552,7 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down) bmp_common_hdr(s, BMP_VERSION_3, BMP_TYPE_PEER_DOWN_NOTIFICATION); - bmp_per_peer_hdr(s, peer->bgp, peer, 0, - BMP_PEER_TYPE_GLOBAL_INSTANCE, 0, - &uptime_real); + bmp_per_peer_hdr(s, peer->bgp, peer, 0, peer_type, peer_distinguisher, &uptime_real); type_pos = stream_get_endp(s); stream_putc(s, 0); /* placeholder for down reason */ @@ -608,8 +606,10 @@ static int bmp_send_peerup(struct bmp *bmp) /* Walk down all peers */ for (ALL_LIST_ELEMENTS_RO(bmp->targets->bgp->peer, node, peer)) { s = bmp_peerstate(peer, false); - pullwr_write_stream(bmp->pullwr, s); - stream_free(s); + if (s) { + pullwr_write_stream(bmp->pullwr, s); + stream_free(s); + } } return 0; @@ -626,10 +626,10 @@ static int bmp_send_peerup_vrf(struct bmp *bmp) bmp_bgp_update_vrf_status(bmpbgp, vrf_state_unknown); s = bmp_peerstate(bmpbgp->bgp->peer_self, bmpbgp->vrf_state == vrf_state_down); - - pullwr_write_stream(bmp->pullwr, s); - stream_free(s); - + if (s) { + pullwr_write_stream(bmp->pullwr, s); + stream_free(s); + } return 0; } @@ -640,6 +640,9 @@ static void bmp_send_all(struct bmp_bgp *bmpbgp, struct stream *s) struct bmp_targets *bt; struct bmp *bmp; + if (!s) + return; + frr_each(bmp_targets, &bmpbgp->targets, bt) frr_each(bmp_session, &bt->sessions, bmp) pullwr_write_stream(bmp->pullwr, s); @@ -648,6 +651,9 @@ static void bmp_send_all(struct bmp_bgp *bmpbgp, struct stream *s) static void bmp_send_all_safe(struct bmp_bgp *bmpbgp, struct stream *s) { + if (!s) + return; + if (!bmpbgp) { stream_free(s); return; @@ -775,14 +781,24 @@ static void bmp_wrmirror_lost(struct bmp *bmp, struct pullwr *pullwr) { struct stream *s; struct timeval tv; + uint8_t peer_type_flag; + uint64_t peer_distinguisher = 0; gettimeofday(&tv, NULL); + peer_type_flag = bmp_get_peer_type_vrf(bmp->targets->bgp->vrf_id); + + if (bmp_get_peer_distinguisher(bmp->targets->bgp, AFI_UNSPEC, peer_type_flag, + &peer_distinguisher)) { + zlog_warn("skipping bmp message for reason: can't get peer distinguisher"); + return; + } + s = stream_new(BGP_MAX_PACKET_SIZE); bmp_common_hdr(s, BMP_VERSION_3, BMP_TYPE_ROUTE_MIRRORING); - bmp_per_peer_hdr(s, bmp->targets->bgp, bmp->targets->bgp->peer_self, 0, - BMP_PEER_TYPE_GLOBAL_INSTANCE, 0, &tv); + bmp_per_peer_hdr(s, bmp->targets->bgp, bmp->targets->bgp->peer_self, 0, peer_type_flag, + peer_distinguisher, &tv); stream_putw(s, BMP_MIRROR_TLV_TYPE_INFO); stream_putw(s, 2); @@ -799,6 +815,8 @@ static bool bmp_wrmirror(struct bmp *bmp, struct pullwr *pullwr) struct bmp_mirrorq *bmq; struct peer *peer; bool written = false; + uint8_t peer_type_flag; + uint64_t peer_distinguisher = 0; if (bmp->mirror_lost) { bmp_wrmirror_lost(bmp, pullwr); @@ -816,12 +834,20 @@ static bool bmp_wrmirror(struct bmp *bmp, struct pullwr *pullwr) goto out; } + peer_type_flag = bmp_get_peer_type_vrf(bmp->targets->bgp->vrf_id); + + if (bmp_get_peer_distinguisher(peer->bgp, AFI_UNSPEC, peer_type_flag, &peer_distinguisher)) { + zlog_warn("skipping bmp message for peer %s: can't get peer distinguisher", + peer->host); + goto out; + } + struct stream *s; s = stream_new(BGP_MAX_PACKET_SIZE); bmp_common_hdr(s, BMP_VERSION_3, BMP_TYPE_ROUTE_MIRRORING); - bmp_per_peer_hdr(s, bmp->targets->bgp, peer, 0, - BMP_PEER_TYPE_GLOBAL_INSTANCE, 0, &bmq->tv); + bmp_per_peer_hdr(s, bmp->targets->bgp, peer, 0, peer_type_flag, peer_distinguisher, + &bmq->tv); /* BMP Mirror TLV. */ stream_putw(s, BMP_MIRROR_TLV_TYPE_BGP_MESSAGE); @@ -971,8 +997,7 @@ static void bmp_eor(struct bmp *bmp, afi_t afi, safi_t safi, uint8_t flags, uint64_t peer_distinguisher = 0; /* skip this message if peer distinguisher is not available */ - if (bmp_get_peer_distinguisher(bmp, afi, peer_type_flag, - &peer_distinguisher)) { + if (bmp_get_peer_distinguisher(peer->bgp, afi, peer_type_flag, &peer_distinguisher)) { zlog_warn( "skipping bmp message for reason: can't get peer distinguisher"); continue; @@ -1100,8 +1125,7 @@ static void bmp_monitor(struct bmp *bmp, struct peer *peer, uint8_t flags, uint64_t peer_distinguisher = 0; /* skip this message if peer distinguisher is not available */ - if (bmp_get_peer_distinguisher(bmp, afi, peer_type_flag, - &peer_distinguisher)) { + if (bmp_get_peer_distinguisher(peer->bgp, afi, peer_type_flag, &peer_distinguisher)) { zlog_warn( "skipping bmp message for reason: can't get peer distinguisher"); return; @@ -1135,6 +1159,7 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr) uint8_t bpi_num_labels, adjin_num_labels; afi_t afi; safi_t safi; + uint8_t peer_type_flag; if (bmp->syncafi == AFI_MAX) { FOREACH_AFI_SAFI (afi, safi) { @@ -1177,6 +1202,8 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr) struct bgp_path_info *bpi = NULL, *bpiter; struct bgp_adj_in *adjin = NULL, *adjiter; + peer_type_flag = bmp_get_peer_type_vrf(bmp->targets->bgp->vrf_id); + if ((afi == AFI_L2VPN && safi == SAFI_EVPN) || (safi == SAFI_MPLS_VPN)) { /* initialize syncrdpos to the first @@ -1231,10 +1258,8 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr) bmp->remote, afi2str(afi), safi2str(safi)); - bmp_eor(bmp, afi, safi, BMP_PEER_FLAG_L, - BMP_PEER_TYPE_GLOBAL_INSTANCE); - bmp_eor(bmp, afi, safi, 0, - BMP_PEER_TYPE_GLOBAL_INSTANCE); + bmp_eor(bmp, afi, safi, BMP_PEER_FLAG_L, peer_type_flag); + bmp_eor(bmp, afi, safi, 0, peer_type_flag); bmp_eor(bmp, afi, safi, 0, BMP_PEER_TYPE_LOC_RIB_INSTANCE); @@ -1318,19 +1343,20 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr) bpi_num_labels); } + if (bpi) + peer_type_flag = bmp_get_peer_type(bpi->peer); + if (bpi && CHECK_FLAG(bpi->flags, BGP_PATH_VALID) && CHECK_FLAG(bmp->targets->afimon[afi][safi], BMP_MON_POSTPOLICY)) - bmp_monitor(bmp, bpi->peer, BMP_PEER_FLAG_L, - BMP_PEER_TYPE_GLOBAL_INSTANCE, bn_p, prd, bpi->attr, + bmp_monitor(bmp, bpi->peer, BMP_PEER_FLAG_L, peer_type_flag, bn_p, prd, bpi->attr, afi, safi, bpi->uptime, - bpi_num_labels ? bpi->extra->labels->label : NULL, - bpi_num_labels); + bpi_num_labels ? bpi->extra->labels->label : NULL, bpi_num_labels); if (adjin) { adjin_num_labels = adjin->labels ? adjin->labels->num_labels : 0; - bmp_monitor(bmp, adjin->peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, bn_p, prd, - adjin->attr, afi, safi, adjin->uptime, - adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels); + bmp_monitor(bmp, adjin->peer, 0, peer_type_flag, bn_p, prd, adjin->attr, afi, safi, + adjin->uptime, adjin_num_labels ? &adjin->labels->label[0] : NULL, + adjin_num_labels); } if (bn) @@ -1469,6 +1495,7 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) struct bgp_dest *bn = NULL; bool written = false; uint8_t bpi_num_labels, adjin_num_labels; + uint8_t peer_type_flag; bqe = bmp_pull(bmp); if (!bqe) @@ -1509,6 +1536,8 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) bn = bgp_safi_node_lookup(bmp->targets->bgp->rib[afi][safi], safi, &bqe->p, prd); + peer_type_flag = bmp_get_peer_type(peer); + if (CHECK_FLAG(bmp->targets->afimon[afi][safi], BMP_MON_POSTPOLICY)) { struct bgp_path_info *bpi; @@ -1522,12 +1551,9 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) bpi_num_labels = BGP_PATH_INFO_NUM_LABELS(bpi); - bmp_monitor(bmp, peer, BMP_PEER_FLAG_L, - BMP_PEER_TYPE_GLOBAL_INSTANCE, &bqe->p, prd, - bpi ? bpi->attr : NULL, afi, safi, - bpi ? bpi->uptime : monotime(NULL), - bpi_num_labels ? bpi->extra->labels->label : NULL, - bpi_num_labels); + bmp_monitor(bmp, peer, BMP_PEER_FLAG_L, peer_type_flag, &bqe->p, prd, + bpi ? bpi->attr : NULL, afi, safi, bpi ? bpi->uptime : monotime(NULL), + bpi_num_labels ? bpi->extra->labels->label : NULL, bpi_num_labels); written = true; } @@ -1540,9 +1566,8 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) break; } adjin_num_labels = adjin && adjin->labels ? adjin->labels->num_labels : 0; - bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, &bqe->p, prd, - adjin ? adjin->attr : NULL, afi, safi, - adjin ? adjin->uptime : monotime(NULL), + bmp_monitor(bmp, peer, 0, peer_type_flag, &bqe->p, prd, adjin ? adjin->attr : NULL, + afi, safi, adjin ? adjin->uptime : monotime(NULL), adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels); written = true; } @@ -1708,6 +1733,8 @@ static void bmp_stats(struct event *thread) struct peer *peer; struct listnode *node; struct timeval tv; + uint8_t peer_type_flag; + uint64_t peer_distinguisher = 0; if (bt->stat_msec) event_add_timer_msec(bm->master, bmp_stats, bt, bt->stat_msec, @@ -1724,8 +1751,14 @@ static void bmp_stats(struct event *thread) s = stream_new(BGP_MAX_PACKET_SIZE); bmp_common_hdr(s, BMP_VERSION_3, BMP_TYPE_STATISTICS_REPORT); - bmp_per_peer_hdr(s, bt->bgp, peer, 0, - BMP_PEER_TYPE_GLOBAL_INSTANCE, 0, &tv); + peer_type_flag = bmp_get_peer_type(peer); + if (bmp_get_peer_distinguisher(peer->bgp, AFI_UNSPEC, peer_type_flag, + &peer_distinguisher)) { + zlog_warn("skipping bmp message for peer %s: can't get peer distinguisher", + peer->host); + continue; + } + bmp_per_peer_hdr(s, bt->bgp, peer, 0, peer_type_flag, peer_distinguisher, &tv); count_pos = stream_get_endp(s); stream_putl(s, 0); diff --git a/tests/topotests/bgp_bmp/bgpbmp.py b/tests/topotests/bgp_bmp/bgpbmp.py index 5e8b0d9be72d..eac78a63f767 100644 --- a/tests/topotests/bgp_bmp/bgpbmp.py +++ b/tests/topotests/bgp_bmp/bgpbmp.py @@ -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:. - # 0: 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 @@ -199,7 +187,7 @@ def bmp_check_for_prefixes( def bmp_check_for_peer_message( - expected_peers, bmp_log_type, bmp_collector, bmp_log_file + expected_peers, bmp_log_type, bmp_collector, bmp_log_file, is_rd_instance=False ): """ Check for the presence of a peer up message for the peer @@ -218,11 +206,15 @@ def bmp_check_for_peer_message( # get the list of pairs (prefix, policy, seq) for the given message type peers = [] for m in messages: + if is_rd_instance and m["peer_distinguisher"] == "0:0": + continue if ( "peer_ip" in m.keys() and m["peer_ip"] != "0.0.0.0" and m["bmp_log_type"] == bmp_log_type ): + if is_rd_instance and m["peer_type"] != "route distinguisher instance": + continue peers.append(m["peer_ip"]) elif m["policy"] == "loc-rib" and m["bmp_log_type"] == bmp_log_type: peers.append("0.0.0.0") diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-loc-rib-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-loc-rib-step1.json index ba31bf1d5df7..d6c87dd4fdaa 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-loc-rib-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-loc-rib-step1.json @@ -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 diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-post-policy-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-post-policy-step1.json index d5d9d6518265..04e01623dfc0 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-post-policy-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-post-policy-step1.json @@ -10,9 +10,9 @@ "origin": "IGP", "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "444:1", "peer_ip": "192.168.0.2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "post-policy" }, "2111::1111/128": { @@ -25,9 +25,9 @@ "origin": "IGP", "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "555:1", "peer_ip": "192:168::2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "post-policy", "safi": 1 } diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-pre-policy-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-pre-policy-step1.json index e11badc040a9..760ee0409ab4 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-pre-policy-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-update-pre-policy-step1.json @@ -10,9 +10,9 @@ "origin": "IGP", "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "444:1", "peer_ip": "192.168.0.2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "pre-policy" }, "2111::1111/128": { @@ -25,9 +25,9 @@ "origin": "IGP", "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "555:1", "peer_ip": "192:168::2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "pre-policy", "safi": 1 } diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-loc-rib-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-loc-rib-step1.json index 37ddc09ff85b..6a82f7af1af9 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-loc-rib-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-loc-rib-step1.json @@ -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 diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-post-policy-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-post-policy-step1.json index de84307a4e6b..f57b1a51cefb 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-post-policy-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-post-policy-step1.json @@ -7,9 +7,9 @@ "ipv6": false, "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "444:1", "peer_ip": "192.168.0.2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "post-policy" }, "2111::1111/128": { @@ -19,9 +19,9 @@ "ipv6": true, "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "555:1", "peer_ip": "192:168::2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "post-policy", "safi": 1 } diff --git a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-pre-policy-step1.json b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-pre-policy-step1.json index 1c34498b7a38..a52308c7892e 100644 --- a/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-pre-policy-step1.json +++ b/tests/topotests/bgp_bmp/bmp1vrf/bmp-withdraw-pre-policy-step1.json @@ -7,9 +7,9 @@ "ipv6": false, "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "444:1", "peer_ip": "192.168.0.2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "pre-policy" }, "2111::1111/128": { @@ -19,9 +19,9 @@ "ipv6": true, "peer_asn": 65502, "peer_bgp_id": "192.168.0.2", - "peer_distinguisher": "0:0", + "peer_distinguisher": "555:1", "peer_ip": "192:168::2", - "peer_type": "global instance", + "peer_type": "route distinguisher instance", "policy": "pre-policy", "safi": 1 } diff --git a/tests/topotests/bgp_bmp/r1vrf/frr.conf b/tests/topotests/bgp_bmp/r1vrf/frr.conf index cb8a7d2b14e4..87066934588e 100644 --- a/tests/topotests/bgp_bmp/r1vrf/frr.conf +++ b/tests/topotests/bgp_bmp/r1vrf/frr.conf @@ -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 diff --git a/tests/topotests/bgp_bmp/test_bgp_bmp_2.py b/tests/topotests/bgp_bmp/test_bgp_bmp_2.py index e8f67515bd5d..f16ff2b4458b 100644 --- a/tests/topotests/bgp_bmp/test_bgp_bmp_2.py +++ b/tests/topotests/bgp_bmp/test_bgp_bmp_2.py @@ -210,6 +210,7 @@ def test_peer_up(): "peer up", tgen.gears["bmp1vrf"], os.path.join(tgen.logdir, "bmp1vrf", "bmp.log"), + is_rd_instance=True, ) success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1) assert success, "Checking the updated prefixes has been failed !." @@ -245,6 +246,7 @@ def test_peer_down(): "peer down", tgen.gears["bmp1vrf"], os.path.join(tgen.logdir, "bmp1vrf", "bmp.log"), + is_rd_instance=True, ) success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1) assert success, "Checking the updated prefixes has been failed !."