-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bgpd: conditional advertisement #7189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/085a125a70429c3b678733b09bfad37d/raw/ea961d3cbbf3168505e8a61dbd45189e35833780/cr_7189_1601249031.diff | git apply
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index b1edf6ef8..f82759b11 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -430,13 +430,13 @@ struct bgp_aggregate {
#define UNSUPPRESS_MAP_NAME(F) ((F)->usmap.name)
#define UNSUPPRESS_MAP(F) ((F)->usmap.map)
-#define ADVERTISE_MAP_NAME(F) ((F)->advmap.aname)
-#define ADVERTISE_MAP(F) ((F)->advmap.amap)
+#define ADVERTISE_MAP_NAME(F) ((F)->advmap.aname)
+#define ADVERTISE_MAP(F) ((F)->advmap.amap)
-#define ADVERTISE_CONDITION(F) ((F)->advmap.condition)
+#define ADVERTISE_CONDITION(F) ((F)->advmap.condition)
-#define CONDITION_MAP_NAME(F) ((F)->advmap.cname)
-#define CONDITION_MAP(F) ((F)->advmap.cmap)
+#define CONDITION_MAP_NAME(F) ((F)->advmap.cname)
+#define CONDITION_MAP(F) ((F)->advmap.cmap)
/* path PREFIX (addpath rxid NUMBER) */
#define PATH_ADDPATH_STR_BUFFER PREFIX2STR_BUFFER + 32
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index aff1c5a2b..fbaabf5ce 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6844,17 +6844,15 @@ static int peer_advertise_map_unset_vty(struct vty *vty, const char *ip_str,
return bgp_vty_return(vty, ret);
}
-DEFUN (neighbor_advertise_map,
- neighbor_advertise_map_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Route-map to conditionally advertise routes\n"
- "Name of advertise map\n"
- "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
- "Name of the exist map\n"
- "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
- "Name of the non exist map\n")
+DEFUN(neighbor_advertise_map, neighbor_advertise_map_cmd,
+ "neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
+ NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Route-map to conditionally advertise routes\n"
+ "Name of advertise map\n"
+ "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
+ "Name of the exist map\n"
+ "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
+ "Name of the non exist map\n")
{
int idx = 0;
int idx_peer = 1;
@@ -6871,28 +6869,26 @@ DEFUN (neighbor_advertise_map,
argv[idx_condition_word]->arg);
}
-ALIAS_HIDDEN(neighbor_advertise_map, neighbor_advertise_map_hidden_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
- NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Route-map to conditionally advertise routes\n"
- "Name of advertise map\n"
- "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
- "Name of the exist map\n"
- "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
- "Name of the non exist map\n")
-
-DEFUN (no_neighbor_advertise_map,
- no_neighbor_advertise_map_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Route-map to conditionally advertise routes\n"
- "Name of advertise map\n"
- "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
- "Name of the exist map\n"
- "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
- "Name of the non exist map\n")
+ALIAS_HIDDEN(
+ neighbor_advertise_map, neighbor_advertise_map_hidden_cmd,
+ "neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
+ NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Route-map to conditionally advertise routes\n"
+ "Name of advertise map\n"
+ "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
+ "Name of the exist map\n"
+ "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
+ "Name of the non exist map\n")
+
+DEFUN(no_neighbor_advertise_map, no_neighbor_advertise_map_cmd,
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
+ NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Route-map to conditionally advertise routes\n"
+ "Name of advertise map\n"
+ "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
+ "Name of the exist map\n"
+ "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
+ "Name of the non exist map\n")
{
int idx = 0;
int idx_peer = 2;
@@ -6909,15 +6905,16 @@ DEFUN (no_neighbor_advertise_map,
argv[idx_condition_word]->arg);
}
-ALIAS_HIDDEN(no_neighbor_advertise_map, no_neighbor_advertise_map_hidden_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
- NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Route-map to conditionally advertise routes\n"
- "Name of advertise map\n"
- "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
- "Name of the exist map\n"
- "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
- "Name of the non exist map\n")
+ALIAS_HIDDEN(
+ no_neighbor_advertise_map, no_neighbor_advertise_map_hidden_cmd,
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> advertise-map WORD <exist-map WORD|non-exist-map WORD>",
+ NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Route-map to conditionally advertise routes\n"
+ "Name of advertise map\n"
+ "Advertise routes only if prefixes in exist-map are installed in BGP table\n"
+ "Name of the exist map\n"
+ "Advertise routes only if prefixes in non-exist-map are not installed in BGP table\n"
+ "Name of the non exist map\n")
/* Set route-map to the peer. */
static int peer_route_map_set_vty(struct vty *vty, const char *ip_str,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 1264d0dfb..652c6809a 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -4908,7 +4908,7 @@ void peer_port_unset(struct peer *peer)
* initiates inbound or outbound processing as needed.
*/
void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi,
- int outbound)
+ int outbound)
{
if (outbound) {
update_group_adjust_peer(peer_af_find(peer, afi, safi));
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 5cff254b3..4ef2f841e 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -763,8 +763,8 @@ struct bgp_nexthop {
#define BGP_GTSM_HOPS_CONNECTED 1
/* Advertise map */
-#define CONDITION_NON_EXIST 0
-#define CONDITION_EXIST 1
+#define CONDITION_NON_EXIST 0
+#define CONDITION_EXIST 1
#include "filter.h"
@@ -1375,7 +1375,7 @@ struct peer {
#define PEER_FT_PREFIX_LIST (1U << 2) /* prefix-list */
#define PEER_FT_ROUTE_MAP (1U << 3) /* route-map */
#define PEER_FT_UNSUPPRESS_MAP (1U << 4) /* unsuppress-map */
-#define PEER_FT_ADVERTISE_MAP (1U << 5) /* advertise-map */
+#define PEER_FT_ADVERTISE_MAP (1U << 5) /* advertise-map */
/* ORF Prefix-list */
struct prefix_list *orf_plist[AFI_MAX][SAFI_MAX];
@@ -2217,6 +2217,6 @@ DECLARE_HOOK(peer_status_changed, (struct peer * peer), (peer))
void peer_nsf_stop(struct peer *peer);
extern void peer_on_policy_change(struct peer *peer, afi_t afi, safi_t safi,
- int outbound);
+ int outbound);
#endif /* _QUAGGA_BGPD_H */
If you are a new contributor to FRR, please see our contributing guidelines.
After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: FailedOpenBSD 6 amd64 build: Failed (click for details)Make failed for OpenBSD 6 amd64 build:
OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14403/artifact/CI011BUILD/config.status/config.status Successful on other platforms/tests
Warnings Generated during build:Checkout code: Successful with additional warningsOpenBSD 6 amd64 build: Failed (click for details)Make failed for OpenBSD 6 amd64 build:
OpenBSD 6 amd64 build: config.status output from configure script can be found at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14403/artifact/CI011BUILD/config.status/config.status
Warnings Generated during build:Ubuntu 18.04 amd64 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 amd64 build:
Ubuntu 18.04 ppc64le build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 ppc64le build:
Debian 9 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 9 amd64 build:
Ubuntu 18.04 arm7 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 arm7 build:
Ubuntu 18.04 arm8 build: Successful with additional warningsDebian Package lintian failed for Ubuntu 18.04 arm8 build:
Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, but the PR itself lacks some items:
- Documentation
- Tests
I added some comments to help clarifying some parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code more or less looks good, just some questions from me. Docs+topotests are missing. CI warnings must be addressed as well.
This is 1k of change in 1 commit. Is there any way that this commit could be broken up into smaller logical units? I am also going to echo the doc + topotest changes. We must have them before this code change can be accepted. |
Sure will do that. |
Ok. Will try to send asap. Thanks! |
021212d
to
2d1c29a
Compare
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULContinuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14436/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
CLANG Static Analyzer Summary
2 Static Analyzer issues remaining.See details at |
2d1c29a
to
9bbb509
Compare
@donaldsharp |
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopo tests part 0 on Ubuntu 18.04 arm8: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPO0U18ARM8-14487/test Topology Tests failed for Topo tests part 0 on Ubuntu 18.04 arm8 Successful on other platforms/tests
Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
@maduri111 To fix the errors in the topotests, please rebase to latest master. A few fixes just got merged into master which should resolve these issues |
9bbb509
to
57d2546
Compare
Done. Thank you |
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: FAILEDContinuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopo tests part 0 on Ubuntu 16.04 i386: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPOI386-14497/test Topology Tests failed for Topo tests part 0 on Ubuntu 16.04 i386:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14497/artifact/TOPOI386/ErrorLog/log_topotests.txt Successful on other platforms/tests
Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
57d2546
to
ba5e6f8
Compare
Outdated results 💚Basic BGPD CI results: SUCCESS, 0 tests failed
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULContinuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14505/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14957/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
0db41ae
to
f29787b
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
f29787b
to
c94dc3a
Compare
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14979/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: FAILEDSee below for issues. This is a comment from an automated CI system. Get source / Pull Request: SuccessfulBuilding Stage: SuccessfulBasic Tests: FailedTopo tests part 0 on Ubuntu 18.04 amd64: Failed (click for details)Topology Test Results are at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-TOPOU1804-14983/test Topology Tests failed for Topo tests part 0 on Ubuntu 18.04 amd64:
see full log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14983/artifact/TOPOU1804/ErrorLog/log_topotests.txt Successful on other platforms/tests
Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
ci:rerun |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14989/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @maduri111 thanks.
@ton31337 Thanks for reviewing and approving the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just two nits in topotest:
- Author forgot to change copyright owner
- The tests could be split in more functions to help finding a failure, but I guess it is also easy to search for
TCXX
(where XX is a number).
tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py
Outdated
Show resolved
Hide resolved
Implemented as per the feature description given in the source link. Descriprion: The BGP conditional advertisement feature uses the non-exist-map or exist-map and the advertise-map keywords of the neighbor advertise-map command in order to track routes by the route prefix. non-exist-map : If a route prefix is not present in output of the non-exist-map command, then the route specified by the advertise-map command is announced. exist-map : If a route prefix is present in output of the exist-map command, then the route specified by the advertise-map command is announced. The conditional BGP announcements are sent in addition to the normal announcements that a BGP router sends to its peers. The conditional advertisement process is triggered by the BGP scanner process, which runs every 60 seconds. This means that the maximum time for the conditional advertisement to take effect is 60 seconds. The conditional advertisement can take effect sooner, depending on when the tracked route is removed from the BGP table and when the next instance of the BGP scanner occurs. Sample Configuration on DUT --------------------------- Router2# show running-config Building configuration... Current configuration: ! frr version 7.6-dev-MyOwnFRRVersion frr defaults traditional hostname router log file /var/log/frr/bgpd.log log syslog informational hostname Router2 service integrated-vtysh-config ! debug bgp updates in debug bgp updates out ! debug route-map ! ip route 200.200.0.0/16 blackhole ipv6 route 2001:db8::200/128 blackhole ! interface enp0s9 ip address 10.10.10.2/24 ! interface enp0s10 ip address 10.10.20.2/24 ! interface lo ip address 2.2.2.2/24 ipv6 address 2001:db8::2/128 ! router bgp 2 bgp log-neighbor-changes no bgp ebgp-requires-policy neighbor 10.10.10.1 remote-as 1 neighbor 10.10.20.3 remote-as 3 ! address-family ipv4 unicast network 2.2.2.0/24 network 200.200.0.0/16 neighbor 10.10.10.1 soft-reconfiguration inbound neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION neighbor 10.10.20.3 soft-reconfiguration inbound exit-address-family ! address-family ipv6 unicast network 2001:db8::2/128 network 2001:db8::200/128 neighbor 10.10.10.1 activate neighbor 10.10.10.1 soft-reconfiguration inbound neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6 neighbor 10.10.20.3 activate neighbor 10.10.20.3 soft-reconfiguration inbound exit-address-family ! access-list CONDITION seq 5 permit 3.3.3.0/24 access-list ADVERTISE seq 5 permit 2.2.2.0/24 access-list ADVERTISE seq 6 permit 200.200.0.0/16 access-list ADVERTISE seq 7 permit 20.20.0.0/16 ! ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128 ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128 ! route-map ADVERTISE permit 10 match ip address ADVERTISE ! route-map CONDITION permit 10 match ip address CONDITION ! route-map ADVERTISE_6 permit 10 match ipv6 address ADVERTISE_6 ! route-map CONDITION_6 permit 10 match ipv6 address CONDITION_6 ! line vty ! end Router2# Withdraw when non-exist-map prefixes present in BGP table: ---------------------------------------------------------- Router2# show ip bgp all wide For address family: IPv4 Unicast BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 10.10.10.1 0 0 1 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 3.3.3.0/24 10.10.20.3 0 0 3 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Displayed 4 routes and 4 total paths For address family: IPv6 Unicast BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i *> 2001:db8::2/128 :: 0 32768 i *> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i *> 2001:db8::200/128 :: 0 32768 i Displayed 4 routes and 4 total paths Router2# Router2# show ip bgp neighbors 10.10.10.1 BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link !--- Output suppressed. For address family: IPv4 Unicast Update group 9, subgroup 5 Packet Queue length 0 Inbound soft reconfiguration allowed Community attribute sent to this neighbor(all) Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw 1 accepted prefixes For address family: IPv6 Unicast Update group 10, subgroup 6 Packet Queue length 0 Inbound soft reconfiguration allowed Community attribute sent to this neighbor(all) Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Withdraw 1 accepted prefixes !--- Output suppressed. Router2# Here 2.2.2.0/24 & 200.200.0.0/16 (prefixes in advertise-map) are withdrawn by conditional advertisement scanner as the prefix(3.3.3.0/24) specified by non-exist-map is present in BGP table. Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide For address family: IPv4 Unicast BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 0.0.0.0 0 1 i *> 3.3.3.0/24 0.0.0.0 0 3 i Total number of prefixes 2 For address family: IPv6 Unicast BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 1 i *> 2001:db8::3/128 :: 0 3 i *> 2001:db8::200/128 :: 0 32768 i Total number of prefixes 3 Router2# Advertise when non-exist-map prefixes not present in BGP table: --------------------------------------------------------------- After Removing 3.3.3.0/24 (prefix present in non-exist-map), 2.2.2.0/24 & 200.200.0.0/16 (prefixes present in advertise-map) are advertised Router2# show ip bgp all wide For address family: IPv4 Unicast BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 10.10.10.1 0 0 1 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Displayed 3 routes and 3 total paths For address family: IPv6 Unicast BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i *> 2001:db8::2/128 :: 0 32768 i *> 2001:db8::200/128 :: 0 32768 i Displayed 3 routes and 3 total paths Router2# Router2# show ip bgp neighbors 10.10.10.1 !--- Output suppressed. For address family: IPv4 Unicast Update group 9, subgroup 5 Packet Queue length 0 Inbound soft reconfiguration allowed Community attribute sent to this neighbor(all) Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Advertise 1 accepted prefixes For address family: IPv6 Unicast Update group 10, subgroup 6 Packet Queue length 0 Inbound soft reconfiguration allowed Community attribute sent to this neighbor(all) Condition NON_EXIST, Condition-map *CONDITION_6, Advertise-map *ADVERTISE_6, status: Advertise 1 accepted prefixes !--- Output suppressed. Router2# Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide For address family: IPv4 Unicast BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 0.0.0.0 0 1 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Total number of prefixes 3 For address family: IPv6 Unicast BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 :: 0 1 i *> 2001:db8::2/128 :: 0 32768 i *> 2001:db8::200/128 :: 0 32768 i Total number of prefixes 3 Router2# Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Sample configuration along with route-map filter ------------------------------------------------ Router2# show running-config Building configuration... Current configuration: ! frr version 7.6-dev-MyOwnFRRVersion frr defaults traditional hostname router log file /var/log/frr/bgpd.log log syslog informational hostname Router2 service integrated-vtysh-config ! debug bgp updates in debug bgp updates out ! debug route-map ! ip route 200.200.0.0/16 blackhole ipv6 route 2001:db8::200/128 blackhole ! interface enp0s9 ip address 10.10.10.2/24 ! interface enp0s10 ip address 10.10.20.2/24 ! interface lo ip address 2.2.2.2/24 ipv6 address 2001:db8::2/128 ! router bgp 2 bgp log-neighbor-changes no bgp ebgp-requires-policy neighbor 10.10.10.1 remote-as 1 neighbor 10.10.20.3 remote-as 3 ! address-family ipv4 unicast network 2.2.2.0/24 network 200.200.0.0/16 neighbor 10.10.10.1 soft-reconfiguration inbound neighbor 10.10.10.1 route-map RMAP_PERMIT_100 out neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION neighbor 10.10.20.3 soft-reconfiguration inbound exit-address-family ! address-family ipv6 unicast network 2001:db8::2/128 network 2001:db8::200/128 neighbor 10.10.10.1 activate neighbor 10.10.10.1 soft-reconfiguration inbound neighbor 10.10.10.1 route-map CONDITION_6 out neighbor 10.10.10.1 advertise-map ADVERTISE_6 non-exist-map CONDITION_6 neighbor 10.10.20.3 activate neighbor 10.10.20.3 soft-reconfiguration inbound exit-address-family ! access-list CONDITION seq 5 permit 3.3.3.0/24 access-list ADVERTISE seq 6 permit 200.200.0.0/16 access-list ADVERTISE seq 7 permit 20.20.0.0/16 access-list ADVERTISE seq 5 permit 2.2.2.0/24 access-list RMAP_PERMIT_100 seq 4 permit 100.100.0.0/16 ! ipv6 access-list ADVERTISE_6 seq 5 permit 2001:db8::2/128 ipv6 access-list CONDITION_6 seq 5 permit 2001:db8::3/128 ! route-map ADVERTISE permit 10 match ip address ADVERTISE ! route-map CONDITION permit 10 match ip address CONDITION ! route-map ADVERTISE_6 permit 10 match ipv6 address ADVERTISE_6 ! route-map CONDITION_6 permit 10 match ipv6 address CONDITION_6 ! route-map RMAP_PERMIT_100 permit 10 match ip address RMAP_PERMIT_100 ! line vty ! end Sample output when non-exist-map prefixes present in BGP table -------------------------------------------------------------- Router2# show ip bgp all wide For address family: IPv4 Unicast BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 10.10.10.1 0 0 1 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 3.3.3.0/24 10.10.20.3 0 0 3 i *> 100.100.0.0/16 10.10.20.3 0 0 3 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Displayed 5 routes and 5 total paths For address family: IPv6 Unicast BGP table version is 4, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i *> 2001:db8::2/128 :: 0 32768 i *> 2001:db8::3/128 fe80::a00:27ff:fe76:6738 0 0 3 i *> 2001:db8::200/128 :: 0 32768 i Displayed 4 routes and 4 total paths Router2# Router2# Router2# Router2# Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide For address family: IPv4 Unicast BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 100.100.0.0/16 0.0.0.0 0 3 i Total number of prefixes 1 For address family: IPv6 Unicast BGP table version is 4, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::3/128 :: 0 3 i Total number of prefixes 1 Router2# Sample output when non-exist-map prefixes not present in BGP table ------------------------------------------------------------------ Router2# show ip bgp all wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 10.10.10.1 0 0 1 i *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 100.100.0.0/16 10.10.20.3 0 0 3 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Displayed 4 routes and 4 total paths For address family: IPv6 Unicast BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::1/128 fe80::a00:27ff:fecb:ad57 0 0 1 i *> 2001:db8::2/128 :: 0 32768 i *> 2001:db8::200/128 :: 0 32768 i Displayed 3 routes and 3 total paths Router2# Router2# show ip bgp all neighbors 10.10.10.1 advertised-routes wide For address family: IPv4 Unicast BGP table version is 6, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2.2.2.0/24 0.0.0.0 0 32768 i *> 100.100.0.0/16 0.0.0.0 0 3 i *> 200.200.0.0/16 0.0.0.0 0 32768 i Total number of prefixes 3 For address family: IPv6 Unicast BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 2001:db8::2/128 :: 0 32768 i Total number of prefixes 1 Router2# Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Sample Configuration with prefix-list and community match rules --------------------------------------------------------------- R1 ------- R2(DUT) ------- R3 Router2# show running-config Building configuration... Current configuration: ! frr version 7.6-dev-MyOwnFRRVersion frr defaults traditional hostname router log file /var/log/frr/bgpd.log log syslog informational hostname Router2 service integrated-vtysh-config ! debug bgp updates in debug bgp updates out ! debug route-map ! ip route 20.20.0.0/16 blackhole ipv6 route 2001:db8::200/128 blackhole ! interface enp0s9 ip address 10.10.10.2/24 ! interface enp0s10 ip address 10.10.20.2/24 ! interface lo ip address 2.2.2.2/32 ! router bgp 2 bgp log-neighbor-changes no bgp ebgp-requires-policy neighbor 10.10.10.1 remote-as 1 neighbor 10.10.20.3 remote-as 3 ! address-family ipv4 unicast neighbor 10.10.10.1 soft-reconfiguration inbound neighbor 10.10.20.3 soft-reconfiguration inbound neighbor 10.10.20.3 advertise-map ADV-MAP non-exist-map EXIST-MAP exit-address-family ! ip prefix-list DEFAULT seq 5 permit 1.1.1.5/32 ip prefix-list DEFAULT seq 10 permit 1.1.1.1/32 ip prefix-list EXIST seq 5 permit 10.10.10.10/32 ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0 ip prefix-list IP1 seq 5 permit 10.139.224.0/20 ip prefix-list T2 seq 5 permit 1.1.1.5/32 ! bgp community-list standard DC-ROUTES seq 5 permit 64952:3008 bgp community-list standard DC-ROUTES seq 10 permit 64671:501 bgp community-list standard DC-ROUTES seq 15 permit 64950:3009 bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200 ! route-map ADV-MAP permit 10 match ip address prefix-list IP1 ! route-map ADV-MAP permit 20 match community DC-ROUTES ! route-map EXIST-MAP permit 10 match community DEFAULT-ROUTE match ip address prefix-list DEFAULT-ROUTE ! line vty ! end Router2# Router2# show ip bgp 0.0.0.0 BGP routing table entry for 0.0.0.0/0 Paths: (1 available, best FRRouting#1, table default) Advertised to non peer-group peers: 10.10.10.1 10.10.20.3 1 10.10.10.1 from 10.10.10.1 (10.139.224.1) Origin IGP, metric 0, valid, external, best (First path received) Community: 64848:3011 65011:200 65013:200 Last update: Tue Oct 6 02:39:42 2020 Router2# Sample output with non-exist-map when default route present in table -------------------------------------------------------------------- Router2# show ip bgp BGP table version is 4, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0/0 10.10.10.1 0 0 1 i *> 1.1.1.1/32 10.10.10.1 0 0 1 i *> 1.1.1.5/32 10.10.10.1 0 0 1 i *> 10.139.224.0/20 10.10.10.1 0 0 1 ? Displayed 4 routes and 4 total paths Router2# show ip bgp neighbors 10.10.20.3 advertised-routes BGP table version is 4, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0/0 0.0.0.0 0 1 i *> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< non-exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 not advertised Total number of prefixes 2 Sample output with non-exist-map when default route not present in table ------------------------------------------------------------------------ Router2# show ip bgp BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 10.10.10.1 0 0 1 i *> 1.1.1.5/32 10.10.10.1 0 0 1 i *> 10.139.224.0/20 10.10.10.1 0 0 1 ? Displayed 3 routes and 3 total paths Router2# Router2# Router2# show ip bgp neighbors 10.10.20.3 advertised-routes BGP table version is 5, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 0.0.0.0 0 1 i *> 1.1.1.5/32 0.0.0.0 0 1 i *> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< non-exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 advertised Total number of prefixes 3 Router2# Sample output with exist-map when default route present in table -------------------------------------------------------------------- Router2# show ip bgp BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0/0 10.10.10.1 0 0 1 i *> 1.1.1.1/32 10.10.10.1 0 0 1 i *> 1.1.1.5/32 10.10.10.1 0 0 1 i *> 10.139.224.0/20 10.10.10.1 0 0 1 ? Displayed 4 routes and 4 total paths Router2# Router2# Router2# Router2# Router2# show ip bgp neighbors 10.10.20.3 advertised-routes BGP table version is 8, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0/0 0.0.0.0 0 1 i *> 1.1.1.1/32 0.0.0.0 0 1 i *> 1.1.1.5/32 0.0.0.0 0 1 i *> 10.139.224.0/20 0.0.0.0 0 1 ? <<<<<<<<< exist-map : 0.0.0.0/0 is present so, 10.139.224.0/20 advertised Total number of prefixes 4 Router2# Sample output with exist-map when default route not present in table -------------------------------------------------------------------- Router2# show ip bgp BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.1/32 10.10.10.1 0 0 1 i *> 1.1.1.5/32 10.10.10.1 0 0 1 i *> 10.139.224.0/20 10.10.10.1 0 0 1 ? Displayed 3 routes and 3 total paths Router2# Router2# Router2# Router2# show ip bgp neighbors 10.10.20.3 advertised-routes BGP table version is 9, local router ID is 2.2.2.2, vrf id 0 Default local pref 100, local AS 2 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 1.1.1.5/32 0.0.0.0 0 1 i <<<<<<<<< exist-map : 0.0.0.0/0 is not present so, 10.139.224.0/20 not advertised Total number of prefixes 1 Router2# Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Router2# show ip bgp neighbors 10.10.20.3 json !--- Output suppressed. "addressFamilyInfo":{ "ipv4Unicast":{ "updateGroupId":2, "subGroupId":2, "packetQueueLength":0, "inboundSoftConfigPermit":true, "commAttriSentToNbr":"extendedAndStandard", "advertiseMap":{ "condition":"NON_EXIST", "conditionMap":"EXIST-MAP", "advertiseMap":"ADV-MAP", "advertiseStatus":"Withdraw" }, "acceptedPrefixCounter":0, "sentPrefixCounter":2 }, "ipv6Unicast":{ "inboundSoftConfigPermit":true, "commAttriSentToNbr":"extendedAndStandard", "advertiseMap":{ "condition":"EXIST", "conditionMap":"ALLOW_ALL", "advertiseMap":"ALLOW_ALL", "advertiseStatus":"Advertise" }, "acceptedPrefixCounter":0 } }, !--- Output suppressed. router@router:~/frr/tests/topotests/bgp_conditional_advertisement$ sudo pytest -s test_bgp_conditional_advertisement.py [sudo] password for router: mkdir: cannot create directory ‘/tmp/topotests’: File exists 2020-10-14 17:00:46,649 INFO: Running environment diagnostics =========================================================================================== test session starts ============================================================================================ platform linux2 -- Python 2.7.17, pytest-4.6.11, py-1.9.0, pluggy-0.13.1 rootdir: /home/router/frr/tests/topotests, inifile: pytest.ini collected 2 items test_bgp_conditional_advertisement.py 2020-10-14 17:00:47,137 INFO: Testsuite start time: Wed Oct 14 17:00:47 2020 2020-10-14 17:00:47,137 INFO: ======================================== 2020-10-14 17:00:47,138 INFO: Running setup_module to create topology 2020-10-14 17:00:48,711 INFO: loading topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement 2020-10-14 17:00:48,712 INFO: starting topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement 2020-10-14 17:00:49,042 INFO: r1: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0 2020-10-14 17:00:51,284 INFO: r2: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0 2020-10-14 17:00:53,582 INFO: r3: running version: 7.6-dev-MyOwnFRRVersion-gd77fe2dd0 2020-10-14 17:00:55,826 INFO: Running setup_module() done 2020-10-14 17:00:57,747 INFO: '_all_routes_advertised' polling started (interval 1 secs, maximum wait 130 secs) 2020-10-14 17:00:58,262 INFO: '_all_routes_advertised' succeeded after 0.52 seconds 2020-10-14 17:00:58,262 INFO: TC11: "router3" BGP convergence - PASSED!!! 2020-10-14 17:00:58,863 INFO: '_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:00:59,419 INFO: '_exist_map_routes_present' succeeded after 0.56 seconds 2020-10-14 17:00:59,419 INFO: TC21: exist-map routes present in "router2" BGP table - PASSED!!! 2020-10-14 17:01:00,017 INFO: '_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:02:00,192 INFO: '_exist_map_routes_not_present' succeeded after 60.18 seconds 2020-10-14 17:02:00,192 INFO: TC22: exist-map routes not present in "router2" BGP table - PASSED!!! 2020-10-14 17:02:00,736 INFO: '_non_exist_map_routes_not_present' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:02:59,215 INFO: '_non_exist_map_routes_not_present' succeeded after 58.48 seconds 2020-10-14 17:02:59,215 INFO: TC31: non-exist-map routes not present in "router2" BGP table - PASSED!!! 2020-10-14 17:02:59,968 INFO: '_non_exist_map_routes_present' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:03:59,300 INFO: '_non_exist_map_routes_present' succeeded after 59.33 seconds 2020-10-14 17:03:59,300 INFO: TC32: non-exist-map routes present in "router2" BGP table - PASSED!!! 2020-10-14 17:03:59,919 INFO: '_non_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:05:00,306 INFO: '_non_exist_map_no_condition_route_map' succeeded after 60.39 seconds 2020-10-14 17:05:00,306 INFO: TC41: non-exist-map route-map removed in "router2" - PASSED!!! 2020-10-14 17:05:01,024 INFO: '_exist_map_no_condition_route_map' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:05:59,405 INFO: '_exist_map_no_condition_route_map' succeeded after 58.38 seconds 2020-10-14 17:05:59,406 INFO: TC42: exist-map route-map removed in "router2" - PASSED!!! 2020-10-14 17:05:59,941 INFO: '_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:06:59,622 INFO: '_exist_map_routes_present_rmap_filter' succeeded after 59.68 seconds 2020-10-14 17:06:59,622 INFO: TC51: exist-map routes present with route-map filter - PASSED!!! 2020-10-14 17:07:00,150 INFO: '_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:07:00,688 INFO: '_exist_map_routes_present_no_rmap_filter' succeeded after 0.54 seconds 2020-10-14 17:07:00,688 INFO: TC52: exist-map routes present, no route-map filter - PASSED!!! 2020-10-14 17:07:01,229 INFO: '_non_exist_map_routes_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:07:01,767 INFO: '_non_exist_map_routes_present_rmap_filter' succeeded after 0.54 seconds 2020-10-14 17:07:01,767 INFO: TC53: non-exist-map routes present, with route-map filter - PASSED!!! 2020-10-14 17:07:02,321 INFO: '_non_exist_map_routes_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:08:00,419 INFO: '_non_exist_map_routes_present_no_rmap_filter' succeeded after 58.10 seconds 2020-10-14 17:08:00,419 INFO: TC54: non-exist-map routes present, no route-map filter - PASSED!!! 2020-10-14 17:08:01,485 INFO: '_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:08:02,039 INFO: '_exist_map_routes_not_present_rmap_filter' succeeded after 0.55 seconds 2020-10-14 17:08:02,039 INFO: TC61: exist-map routes not present, route-map filter - PASSED!!! 2020-10-14 17:08:02,568 INFO: '_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:08:59,147 INFO: '_exist_map_routes_not_present_no_rmap_filter' succeeded after 56.58 seconds 2020-10-14 17:08:59,147 INFO: TC62: exist-map routes not present, no route-map filter - PASSED!!! 2020-10-14 17:08:59,686 INFO: '_non_exist_map_routes_not_present_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:09:59,354 INFO: '_non_exist_map_routes_not_present_rmap_filter' succeeded after 59.67 seconds 2020-10-14 17:09:59,354 INFO: TC63: non-exist-map routes not present, route-map filter - PASSED!!! 2020-10-14 17:09:59,886 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' polling started (interval 1 secs, maximum wait 90 secs) 2020-10-14 17:10:00,424 INFO: '_non_exist_map_routes_not_present_no_rmap_filter' succeeded after 0.54 seconds 2020-10-14 17:10:00,424 INFO: TC64: non-exist-map routes not present, no route-map filter - PASSED!!! .2020-10-14 17:10:01,989 INFO: assert skipped at "bgp_conditional_advertisement.test_bgp_conditional_advertisement/test_memory_leak": Memory leak test/report is disabled s2020-10-14 17:10:01,989 INFO: Running teardown_module to delete topology 2020-10-14 17:10:01,990 INFO: stopping topology: bgp_conditional_advertisement.test_bgp_conditional_advertisement 2020-10-14 17:10:01,990 INFO: stopping "s2" 2020-10-14 17:10:01,990 INFO: stopping "s1" 2020-10-14 17:10:01,993 INFO: r1: stopping bgpd 2020-10-14 17:10:01,995 INFO: r1: stopping staticd 2020-10-14 17:10:02,010 INFO: r1: stopping zebra 2020-10-14 17:10:02,013 INFO: r1: stopping bgpd 2020-10-14 17:10:02,015 INFO: r1: stopping zebra 2020-10-14 17:10:02,025 INFO: r1: waiting for daemons stopping: bgpd, zebra (0.1 seconds) 2020-10-14 17:10:02,143 INFO: r2: stopping bgpd 2020-10-14 17:10:02,147 INFO: r2: stopping staticd 2020-10-14 17:10:02,152 INFO: r2: stopping zebra 2020-10-14 17:10:02,156 INFO: r2: stopping bgpd 2020-10-14 17:10:02,164 INFO: r2: stopping zebra 2020-10-14 17:10:02,175 INFO: r2: waiting for daemons stopping: zebra (0.1 seconds) 2020-10-14 17:10:02,291 INFO: r3: stopping bgpd 2020-10-14 17:10:02,302 INFO: r3: stopping staticd 2020-10-14 17:10:02,309 INFO: r3: stopping zebra 2020-10-14 17:10:02,313 INFO: r3: stopping bgpd 2020-10-14 17:10:02,316 INFO: r3: stopping zebra 2020-10-14 17:10:02,323 INFO: r3: waiting for daemons stopping: zebra (0.1 seconds) 2020-10-14 17:10:03,615 INFO: Testsuite end time: Wed Oct 14 17:10:03 2020 2020-10-14 17:10:03,615 INFO: ======================================== ================================================================================== 1 passed, 1 skipped in 556.55 seconds =================================================================================== Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com> temp Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
Signed-off-by: Madhuri Kuruganti <k.madhuri@samsung.com>
c94dc3a
to
1a0416b
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-14995/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
Implemented as per the feature description given in the source link.
Descriprion:
The BGP conditional advertisement feature uses the non-exist-map or exist-map
and the advertise-map keywords of the neighbor advertise-map command in order
to track routes by the route prefix.
non-exist-map :
If a route prefix is not present in output of the non-exist-map command, then
the route specified by the advertise-map command is announced.
exist-map :
If a route prefix is present in output of the exist-map command, then the route
specified by the advertise-map command is announced.
The conditional BGP announcements are sent in addition to the normal
announcements that a BGP router sends to its peers.
The conditional advertisement process is triggered by the BGP scanner process,
which runs every 60 seconds. This means that the maximum time for the conditional
advertisement to take effect is 60 seconds. The conditional advertisement can take
effect sooner, depending on when the tracked route is removed from the BGP table
and when the next instance of the BGP scanner occurs.
Sample Configuration on DUT
Router2# show running-config
Building configuration...
Current configuration:
!
frr version 7.6-dev-MyOwnFRRVersion
frr defaults traditional
hostname router
log file /var/log/frr/bgpd.log
log syslog informational
hostname Router2
service integrated-vtysh-config
!
debug bgp updates in
debug bgp updates out
!
debug route-map
!
ip route 130.130.0.0/16 blackhole
!
interface enp0s9
ip address 10.10.10.2/24
!
interface enp0s10
ip address 10.10.20.2/24
!
interface lo
ip address 128.16.16.1/24
!
router bgp 2
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 10.10.10.1 remote-as 1
neighbor 10.10.20.3 remote-as 3
!
address-family ipv4 unicast
network 128.16.16.0/24
network 130.130.0.0/16
neighbor 10.10.10.1 soft-reconfiguration inbound
neighbor 10.10.10.1 advertise-map ADVERTISE non-exist-map CONDITION
neighbor 10.10.20.3 soft-reconfiguration inbound
exit-address-family
!
access-list 60 seq 5 permit 128.16.16.0/24 exact-match
access-list 65 seq 5 permit 192.168.50.0/24 exact-match
access-list CONDITION seq 5 permit 192.168.50.0/24
access-list ADVERTISE seq 5 permit 128.16.16.0/24
!
route-map ADVERTISE permit 10
match ip address ADVERTISE
!
route-map CONDITION permit 10
match ip address CONDITION
!
line vty
!
end
Router2#
Sample output
Router2# show ip bgp neighbors 10.10.10.1
BGP neighbor is 10.10.10.1, remote AS 1, local AS 2, external link
!--- Output suppressed.
For address family: IPv4 Unicast
Update group 1, subgroup 1
Packet Queue length 0
Inbound soft reconfiguration allowed
Community attribute sent to this neighbor(all)
Condition NON_EXIST, Condition-map *CONDITION, Advertise-map *ADVERTISE, status: Withdraw
1 accepted prefixes
Connections established 1; dropped 0
Last reset 00:21:05, Waiting for peer OPEN
!--- Output suppressed.
Router2#
Router2# show ip bgp
BGP table version is 6, local router ID is 128.16.16.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 128.16.16.0/24 0.0.0.0 0 32768 i
*> 130.130.0.0/16 0.0.0.0 0 32768 i
*> 192.168.50.0/24 10.10.20.3 0 0 3 i
*> 200.200.200.0/24 10.10.10.1 0 0 1 i
Displayed 4 routes and 4 total paths
Router2#
Here 128.16.16.0/24(prefix in advertise-map) is withdrawn by conditional
advertisement scanner as the prefix(192.168.50.0/24) specified by
non-exist-map is present in BGP table.
Router2# show ip bgp neighbors 10.10.10.1 advertised-routes
BGP table version is 6, local router ID is 128.16.16.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 130.130.0.0/16 0.0.0.0 0 32768 i
*> 192.168.50.0/24 0.0.0.0 0 3 i
*> 200.200.200.0/24 0.0.0.0 0 1 i
Total number of prefixes 3
Router2#
After Removing 192.168.50.0/24(prefix present in non-exist-map), prefix present in
advertise-map(128.16.16.0/24) is advertised
Router2# show ip bgp
BGP table version is 7, local router ID is 128.16.16.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 128.16.16.0/24 0.0.0.0 0 32768 i
*> 130.130.0.0/16 0.0.0.0 0 32768 i
*> 200.200.200.0/24 10.10.10.1 0 0 1 i
Displayed 3 routes and 3 total paths
Router2#
Router2#
Router2# show ip bgp neighbors 10.10.10.1 advertised-routes
BGP table version is 7, local router ID is 128.16.16.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 128.16.16.0/24 0.0.0.0 0 32768 i
*> 130.130.0.0/16 0.0.0.0 0 32768 i
*> 200.200.200.0/24 0.0.0.0 0 1 i
Total number of prefixes 3
Router2#
Router2#
Router2#
Signed-off-by: Madhuri Kuruganti k.madhuri@samsung.com