diff options
author | Russ White <russ@riw.us> | 2024-12-03 16:05:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 16:05:44 +0100 |
commit | e9c9db0122ec29d7d97d11d93d14e2b04efe191a (patch) | |
tree | 4b2c09ab5c4a858841edeb2c3941b2e52a4c84f4 | |
parent | Merge pull request #17528 from opensourcerouting/fix/peer_notify_copy_error (diff) | |
parent | tests: Check if remote-as is not flushed once peer-group applied (diff) | |
download | frr-e9c9db0122ec29d7d97d11d93d14e2b04efe191a.tar.xz frr-e9c9db0122ec29d7d97d11d93d14e2b04efe191a.zip |
bgpd: Fix remote-as with peer-group
-rw-r--r-- | bgpd/bgpd.c | 1 | ||||
-rw-r--r-- | tests/topotests/bgp_peer_group/r1/frr.conf | 7 | ||||
-rw-r--r-- | tests/topotests/bgp_peer_group/r4/frr.conf | 7 | ||||
-rw-r--r-- | tests/topotests/bgp_peer_group/test_bgp_peer-group.py | 29 |
4 files changed, 43 insertions, 1 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 2f184894d..dccac3ece 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2859,6 +2859,7 @@ struct peer_group *peer_group_get(struct bgp *bgp, const char *name) group->conf->host = XSTRDUP(MTYPE_BGP_PEER_HOST, name); group->conf->group = group; group->conf->as = 0; + group->conf->as_type = AS_UNSPECIFIED; group->conf->ttl = BGP_DEFAULT_TTL; group->conf->gtsm_hops = BGP_GTSM_HOPS_DISABLED; group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; diff --git a/tests/topotests/bgp_peer_group/r1/frr.conf b/tests/topotests/bgp_peer_group/r1/frr.conf index 035c8e4cf..cf9d16c91 100644 --- a/tests/topotests/bgp_peer_group/r1/frr.conf +++ b/tests/topotests/bgp_peer_group/r1/frr.conf @@ -5,6 +5,9 @@ interface r1-eth0 interface r1-eth1 ip address 192.168.251.1/30 ! +interface r1-eth2 + ip address 192.168.252.1/30 +! ip forwarding ! router bgp 65001 @@ -17,5 +20,9 @@ router bgp 65001 neighbor PG1 remote-as external neighbor PG1 timers 3 20 neighbor PG1 graceful-restart-disable + neighbor PG2 peer-group + neighbor PG2 local-as 65554 no-prepend replace-as neighbor 192.168.251.2 peer-group PG1 + neighbor 192.168.252.2 remote-as 65004 + neighbor 192.168.252.2 peer-group PG2 ! diff --git a/tests/topotests/bgp_peer_group/r4/frr.conf b/tests/topotests/bgp_peer_group/r4/frr.conf new file mode 100644 index 000000000..b1da90f06 --- /dev/null +++ b/tests/topotests/bgp_peer_group/r4/frr.conf @@ -0,0 +1,7 @@ +! +interface r4-eth0 + ip address 192.168.252.2/30 +! +router bgp 65004 + neighbor 192.168.252.1 remote-as external +! diff --git a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py index 45f713b8a..e98d5f8b3 100644 --- a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py +++ b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py @@ -30,7 +30,7 @@ pytestmark = [pytest.mark.bgpd] def build_topo(tgen): - for routern in range(1, 4): + for routern in range(1, 5): tgen.add_router("r{}".format(routern)) switch = tgen.add_switch("s1") @@ -42,6 +42,10 @@ def build_topo(tgen): switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears["r2"]) + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r4"]) + def setup_module(mod): tgen = Topogen(build_topo, mod.__name__) @@ -84,6 +88,11 @@ def test_bgp_peer_group(): "bgpState": "Established", "neighborCapabilities": {"gracefulRestart": "received"}, }, + "192.168.252.2": { + "peerGroup": "PG2", + "bgpState": "Established", + "neighborCapabilities": {"gracefulRestart": "advertisedAndReceived"}, + }, } return topotest.json_cmp(output, expected) @@ -110,6 +119,24 @@ def test_bgp_peer_group(): assert result is None, "Failed checking advertised routes from r3" +def test_show_running_remote_as_peer_group(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + output = ( + tgen.gears["r1"] + .cmd( + 'vtysh -c "show running bgpd" | grep "^ neighbor 192.168.252.2 remote-as 65004"' + ) + .rstrip() + ) + assert ( + output == " neighbor 192.168.252.2 remote-as 65004" + ), "192.168.252.2 remote-as is flushed" + + def test_bgp_peer_group_remote_as_del_readd(): tgen = get_topogen() |