Skip to content

Commit 208842a

Browse files
fboss2 config/delete protocol bgp peer-group commands
Collapse the ~20 legacy per-attribute `config protocol bgp peer-group` command classes (on the deprecated folly::dynamic BgpConfigSession) into a single typed dispatcher, mirroring CmdConfigProtocolBgpNeighbor: the group name is the first positional, the next one or two tokens name the attribute, and the rest are its value(s); dispatch and per-attribute parsing live in the .cpp so adding a peer-group tunable is a one-entry change. Attributes write the typed bgp::thrift::PeerGroup directly via ConfigSession::getBgpConfig()/ saveBgpConfig(). Covers the 24 attributes with a PeerGroup thrift field (remote/local-asn, description, peer-tag, ingress/egress-policy, rr-client, confed-peer, redistribute-peer, enhanced-route-refresh, connect-mode, add-path send| receive, afi disable-ipv4/ipv6-afi|ipv4-over-ipv6-nh, graceful-restart restart-time|stateful-ha, max-route pre/post-filter + warning knobs, timers hold-time|keepalive|out-delay|withdraw-unprog-delay, next-hop-self). Attributes with no per-peer-group thrift field (afi ipv4/ipv6-labeled-unicast, peer-port) are not part of the dispatch table, so they are refused as unknown attributes rather than persisting dead config. connect-mode BOTH is rejected (no is_passive representation); add-path merges the RECEIVE/SEND bitmask. Adds `delete protocol bgp peer-group <name>`. Unit tests (CmdConfigBgpPeerGroupTest, CmdDeleteBgpPeerGroupTest) and integration tests (ConfigBgpPeerGroupTest) verify staging, the reject paths, and — for the commit path — that bgpd parses and adopts peer_groups via its getRunningConfig RPC. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 66df523 commit 208842a

50 files changed

Lines changed: 1338 additions & 2227 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmake/CliFboss2.cmake

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -866,42 +866,6 @@ add_library(fboss2_config_lib
866866
fboss/cli/fboss2/commands/config/protocol/bgp/neighbor/CmdConfigProtocolBgpNeighbor.h
867867
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroup.cpp
868868
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroup.h
869-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupConfedPeer.cpp
870-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupConfedPeer.h
871-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDescription.cpp
872-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDescription.h
873-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDisableIpv4Afi.cpp
874-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDisableIpv4Afi.h
875-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupEgressPolicy.cpp
876-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupEgressPolicy.h
877-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupIngressPolicy.cpp
878-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupIngressPolicy.h
879-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupMaxRoutes.cpp
880-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupMaxRoutes.h
881-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupNextHopSelf.cpp
882-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupNextHopSelf.h
883-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupPeerTag.cpp
884-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupPeerTag.h
885-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRemoteAsn.cpp
886-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRemoteAsn.h
887-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRrClient.cpp
888-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRrClient.h
889-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimers.cpp
890-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimers.h
891-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersHoldTime.cpp
892-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersHoldTime.h
893-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersKeepalive.cpp
894-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersKeepalive.h
895-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersOutDelay.cpp
896-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersOutDelay.h
897-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersWithdrawUnprogDelay.cpp
898-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersWithdrawUnprogDelay.h
899-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupV4OverV6Nh.cpp
900-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupV4OverV6Nh.h
901-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningLimit.cpp
902-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningLimit.h
903-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningOnly.cpp
904-
fboss/cli/fboss2/commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningOnly.h
905869
fboss/cli/fboss2/commands/config/ptp/CmdConfigPtp.cpp
906870
fboss/cli/fboss2/commands/config/ptp/CmdConfigPtp.h
907871
fboss/cli/fboss2/commands/config/ptp/transparent_clock/CmdConfigPtpTransparentClock.cpp
@@ -998,6 +962,8 @@ add_library(fboss2_config_lib
998962
fboss/cli/fboss2/commands/delete/protocol/bgp/CmdDeleteProtocolBgp.h
999963
fboss/cli/fboss2/commands/delete/protocol/bgp/neighbor/CmdDeleteProtocolBgpNeighbor.cpp
1000964
fboss/cli/fboss2/commands/delete/protocol/bgp/neighbor/CmdDeleteProtocolBgpNeighbor.h
965+
fboss/cli/fboss2/commands/delete/protocol/bgp/peer-group/CmdDeleteProtocolBgpPeerGroup.cpp
966+
fboss/cli/fboss2/commands/delete/protocol/bgp/peer-group/CmdDeleteProtocolBgpPeerGroup.h
1001967
fboss/cli/fboss2/commands/delete/protocol/CmdDeleteProtocol.h
1002968
fboss/cli/fboss2/commands/delete/protocol/static/CmdDeleteProtocolStatic.cpp
1003969
fboss/cli/fboss2/commands/delete/protocol/static/CmdDeleteProtocolStatic.h

cmake/CliFboss2TestConfig.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_executable(fboss2_cmd_config_test
88
fboss/cli/fboss2/test/config/CmdConfigAppliedInfoTest.cpp
99
fboss/cli/fboss2/test/config/CmdConfigArpTest.cpp
1010
fboss/cli/fboss2/test/config/CmdConfigBgpNeighborTest.cpp
11+
fboss/cli/fboss2/test/config/CmdConfigBgpPeerGroupTest.cpp
1112
fboss/cli/fboss2/test/config/CmdConfigIcmpV4UnavailableSrcAddrTest.cpp
1213
fboss/cli/fboss2/test/config/CmdConfigCoppTest.cpp
1314
fboss/cli/fboss2/test/config/CmdConfigDhcpTest.cpp
@@ -34,6 +35,7 @@ add_executable(fboss2_cmd_config_test
3435
fboss/cli/fboss2/test/config/CmdConfigVlanPortTaggingModeTest.cpp
3536
fboss/cli/fboss2/test/config/CmdConfigVlanStaticMacTest.cpp
3637
fboss/cli/fboss2/test/config/CmdDeleteBgpNeighborTest.cpp
38+
fboss/cli/fboss2/test/config/CmdDeleteBgpPeerGroupTest.cpp
3739
fboss/cli/fboss2/test/config/CmdDeleteConfigInterfaceTest.cpp
3840
fboss/cli/fboss2/test/config/CmdDeleteInterfaceIpv6NdpTest.cpp
3941
fboss/cli/fboss2/test/config/CmdDeleteInterfaceTest.cpp

cmake/CliFboss2TestIntegrationTest.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ add_executable(fboss2_integration_test
1212
fboss/cli/fboss2/test/integration_test/ConfigArpTest.cpp
1313
fboss/cli/fboss2/test/integration_test/ConfigBgpGlobalTest.cpp
1414
fboss/cli/fboss2/test/integration_test/ConfigBgpNeighborTest.cpp
15+
fboss/cli/fboss2/test/integration_test/ConfigBgpPeerGroupTest.cpp
1516
fboss/cli/fboss2/test/integration_test/ConfigBgpSessionTest.cpp
1617
fboss/cli/fboss2/test/integration_test/ConfigConcurrentSessionsTest.cpp
1718
fboss/cli/fboss2/test/integration_test/ConfigHostnameTest.cpp

fboss/cli/fboss2/BUCK

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,24 +1071,6 @@ cpp_library(
10711071
"commands/config/protocol/bgp/global/CmdConfigProtocolBgpGlobal.cpp",
10721072
"commands/config/protocol/bgp/neighbor/CmdConfigProtocolBgpNeighbor.cpp",
10731073
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroup.cpp",
1074-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupConfedPeer.cpp",
1075-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDescription.cpp",
1076-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDisableIpv4Afi.cpp",
1077-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupEgressPolicy.cpp",
1078-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupIngressPolicy.cpp",
1079-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupMaxRoutes.cpp",
1080-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupNextHopSelf.cpp",
1081-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupPeerTag.cpp",
1082-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRemoteAsn.cpp",
1083-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRrClient.cpp",
1084-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimers.cpp",
1085-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersHoldTime.cpp",
1086-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersKeepalive.cpp",
1087-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersOutDelay.cpp",
1088-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersWithdrawUnprogDelay.cpp",
1089-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupV4OverV6Nh.cpp",
1090-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningLimit.cpp",
1091-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupWarningOnly.cpp",
10921074
"commands/config/protocol/static/CmdConfigProtocolStatic.cpp",
10931075
"commands/config/protocol/static/route/add/CmdConfigProtocolStaticRouteAdd.cpp",
10941076
"commands/config/ptp/CmdConfigPtp.cpp",
@@ -1129,6 +1111,7 @@ cpp_library(
11291111
"commands/delete/protocol/CmdDeleteProtocol.cpp",
11301112
"commands/delete/protocol/bgp/CmdDeleteProtocolBgp.cpp",
11311113
"commands/delete/protocol/bgp/neighbor/CmdDeleteProtocolBgpNeighbor.cpp",
1114+
"commands/delete/protocol/bgp/peer-group/CmdDeleteProtocolBgpPeerGroup.cpp",
11321115
"commands/delete/protocol/static/CmdDeleteProtocolStatic.cpp",
11331116
"commands/delete/protocol/static/route/CmdDeleteProtocolStaticRoute.cpp",
11341117
"commands/delete/tunnel/CmdDeleteTunnel.cpp",
@@ -1179,20 +1162,6 @@ cpp_library(
11791162
"commands/config/protocol/bgp/global/CmdConfigProtocolBgpGlobal.h",
11801163
"commands/config/protocol/bgp/neighbor/CmdConfigProtocolBgpNeighbor.h",
11811164
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroup.h",
1182-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupConfedPeer.h",
1183-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDescription.h",
1184-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupDisableIpv4Afi.h",
1185-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupEgressPolicy.h",
1186-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupIngressPolicy.h",
1187-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupMaxRoutes.h",
1188-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupNextHopSelf.h",
1189-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRemoteAsn.h",
1190-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupRrClient.h",
1191-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimers.h",
1192-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersHoldTime.h",
1193-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersKeepalive.h",
1194-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupTimersOutDelay.h",
1195-
"commands/config/protocol/bgp/peer-group/CmdConfigProtocolBgpPeerGroupV4OverV6Nh.h",
11961165
"commands/config/protocol/static/CmdConfigProtocolStatic.h",
11971166
"commands/config/protocol/static/route/StaticRouteUtils.h",
11981167
"commands/config/protocol/static/route/add/CmdConfigProtocolStaticRouteAdd.h",
@@ -1234,6 +1203,7 @@ cpp_library(
12341203
"commands/delete/protocol/CmdDeleteProtocol.h",
12351204
"commands/delete/protocol/bgp/CmdDeleteProtocolBgp.h",
12361205
"commands/delete/protocol/bgp/neighbor/CmdDeleteProtocolBgpNeighbor.h",
1206+
"commands/delete/protocol/bgp/peer-group/CmdDeleteProtocolBgpPeerGroup.h",
12371207
"commands/delete/protocol/static/CmdDeleteProtocolStatic.h",
12381208
"commands/delete/protocol/static/route/CmdDeleteProtocolStaticRoute.h",
12391209
"commands/delete/tunnel/CmdDeleteTunnel.h",

0 commit comments

Comments
 (0)