mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 02:30:38 +00:00
bgpd, topotests: bmp imported bgp, send peer up events when config param changed
When a BGP instance is created or becomes valid, and when a parameter is updated (router-id, route distinguisher), the peer up messages other than loc rib peer up messages, are sent. Add a test that controls if peer down and peer up messages are sent accordingly with correct route distinguisher values. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
ca7699f4ae
commit
6c7b2abc01
@ -3443,6 +3443,7 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
|
||||
struct bmp_imported_bgp *bib;
|
||||
int ret = 0;
|
||||
struct stream *s = bmp_peerstate(bgp->peer_self, withdraw);
|
||||
struct bmp *bmp;
|
||||
|
||||
if (!s)
|
||||
return 0;
|
||||
@ -3451,6 +3452,10 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
|
||||
frr_each (bmp_targets, &bmpbgp->targets, bt) {
|
||||
ret = bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
|
||||
withdraw, s);
|
||||
if (withdraw)
|
||||
continue;
|
||||
frr_each (bmp_session, &bt->sessions, bmp)
|
||||
bmp_send_peerup_per_instance(bmp, bgp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3466,6 +3471,10 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
|
||||
continue;
|
||||
ret += bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
|
||||
withdraw, s);
|
||||
if (withdraw)
|
||||
continue;
|
||||
frr_each (bmp_session, &bt->sessions, bmp)
|
||||
bmp_send_peerup_per_instance(bmp, bgp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3490,10 +3499,18 @@ static void _bmp_vrf_state_changed_internal(struct bgp *bgp, enum bmp_vrf_state
|
||||
struct bmp_targets *bt;
|
||||
struct listnode *node;
|
||||
struct bmp_imported_bgp *bib;
|
||||
struct bmp *bmp;
|
||||
|
||||
if (bmpbgp && bmp_bgp_update_vrf_status(&bmpbgp->vrf_state, bgp, vrf_state))
|
||||
if (bmpbgp && bmp_bgp_update_vrf_status(&bmpbgp->vrf_state, bgp, vrf_state)) {
|
||||
bmp_send_all_safe(bmpbgp, bmp_peerstate(bgp->peer_self,
|
||||
bmpbgp->vrf_state == vrf_state_down));
|
||||
if (vrf_state == vrf_state_up && bmpbgp->vrf_state == vrf_state_up) {
|
||||
frr_each (bmp_targets, &bmpbgp->targets, bt) {
|
||||
frr_each (bmp_session, &bt->sessions, bmp)
|
||||
bmp_send_peerup_per_instance(bmp, bgp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp_vrf)) {
|
||||
bmpbgp = bmp_bgp_find(bgp_vrf);
|
||||
@ -3509,6 +3526,11 @@ static void _bmp_vrf_state_changed_internal(struct bgp *bgp, enum bmp_vrf_state
|
||||
bmp_send_bt_safe(bt, bmp_peerstate(bgp->peer_self,
|
||||
bib->vrf_state ==
|
||||
vrf_state_down));
|
||||
if (vrf_state == vrf_state_up &&
|
||||
bib->vrf_state == vrf_state_up) {
|
||||
frr_each (bmp_session, &bt->sessions, bmp)
|
||||
bmp_send_peerup_per_instance(bmp, bgp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -270,6 +270,81 @@ def test_peer_down():
|
||||
assert success, "Checking the updated prefixes has been failed !."
|
||||
|
||||
|
||||
def test_reconfigure_route_distinguisher_vrf1():
|
||||
"""
|
||||
Checking for BMP peers down messages
|
||||
"""
|
||||
tgen = get_topogen()
|
||||
|
||||
bmp_update_seq(
|
||||
tgen.gears["bmp1import"], os.path.join(tgen.logdir, "bmp1import", "bmp.log")
|
||||
)
|
||||
peers = ["0.0.0.0"]
|
||||
|
||||
tgen.gears["r1import"].vtysh_cmd(
|
||||
"""
|
||||
configure terminal
|
||||
router bgp 65501 vrf vrf1
|
||||
address-family ipv4 unicast
|
||||
rd vpn export 666:22
|
||||
exit-address-family
|
||||
address-family ipv6 unicast
|
||||
rd vpn export 666:22
|
||||
"""
|
||||
)
|
||||
logger.info(
|
||||
"checking for BMP peer down LOC-RIB message with route-distinguisher set to 444:1"
|
||||
)
|
||||
test_func = partial(
|
||||
bmp_check_for_peer_message,
|
||||
peers,
|
||||
"peer down",
|
||||
tgen.gears["bmp1import"],
|
||||
os.path.join(tgen.logdir, "bmp1import", "bmp.log"),
|
||||
is_rd_instance=True,
|
||||
peer_distinguisher="444:1",
|
||||
)
|
||||
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||
assert (
|
||||
success
|
||||
), "Checking the BMP peer down LOC-RIB message with route-distinguisher set to 444:1 failed !."
|
||||
|
||||
logger.info(
|
||||
"checking for BMP peer up LOC-RIB messages with route-distinguisher set to 666:22"
|
||||
)
|
||||
test_func = partial(
|
||||
bmp_check_for_peer_message,
|
||||
peers,
|
||||
"peer up",
|
||||
tgen.gears["bmp1import"],
|
||||
os.path.join(tgen.logdir, "bmp1import", "bmp.log"),
|
||||
is_rd_instance=True,
|
||||
peer_distinguisher="666:22",
|
||||
)
|
||||
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||
assert (
|
||||
success
|
||||
), "Checking the BMP peer up LOC-RIB message with route-distinguisher set to 666:22 failed !."
|
||||
|
||||
logger.info(
|
||||
"checking for BMP peer up messages with route-distinguisher set to 666:22"
|
||||
)
|
||||
peers = ["192.168.1.3", "192:167::3"]
|
||||
test_func = partial(
|
||||
bmp_check_for_peer_message,
|
||||
peers,
|
||||
"peer up",
|
||||
tgen.gears["bmp1import"],
|
||||
os.path.join(tgen.logdir, "bmp1import", "bmp.log"),
|
||||
is_rd_instance=True,
|
||||
peer_distinguisher="666:22",
|
||||
)
|
||||
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||
assert (
|
||||
success
|
||||
), "Checking the BMP peer up messages with route-distinguisher set to 666:22 failed !."
|
||||
|
||||
|
||||
def test_bgp_routerid_changed():
|
||||
"""
|
||||
Checking for BGP loc-rib up messages with new router-id
|
||||
|
Loading…
Reference in New Issue
Block a user