From d867a1d5d2902ec600633fff081a790c5f9acb6c Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 16 Nov 2022 11:36:37 +0000 Subject: [PATCH 1/8] [BGP] support BGP pending FIB suppression Signed-off-by: Stepan Blyschak --- .../docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 5 +- .../frr/supervisord/supervisord.conf.j2 | 2 +- ...003-Use-vrf_id-for-vrf-not-tabled_id.patch | 41 --- ...rk-XXX-to-work-with-bgp-suppress-fib.patch | 190 ++++++++++++++ ...rn-statements-do-not-use-paranthesis.patch | 27 ++ ...er.asic_notification_nexthop_control.patch | 205 +++++++++++++++ ...-fpm_read-to-reduce-code-duplication.patch | 56 ++++ ...8-zebra-Add-dplane_ctx_get-set_flags.patch | 78 ++++++ ...ebra-Rearrange-dplane_ctx_route_init.patch | 135 ++++++++++ ...a-Add-ctx-to-netlink-message-parsing.patch | 155 +++++++++++ ...rom-the-dplane_fpm_nl-a-route-update.patch | 247 ++++++++++++++++++ ...022-Use-vrf_id-for-vrf-not-tabled_id.patch | 103 ++++++++ src/sonic-frr/patch/series | 11 +- .../tests/device_metadata.json | 11 +- .../tests_config/device_metadata.json | 30 +++ .../yang-models/sonic-device_metadata.yang | 13 + 16 files changed, 1263 insertions(+), 46 deletions(-) delete mode 100644 src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch create mode 100644 src/sonic-frr/patch/0014-bgpd-Allow-network-XXX-to-work-with-bgp-suppress-fib.patch create mode 100644 src/sonic-frr/patch/0015-zebra-Return-statements-do-not-use-paranthesis.patch create mode 100644 src/sonic-frr/patch/0016-zebra-Add-zrouter.asic_notification_nexthop_control.patch create mode 100644 src/sonic-frr/patch/0017-zebra-Re-arrange-fpm_read-to-reduce-code-duplication.patch create mode 100644 src/sonic-frr/patch/0018-zebra-Add-dplane_ctx_get-set_flags.patch create mode 100644 src/sonic-frr/patch/0019-zebra-Rearrange-dplane_ctx_route_init.patch create mode 100644 src/sonic-frr/patch/0020-zebra-Add-ctx-to-netlink-message-parsing.patch create mode 100644 src/sonic-frr/patch/0021-zebra-Read-from-the-dplane_fpm_nl-a-route-update.patch create mode 100644 src/sonic-frr/patch/0022-Use-vrf_id-for-vrf-not-tabled_id.patch diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index 4cee01ac973..05b69458f3d 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -11,7 +11,7 @@ ip prefix-list PL_LoopbackV4 permit {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 ! {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %} -{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and +{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['bgp_adv_lo_prefix_as_128'] == 'true') ) %} ipv6 prefix-list PL_LoopbackV6 permit {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip_network }}/128 {% else %} @@ -66,6 +66,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% block bgp_init %} bgp log-neighbor-changes + bgp suppress-fib-pendinng no bgp default ipv4-unicast no bgp ebgp-requires-policy ! @@ -95,7 +96,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %} address-family ipv6 -{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and +{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['bgp_adv_lo_prefix_as_128'] == 'true') ) %} network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/128 {% else %} diff --git a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 index f2c437cb797..e7a0616f951 100644 --- a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 +++ b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 @@ -30,7 +30,7 @@ stderr_logfile=syslog dependent_startup=true [program:zebra] -command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl -M snmp +command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M dplane_fpm_nl -M snmp --asic-offload=notify_on_offload priority=4 autostart=false autorestart=false diff --git a/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch deleted file mode 100644 index 3e7b8f951b8..00000000000 --- a/src/sonic-frr/patch/0003-Use-vrf_id-for-vrf-not-tabled_id.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e307d456ba0acae53af4b0690c3c0c81b87d51e2 Mon Sep 17 00:00:00 2001 -From: Stepan Blyschak -Date: Thu, 20 Oct 2022 11:03:14 +0000 -Subject: [PATCH 03/15] Use vrf_id for vrf, not tabled_id - -Signed-off-by: Stepan Blyschak ---- - zebra/rt_netlink.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c -index 24c01b7f5..439b10eeb 100644 ---- a/zebra/rt_netlink.c -+++ b/zebra/rt_netlink.c -@@ -1969,12 +1969,17 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, - #endif - /* Table corresponding to this route. */ - table_id = dplane_ctx_get_table(ctx); -- if (table_id < 256) -- req->r.rtm_table = table_id; -- else { -- req->r.rtm_table = RT_TABLE_UNSPEC; -- if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) -- return 0; -+ if (!fpm) { -+ if (table_id < 256) -+ req->r.rtm_table = table_id; -+ else { -+ req->r.rtm_table = RT_TABLE_UNSPEC; -+ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) -+ return 0; -+ } -+ } else { -+ /* Put vrf if_index instead of table id */ -+ req->r.rtm_table = dplane_ctx_get_vrf(ctx); - } - - if (IS_ZEBRA_DEBUG_KERNEL) --- -2.30.2 - diff --git a/src/sonic-frr/patch/0014-bgpd-Allow-network-XXX-to-work-with-bgp-suppress-fib.patch b/src/sonic-frr/patch/0014-bgpd-Allow-network-XXX-to-work-with-bgp-suppress-fib.patch new file mode 100644 index 00000000000..60f1aa4cd35 --- /dev/null +++ b/src/sonic-frr/patch/0014-bgpd-Allow-network-XXX-to-work-with-bgp-suppress-fib.patch @@ -0,0 +1,190 @@ +From 2ce65073a1c2c1a225488287eb886a76149db0a4 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 12 Oct 2022 14:53:21 -0400 +Subject: [PATCH 04/11] bgpd: Allow `network XXX` to work with bgp + suppress-fib-pending + +When bgp is using `bgp suppress-fib-pending` and the end +operator is using network statements, bgp was not sending +the network'ed prefix'es to it's peers. Fix this. + +Also update the test cases for bgp_suppress_fib to test +this new corner case( I am sure that there are going to +be others that will need to be added ). + +Fixes: #12112 +Signed-off-by: Donald Sharp +(cherry picked from commit 4801fc4670020406fc609dedabc7482d88e3b656) +--- + bgpd/bgp_route.h | 20 ++++++++++++++-- + .../bgp_suppress_fib/r1/bgp_ipv4_allowas.json | 2 +- + .../bgp_suppress_fib/r2/bgp_ipv4_allowas.json | 2 +- + tests/topotests/bgp_suppress_fib/r2/bgpd.conf | 2 ++ + .../topotests/bgp_suppress_fib/r2/zebra.conf | 3 +++ + .../bgp_suppress_fib/r3/v4_route3.json | 23 +++++++++++++++++++ + .../bgp_suppress_fib/test_bgp_suppress_fib.py | 14 ++++++++--- + 7 files changed, 59 insertions(+), 7 deletions(-) + create mode 100644 tests/topotests/bgp_suppress_fib/r3/v4_route3.json + +diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h +index a8ec2dc90..003a6cb79 100644 +--- a/bgpd/bgp_route.h ++++ b/bgpd/bgp_route.h +@@ -595,19 +595,35 @@ static inline bool bgp_check_advertise(struct bgp *bgp, struct bgp_dest *dest) + */ + static inline bool bgp_check_withdrawal(struct bgp *bgp, struct bgp_dest *dest) + { +- struct bgp_path_info *pi; ++ struct bgp_path_info *pi, *selected = NULL; + + if (!BGP_SUPPRESS_FIB_ENABLED(bgp)) + return false; + + for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) { +- if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) ++ if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) { ++ selected = pi; + continue; ++ } + + if (pi->sub_type != BGP_ROUTE_NORMAL) + return true; + } + ++ /* ++ * pi is selected and bgp is dealing with a static route ++ * ( ie a network statement of some sort ). FIB installed ++ * is irrelevant ++ * ++ * I am not sure what the above for loop is wanted in this ++ * manner at this point. But I do know that if I have ++ * a static route that is selected and it's the one ++ * being checked for should I withdrawal we do not ++ * want to withdraw the route on installation :) ++ */ ++ if (selected && selected->sub_type == BGP_ROUTE_STATIC) ++ return false; ++ + if (CHECK_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED)) + return false; + +diff --git a/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json b/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json +index bc4d0f479..1a5ede276 100644 +--- a/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json ++++ b/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json +@@ -32,7 +32,7 @@ + ], + "peer":{ + "peerId":"10.0.0.2", +- "routerId":"10.0.0.9", ++ "routerId":"60.0.0.1", + "type":"external" + } + } +diff --git a/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json b/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json +index 16561ce83..4a35abfd6 100644 +--- a/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json ++++ b/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json +@@ -61,7 +61,7 @@ + ], + "peer":{ + "peerId":"0.0.0.0", +- "routerId":"10.0.0.9" ++ "routerId":"60.0.0.1" + } + } + ] +diff --git a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf +index ebef2012a..010e86aad 100644 +--- a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf ++++ b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf +@@ -7,3 +7,5 @@ router bgp 2 + bgp suppress-fib-pending + neighbor 10.0.0.1 remote-as 1 + neighbor 10.0.0.10 remote-as 3 ++ address-family ipv4 uni ++ network 60.0.0.0/24 +\ No newline at end of file +diff --git a/tests/topotests/bgp_suppress_fib/r2/zebra.conf b/tests/topotests/bgp_suppress_fib/r2/zebra.conf +index 443fffc70..6e8bce045 100644 +--- a/tests/topotests/bgp_suppress_fib/r2/zebra.conf ++++ b/tests/topotests/bgp_suppress_fib/r2/zebra.conf +@@ -1,4 +1,7 @@ + ! ++interface lo ++ ip address 60.0.0.1/24 ++! + interface r2-eth0 + ip address 10.0.0.2/30 + ! +diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_route3.json b/tests/topotests/bgp_suppress_fib/r3/v4_route3.json +new file mode 100644 +index 000000000..ab8c3aa5e +--- /dev/null ++++ b/tests/topotests/bgp_suppress_fib/r3/v4_route3.json +@@ -0,0 +1,23 @@ ++{ ++ "60.0.0.0/24":[ ++ { ++ "prefix":"60.0.0.0/24", ++ "protocol":"bgp", ++ "selected":true, ++ "destSelected":true, ++ "distance":20, ++ "metric":0, ++ "installed":true, ++ "table":254, ++ "nexthops":[ ++ { ++ "fib":true, ++ "ip":"10.0.0.9", ++ "afi":"ipv4", ++ "interfaceName":"r3-eth0", ++ "active":true ++ } ++ ] ++ } ++ ] ++} +diff --git a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py +index 2c87d9d7b..96a294cae 100644 +--- a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py ++++ b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py +@@ -84,8 +84,6 @@ def test_bgp_route(): + + r3 = tgen.gears["r3"] + +- sleep(5) +- + json_file = "{}/r3/v4_route.json".format(CWD) + expected = json.loads(open(json_file).read()) + +@@ -95,7 +93,7 @@ def test_bgp_route(): + "show ip route 40.0.0.0 json", + expected, + ) +- _, result = topotest.run_and_expect(test_func, None, count=2, wait=0.5) ++ _, result = topotest.run_and_expect(test_func, None, count=20, wait=0.5) + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + +@@ -112,6 +110,16 @@ def test_bgp_route(): + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + ++ json_file = "{}/r3/v4_route3.json".format(CWD) ++ expected = json.loads(open(json_file).read()) ++ ++ test_func = partial( ++ topotest.router_json_cmp, ++ r3, ++ "show ip route 10.0.0.3 json", ++ expected, ++ ) ++ _, result = topotest.run_and_expect(test_func, None, count=3, wait=0.5) + + def test_bgp_better_admin_won(): + "A better Admin distance protocol may come along and knock us out" +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0015-zebra-Return-statements-do-not-use-paranthesis.patch b/src/sonic-frr/patch/0015-zebra-Return-statements-do-not-use-paranthesis.patch new file mode 100644 index 00000000000..362372b9173 --- /dev/null +++ b/src/sonic-frr/patch/0015-zebra-Return-statements-do-not-use-paranthesis.patch @@ -0,0 +1,27 @@ +From 04a6587629db9d70506d792dacce95a703bf244e Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 5 Oct 2022 10:26:07 -0400 +Subject: [PATCH 05/11] zebra: Return statements do not use paranthesis + +Signed-off-by: Donald Sharp +--- + zebra/zebra_rib.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c +index cf1baf077..472e48925 100644 +--- a/zebra/zebra_rib.c ++++ b/zebra/zebra_rib.c +@@ -1403,8 +1403,7 @@ static bool rib_route_match_ctx(const struct route_entry *re, + } + + done: +- +- return (result); ++ return result; + } + + static void zebra_rib_fixup_system(struct route_node *rn) +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0016-zebra-Add-zrouter.asic_notification_nexthop_control.patch b/src/sonic-frr/patch/0016-zebra-Add-zrouter.asic_notification_nexthop_control.patch new file mode 100644 index 00000000000..9381630811f --- /dev/null +++ b/src/sonic-frr/patch/0016-zebra-Add-zrouter.asic_notification_nexthop_control.patch @@ -0,0 +1,205 @@ +From 39c780b3676c99b8d124b6a88ab922daa5aaa8fc Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 5 Oct 2022 10:04:11 -0400 +Subject: [PATCH 06/11] zebra: Add `zrouter.asic_notification_nexthop_control` + +Volta submitted notification changes for the dplane that had a +special use case for their system. Volta is no more, the code +is not being actively developed and from talking with ex-Volta +employees there is no current plans to even maintain this code. +Wrap the special handling of nexthops that their asic-dataplane +did in a bit of code to isolate it and allow for future removal, +as that I do not actually believe anyone else is using this code. +Add a CPP_NOTICE several years into the future that will tell us +to remove the code. If someone starts using it then they will +have to notice this variable to set it and hopefully they will +see my CPP_NOTICE to come talk to us. If this is being used then +we can just remove this wrapper. + +Signed-off-by: Donald Sharp +--- + zebra/zebra_rib.c | 95 +++++++++++++++++++++++++------------------- + zebra/zebra_router.c | 11 +++++ + zebra/zebra_router.h | 8 ++++ + zebra/zebra_vty.c | 9 +++++ + 4 files changed, 83 insertions(+), 40 deletions(-) + +diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c +index 472e48925..abd6e07f9 100644 +--- a/zebra/zebra_rib.c ++++ b/zebra/zebra_rib.c +@@ -2215,55 +2215,70 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx) + /* Various fib transitions: changed nexthops; from installed to + * not-installed; or not-installed to installed. + */ +- if (start_count > 0 && end_count > 0) { +- if (debug_p) +- zlog_debug( +- "%s(%u:%u):%pRN applied nexthop changes from dplane notification", +- VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), +- dplane_ctx_get_table(ctx), rn); ++ if (zrouter.asic_notification_nexthop_control) { ++ if (start_count > 0 && end_count > 0) { ++ if (debug_p) ++ zlog_debug( ++ "%s(%u:%u):%pRN applied nexthop changes from dplane notification", ++ VRF_LOGNAME(vrf), ++ dplane_ctx_get_vrf(ctx), ++ dplane_ctx_get_table(ctx), rn); + +- /* Changed nexthops - update kernel/others */ +- dplane_route_notif_update(rn, re, +- DPLANE_OP_ROUTE_UPDATE, ctx); ++ /* Changed nexthops - update kernel/others */ ++ dplane_route_notif_update(rn, re, ++ DPLANE_OP_ROUTE_UPDATE, ctx); + +- } else if (start_count == 0 && end_count > 0) { +- if (debug_p) +- zlog_debug( +- "%s(%u:%u):%pRN installed transition from dplane notification", +- VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), +- dplane_ctx_get_table(ctx), rn); ++ } else if (start_count == 0 && end_count > 0) { ++ if (debug_p) ++ zlog_debug( ++ "%s(%u:%u):%pRN installed transition from dplane notification", ++ VRF_LOGNAME(vrf), ++ dplane_ctx_get_vrf(ctx), ++ dplane_ctx_get_table(ctx), rn); + +- /* We expect this to be the selected route, so we want +- * to tell others about this transition. +- */ +- SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED); ++ /* We expect this to be the selected route, so we want ++ * to tell others about this transition. ++ */ ++ SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED); + +- /* Changed nexthops - update kernel/others */ +- dplane_route_notif_update(rn, re, DPLANE_OP_ROUTE_UPDATE, ctx); ++ /* Changed nexthops - update kernel/others */ ++ dplane_route_notif_update(rn, re, ++ DPLANE_OP_ROUTE_UPDATE, ctx); + +- /* Redistribute, lsp, and nht update */ +- redistribute_update(rn, re, NULL); ++ /* Redistribute, lsp, and nht update */ ++ redistribute_update(rn, re, NULL); + +- } else if (start_count > 0 && end_count == 0) { +- if (debug_p) +- zlog_debug( +- "%s(%u:%u):%pRN un-installed transition from dplane notification", +- VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), +- dplane_ctx_get_table(ctx), rn); ++ } else if (start_count > 0 && end_count == 0) { ++ if (debug_p) ++ zlog_debug( ++ "%s(%u:%u):%pRN un-installed transition from dplane notification", ++ VRF_LOGNAME(vrf), ++ dplane_ctx_get_vrf(ctx), ++ dplane_ctx_get_table(ctx), rn); + +- /* Transition from _something_ installed to _nothing_ +- * installed. +- */ +- /* We expect this to be the selected route, so we want +- * to tell others about this transistion. +- */ +- UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED); ++ /* Transition from _something_ installed to _nothing_ ++ * installed. ++ */ ++ /* We expect this to be the selected route, so we want ++ * to tell others about this transistion. ++ */ ++ UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED); + +- /* Changed nexthops - update kernel/others */ +- dplane_route_notif_update(rn, re, DPLANE_OP_ROUTE_DELETE, ctx); ++ /* Changed nexthops - update kernel/others */ ++ dplane_route_notif_update(rn, re, ++ DPLANE_OP_ROUTE_DELETE, ctx); + +- /* Redistribute, lsp, and nht update */ +- redistribute_delete(rn, re, NULL); ++ /* Redistribute, lsp, and nht update */ ++ redistribute_delete(rn, re, NULL); ++ } ++ } ++ ++ if (!zebra_router_notify_on_ack()) { ++ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED)) ++ zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_INSTALLED); ++ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED)) ++ zsend_route_notify_owner_ctx(ctx, ++ ZAPI_ROUTE_FAIL_INSTALL); + } + + /* Make any changes visible for lsp and nexthop-tracking processing */ +diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c +index 92a3b9424..d47517bbb 100644 +--- a/zebra/zebra_router.c ++++ b/zebra/zebra_router.c +@@ -304,6 +304,17 @@ void zebra_router_init(bool asic_offload, bool notify_on_ack) + zrouter.asic_offloaded = asic_offload; + zrouter.notify_on_ack = notify_on_ack; + ++ /* ++ * If you start using asic_notification_nexthop_control ++ * come talk to the FRR community about what you are doing ++ * We would like to know. ++ */ ++#if CONFDATE > 20251231 ++ CPP_NOTICE( ++ "Remove zrouter.asic_notification_nexthop_control as that it's not being maintained or used"); ++#endif ++ zrouter.asic_notification_nexthop_control = false; ++ + #ifdef HAVE_SCRIPTING + zebra_script_init(); + #endif +diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h +index c0eab9cd6..583bd0038 100644 +--- a/zebra/zebra_router.h ++++ b/zebra/zebra_router.h +@@ -209,6 +209,14 @@ struct zebra_router { + */ + bool asic_offloaded; + bool notify_on_ack; ++ ++ /* ++ * If the asic is notifying us about successful nexthop ++ * allocation/control. Some developers have made their ++ * asic take control of how many nexthops/ecmp they can ++ * have and will report what is successfull or not ++ */ ++ bool asic_notification_nexthop_control; + }; + + #define GRACEFUL_RESTART_TIME 60 +diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c +index 0a3d676a9..a7eb09df0 100644 +--- a/zebra/zebra_vty.c ++++ b/zebra/zebra_vty.c +@@ -3972,6 +3972,15 @@ DEFUN (show_zebra, + if (zrouter.asic_offloaded) + vty_out(vty, "Asic Offload is being used\n"); + ++ /* ++ * Do not display this unless someone is actually using it ++ * ++ * Why this distinction? I think this is effectively dead code ++ * and should not be exposed. Maybe someone proves me wrong. ++ */ ++ if (zrouter.asic_notification_nexthop_control) ++ vty_out(vty, "ASIC offload and nexthop control is being used"); ++ + vty_out(vty, + " Route Route Neighbor LSP LSP\n"); + vty_out(vty, +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0017-zebra-Re-arrange-fpm_read-to-reduce-code-duplication.patch b/src/sonic-frr/patch/0017-zebra-Re-arrange-fpm_read-to-reduce-code-duplication.patch new file mode 100644 index 00000000000..161dea49250 --- /dev/null +++ b/src/sonic-frr/patch/0017-zebra-Re-arrange-fpm_read-to-reduce-code-duplication.patch @@ -0,0 +1,56 @@ +From ac12bb53b89beba19232bbc691fee074bdc5655c Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Wed, 5 Oct 2022 11:28:43 -0400 +Subject: [PATCH 07/11] zebra: Re-arrange fpm_read to reduce code duplication + +Signed-off-by: Donald Sharp +--- + zebra/dplane_fpm_nl.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 3b02128c9..8d41f3b07 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -466,13 +466,6 @@ static int fpm_read(struct thread *t) + /* Let's ignore the input at the moment. */ + rv = stream_read_try(fnc->ibuf, fnc->socket, + STREAM_WRITEABLE(fnc->ibuf)); +- /* We've got an interruption. */ +- if (rv == -2) { +- /* Schedule next read. */ +- thread_add_read(fnc->fthread->master, fpm_read, fnc, +- fnc->socket, &fnc->t_read); +- return 0; +- } + if (rv == 0) { + atomic_fetch_add_explicit(&fnc->counters.connection_closes, 1, + memory_order_relaxed); +@@ -491,15 +484,21 @@ static int fpm_read(struct thread *t) + FPM_RECONNECT(fnc); + return 0; + } ++ ++ /* Schedule the next read */ ++ thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, ++ &fnc->t_read); ++ ++ /* We've got an interruption. */ ++ if (rv == -2) ++ return 0; ++ + stream_reset(fnc->ibuf); + + /* Account all bytes read. */ + atomic_fetch_add_explicit(&fnc->counters.bytes_read, rv, + memory_order_relaxed); + +- thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, +- &fnc->t_read); +- + return 0; + } + +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0018-zebra-Add-dplane_ctx_get-set_flags.patch b/src/sonic-frr/patch/0018-zebra-Add-dplane_ctx_get-set_flags.patch new file mode 100644 index 00000000000..e9fed285cde --- /dev/null +++ b/src/sonic-frr/patch/0018-zebra-Add-dplane_ctx_get-set_flags.patch @@ -0,0 +1,78 @@ +From de380fe01d9a0a5602eb71bc828ed9efe8e6d56c Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Mon, 3 Oct 2022 15:28:48 -0400 +Subject: [PATCH 08/11] zebra: Add dplane_ctx_get|set_flags + +Zebra needs the ability to pass this data around. +Add it to the dplanes ability to pass. + +Signed-off-by: Donald Sharp + +zebra: Add a dplane_ctx_set_flags + +The dplane_ctx_set_flags call is missing, we will need it. Add it. + +Signed-off-by: Donald Sharp +--- + zebra/zebra_dplane.c | 17 +++++++++++++++++ + zebra/zebra_dplane.h | 2 ++ + 2 files changed, 19 insertions(+) + +diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c +index 656ebcf3b..5d94e1a0b 100644 +--- a/zebra/zebra_dplane.c ++++ b/zebra/zebra_dplane.c +@@ -132,6 +132,8 @@ struct dplane_route_info { + uint32_t zd_mtu; + uint32_t zd_nexthop_mtu; + ++ uint32_t zd_flags; ++ + /* Nexthop hash entry info */ + struct dplane_nexthop_info nhe; + +@@ -1323,6 +1325,20 @@ uint16_t dplane_ctx_get_old_instance(const struct zebra_dplane_ctx *ctx) + return ctx->u.rinfo.zd_old_instance; + } + ++uint32_t dplane_ctx_get_flags(const struct zebra_dplane_ctx *ctx) ++{ ++ DPLANE_CTX_VALID(ctx); ++ ++ return ctx->u.rinfo.zd_flags; ++} ++ ++void dplane_ctx_set_flags(struct zebra_dplane_ctx *ctx, uint32_t flags) ++{ ++ DPLANE_CTX_VALID(ctx); ++ ++ ctx->u.rinfo.zd_flags = flags; ++} ++ + uint32_t dplane_ctx_get_metric(const struct zebra_dplane_ctx *ctx) + { + DPLANE_CTX_VALID(ctx); +@@ -2358,6 +2374,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + + ctx->zd_table_id = re->table; + ++ ctx->u.rinfo.zd_flags = re->flags; + ctx->u.rinfo.zd_metric = re->metric; + ctx->u.rinfo.zd_old_metric = re->metric; + ctx->zd_vrf_id = re->vrf_id; +diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h +index 1d5518138..3210137c0 100644 +--- a/zebra/zebra_dplane.h ++++ b/zebra/zebra_dplane.h +@@ -343,6 +343,8 @@ route_tag_t dplane_ctx_get_old_tag(const struct zebra_dplane_ctx *ctx); + uint16_t dplane_ctx_get_instance(const struct zebra_dplane_ctx *ctx); + void dplane_ctx_set_instance(struct zebra_dplane_ctx *ctx, uint16_t instance); + uint16_t dplane_ctx_get_old_instance(const struct zebra_dplane_ctx *ctx); ++uint32_t dplane_ctx_get_flags(const struct zebra_dplane_ctx *ctx); ++void dplane_ctx_set_flags(struct zebra_dplane_ctx *ctx, uint32_t flags); + uint32_t dplane_ctx_get_metric(const struct zebra_dplane_ctx *ctx); + uint32_t dplane_ctx_get_old_metric(const struct zebra_dplane_ctx *ctx); + uint32_t dplane_ctx_get_mtu(const struct zebra_dplane_ctx *ctx); +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0019-zebra-Rearrange-dplane_ctx_route_init.patch b/src/sonic-frr/patch/0019-zebra-Rearrange-dplane_ctx_route_init.patch new file mode 100644 index 00000000000..3b5c3c59af8 --- /dev/null +++ b/src/sonic-frr/patch/0019-zebra-Rearrange-dplane_ctx_route_init.patch @@ -0,0 +1,135 @@ +From 350f6a99ddf6383ace6be18be2ddb22b943a8ec9 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Mon, 3 Oct 2022 13:22:22 -0400 +Subject: [PATCH 09/11] zebra: Rearrange dplane_ctx_route_init + +In order for a future commit to abstract the dplane_ctx_route_init +so that the kernel can use it, let's move some stuff around +and add a dplane_ctx_route_init_basic that can be used by multiple +different paths + +Signed-off-by: Donald Sharp + +create a dplane_ctx_route_init_basic so it can be used + +Signed-off-by: Donald Sharp +--- + zebra/zebra_dplane.c | 64 +++++++++++++++++++++++++++++--------------- + zebra/zebra_dplane.h | 6 +++++ + 2 files changed, 49 insertions(+), 21 deletions(-) + +diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c +index 5d94e1a0b..05f9c2e08 100644 +--- a/zebra/zebra_dplane.c ++++ b/zebra/zebra_dplane.c +@@ -2334,25 +2334,16 @@ static int dplane_ctx_ns_init(struct zebra_dplane_ctx *ctx, + return AOK; + } + +-/* +- * Initialize a context block for a route update from zebra data structs. +- */ +-int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, +- struct route_node *rn, struct route_entry *re) ++int dplane_ctx_route_init_basic(struct zebra_dplane_ctx *ctx, ++ enum dplane_op_e op, struct route_entry *re, ++ const struct prefix *p, ++ const struct prefix *src_p, afi_t afi, ++ safi_t safi) + { + int ret = EINVAL; +- const struct route_table *table = NULL; +- const struct rib_table_info *info; +- const struct prefix *p, *src_p; +- struct zebra_ns *zns; +- struct zebra_vrf *zvrf; +- struct nexthop *nexthop; +- struct zebra_l3vni *zl3vni; +- const struct interface *ifp; +- struct dplane_intf_extra *if_extra; + +- if (!ctx || !rn || !re) +- goto done; ++ if (!ctx || !re) ++ return ret; + + TAILQ_INIT(&ctx->u.rinfo.intf_extra_q); + +@@ -2362,9 +2353,6 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + ctx->u.rinfo.zd_type = re->type; + ctx->u.rinfo.zd_old_type = re->type; + +- /* Prefixes: dest, and optional source */ +- srcdest_rnode_prefixes(rn, &p, &src_p); +- + prefix_copy(&(ctx->u.rinfo.zd_dest), p); + + if (src_p) +@@ -2385,11 +2373,45 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + ctx->u.rinfo.zd_old_tag = re->tag; + ctx->u.rinfo.zd_distance = re->distance; + ++ ctx->u.rinfo.zd_afi = afi; ++ ctx->u.rinfo.zd_safi = safi; ++ ++ return AOK; ++} ++ ++/* ++ * Initialize a context block for a route update from zebra data structs. ++ */ ++int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, ++ struct route_node *rn, struct route_entry *re) ++{ ++ int ret = EINVAL; ++ const struct route_table *table = NULL; ++ const struct rib_table_info *info; ++ const struct prefix *p, *src_p; ++ struct zebra_ns *zns; ++ struct zebra_vrf *zvrf; ++ struct nexthop *nexthop; ++ struct zebra_l3vni *zl3vni; ++ const struct interface *ifp; ++ struct dplane_intf_extra *if_extra; ++ ++ if (!ctx || !rn || !re) ++ return ret; ++ ++ /* ++ * Let's grab the data from the route_node ++ * so that we can call a helper function ++ */ ++ ++ /* Prefixes: dest, and optional source */ ++ srcdest_rnode_prefixes(rn, &p, &src_p); + table = srcdest_rnode_table(rn); + info = table->info; + +- ctx->u.rinfo.zd_afi = info->afi; +- ctx->u.rinfo.zd_safi = info->safi; ++ if (dplane_ctx_route_init_basic(ctx, op, re, p, src_p, info->afi, ++ info->safi) != AOK) ++ return ret; + + /* Copy nexthops; recursive info is included too */ + copy_nexthops(&(ctx->u.rinfo.zd_ng.nexthop), +diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h +index 3210137c0..9d7502828 100644 +--- a/zebra/zebra_dplane.h ++++ b/zebra/zebra_dplane.h +@@ -774,6 +774,12 @@ dplane_pbr_ipset_entry_delete(struct zebra_pbr_ipset_entry *ipset); + int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + struct route_node *rn, struct route_entry *re); + ++int dplane_ctx_route_init_basic(struct zebra_dplane_ctx *ctx, ++ enum dplane_op_e op, struct route_entry *re, ++ const struct prefix *p, ++ const struct prefix *src_p, afi_t afi, ++ safi_t safi); ++ + /* Encode next hop information into data plane context. */ + int dplane_ctx_nexthop_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + struct nhg_hash_entry *nhe); +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0020-zebra-Add-ctx-to-netlink-message-parsing.patch b/src/sonic-frr/patch/0020-zebra-Add-ctx-to-netlink-message-parsing.patch new file mode 100644 index 00000000000..07866b31293 --- /dev/null +++ b/src/sonic-frr/patch/0020-zebra-Add-ctx-to-netlink-message-parsing.patch @@ -0,0 +1,155 @@ +From 0209b198c284d646600c8978cf7439387520e6b3 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Tue, 4 Oct 2022 15:41:36 -0400 +Subject: [PATCH 10/11] zebra: Add ctx to netlink message parsing + +Add the initial step of passing in a dplane context +to reading route netlink messages. This code +will be run in two contexts: + +a) The normal pthread for reading netlink messages from +the kernel +b) The dplane_fpm_nl pthread. + +The goal of this commit is too just allow a) to work +b) will be filled in in the future. Effectively +everything should still be working as it should +pre this change. We will just possibly allow +the passing of the context around( but not used ) + +Signed-off-by: Donald Sharp +--- + zebra/rt_netlink.c | 31 +++++++++++++++++++++++-------- + zebra/rt_netlink.h | 4 ++++ + zebra/zebra_dplane.c | 11 +++++++++++ + zebra/zebra_dplane.h | 10 ++++++++++ + 4 files changed, 48 insertions(+), 8 deletions(-) + +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 24c01b7f5..b2df2cd8a 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -667,8 +667,9 @@ static uint8_t parse_multipath_nexthops_unicast(ns_id_t ns_id, + } + + /* Looking up routing table by netlink interface. */ +-static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, +- int startup) ++int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, ++ ns_id_t ns_id, int startup, ++ struct zebra_dplane_ctx *ctx) + { + int len; + struct rtmsg *rtm; +@@ -740,9 +741,8 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, + + selfroute = is_selfroute(rtm->rtm_protocol); + +- if (!startup && selfroute +- && h->nlmsg_type == RTM_NEWROUTE +- && !zrouter.asic_offloaded) { ++ if (!startup && selfroute && h->nlmsg_type == RTM_NEWROUTE && ++ !zrouter.asic_offloaded && !ctx) { + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("Route type: %d Received that we think we have originated, ignoring", + rtm->rtm_protocol); +@@ -963,12 +963,20 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, + } + + if (nhe_id || ng) +- rib_add_multipath(afi, SAFI_UNICAST, &p, +- &src_p, re, ng); ++ dplane_rib_add_multipath(afi, SAFI_UNICAST, &p, ++ &src_p, re, ng, ++ startup, ctx); + else + XFREE(MTYPE_RE, re); + } + } else { ++ if (ctx) { ++ zlog_err( ++ "%s: %pFX RTM_DELROUTE received but received a context as well", ++ __func__, &p); ++ return 0; ++ } ++ + if (nhe_id) { + rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags, + &p, &src_p, NULL, nhe_id, table, metric, +@@ -993,7 +1001,14 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, + } + } + +- return 0; ++ return 1; ++} ++ ++static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, ++ int startup) ++{ ++ return netlink_route_change_read_unicast_internal(h, ns_id, startup, ++ NULL); + } + + static struct mcast_route_data *mroute = NULL; +diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h +index 93c06e555..da044c2c4 100644 +--- a/zebra/rt_netlink.h ++++ b/zebra/rt_netlink.h +@@ -122,6 +122,10 @@ netlink_put_lsp_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx); + extern enum netlink_msg_status + netlink_put_pw_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx); + ++int netlink_route_change_read_unicast_internal(struct nlmsghdr *h, ++ ns_id_t ns_id, int startup, ++ struct zebra_dplane_ctx *ctx); ++ + #ifdef NETLINK_DEBUG + const char *nlmsg_type2str(uint16_t type); + const char *af_type2str(int type); +diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c +index 05f9c2e08..5048bf7dc 100644 +--- a/zebra/zebra_dplane.c ++++ b/zebra/zebra_dplane.c +@@ -5320,6 +5320,17 @@ kernel_dplane_process_ipset_entry(struct zebra_dplane_provider *prov, + dplane_provider_enqueue_out_ctx(prov, ctx); + } + ++void dplane_rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, ++ struct prefix_ipv6 *src_p, struct route_entry *re, ++ struct nexthop_group *ng, int startup, ++ struct zebra_dplane_ctx *ctx) ++{ ++ if (!ctx) ++ rib_add_multipath(afi, safi, p, src_p, re, ng); ++ else { ++ } ++} ++ + /* + * Kernel provider callback + */ +diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h +index 9d7502828..4732a1628 100644 +--- a/zebra/zebra_dplane.h ++++ b/zebra/zebra_dplane.h +@@ -938,6 +938,16 @@ void zebra_dplane_pre_finish(void); + void zebra_dplane_finish(void); + void zebra_dplane_shutdown(void); + ++/* ++ * decision point for sending a routing update through the old ++ * straight to zebra master pthread or through the dplane to ++ * the master pthread for handling ++ */ ++void dplane_rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, ++ struct prefix_ipv6 *src_p, struct route_entry *re, ++ struct nexthop_group *ng, int startup, ++ struct zebra_dplane_ctx *ctx); ++ + #ifdef __cplusplus + } + #endif +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0021-zebra-Read-from-the-dplane_fpm_nl-a-route-update.patch b/src/sonic-frr/patch/0021-zebra-Read-from-the-dplane_fpm_nl-a-route-update.patch new file mode 100644 index 00000000000..378ec5ee8bb --- /dev/null +++ b/src/sonic-frr/patch/0021-zebra-Read-from-the-dplane_fpm_nl-a-route-update.patch @@ -0,0 +1,247 @@ +From a66db58a4ad3c5c7c7c076554e9a9ca6969176e3 Mon Sep 17 00:00:00 2001 +From: Donald Sharp +Date: Fri, 7 Oct 2022 08:02:44 -0400 +Subject: [PATCH 11/11] zebra: Read from the dplane_fpm_nl a route update + +Read from the fpm dplane a route update that will +include status about whether or not the asic was +successfull in offloading the route. + +Have this data passed up to zebra for processing and disseminate +this data as appropriate. + +Signed-off-by: Donald Sharp +--- + doc/developer/fpm.rst | 16 +++++++++ + zebra/dplane_fpm_nl.c | 80 +++++++++++++++++++++++++++++++++++++++++-- + zebra/zebra_dplane.c | 10 ++++-- + zebra/zebra_dplane.h | 2 +- + zebra/zebra_rib.c | 16 +++++++-- + 5 files changed, 116 insertions(+), 8 deletions(-) + +diff --git a/doc/developer/fpm.rst b/doc/developer/fpm.rst +index 984986913..56d33671d 100644 +--- a/doc/developer/fpm.rst ++++ b/doc/developer/fpm.rst +@@ -101,3 +101,19 @@ Data + ^^^^ + + The netlink or protobuf message payload. ++ ++ ++Route Status Notification from ASIC ++^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++ ++The dplane_fpm_nl has the ability to read route netlink messages ++from the underlying fpm implementation that can tell zebra ++whether or not the route has been Offloaded/Failed or Trapped. ++The end developer must send the data up the same socket that has ++been created to listen for FPM messages from Zebra. The data sent ++must have a Frame Header with Version set to 1, Message Type set to 1 ++and an appropriate message Length. The message data must contain ++a RTM_NEWROUTE netlink message that sends the prefix and nexthops ++associated with the route. Finally rtm_flags must contain ++RTM_F_OFFLOAD, RTM_F_TRAP and or RTM_F_OFFLOAD_FAILED to signify ++what has happened to the route in the ASIC. +diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c +index 8d41f3b07..912d08e6b 100644 +--- a/zebra/dplane_fpm_nl.c ++++ b/zebra/dplane_fpm_nl.c +@@ -51,6 +51,7 @@ + #include "zebra/kernel_netlink.h" + #include "zebra/rt_netlink.h" + #include "zebra/debug.h" ++#include "fpm/fpm.h" + + #define SOUTHBOUND_DEFAULT_ADDR INADDR_LOOPBACK + #define SOUTHBOUND_DEFAULT_PORT 2620 +@@ -461,7 +462,11 @@ static void fpm_reconnect(struct fpm_nl_ctx *fnc) + static int fpm_read(struct thread *t) + { + struct fpm_nl_ctx *fnc = THREAD_ARG(t); ++ fpm_msg_hdr_t fpm; + ssize_t rv; ++ char buf[8192]; ++ struct nlmsghdr *hdr; ++ struct zebra_dplane_ctx *ctx; + + /* Let's ignore the input at the moment. */ + rv = stream_read_try(fnc->ibuf, fnc->socket, +@@ -493,12 +498,83 @@ static int fpm_read(struct thread *t) + if (rv == -2) + return 0; + +- stream_reset(fnc->ibuf); +- + /* Account all bytes read. */ + atomic_fetch_add_explicit(&fnc->counters.bytes_read, rv, + memory_order_relaxed); + ++ while (rv) { ++ if (rv < (ssize_t)FPM_MSG_HDR_LEN) { ++ stream_reset(fnc->ibuf); ++ zlog_warn( ++ "%s: Received %zd bytes but cannot even read fpm header, ignoring", ++ __func__, rv); ++ ++ FPM_RECONNECT(fnc); ++ return 0; ++ } ++ ++ fpm.version = stream_getc(fnc->ibuf); ++ fpm.msg_type = stream_getc(fnc->ibuf); ++ fpm.msg_len = stream_getw(fnc->ibuf); ++ ++ if (fpm.version != FPM_PROTO_VERSION && ++ fpm.msg_type != FPM_MSG_TYPE_NETLINK) { ++ stream_reset(fnc->ibuf); ++ zlog_warn( ++ "%s: Received version/msg_type %u/%u, expected 1/1", ++ __func__, fpm.version, fpm.msg_type); ++ ++ FPM_RECONNECT(fnc); ++ return 0; ++ } ++ ++ if (fpm.msg_len != rv) { ++ stream_reset(fnc->ibuf); ++ zlog_warn( ++ "%s: Received message length %u but read only got %zd, ignoring message", ++ __func__, fpm.msg_len, rv); ++ ++ FPM_RECONNECT(fnc); ++ return 0; ++ } ++ ++ /* ++ * Place the data from the stream into a buffer ++ */ ++ hdr = (struct nlmsghdr *)buf; ++ if (sizeof(buf) < fpm.msg_len) { ++ stream_reset(fnc->ibuf); ++ zlog_warn( ++ "%s: Received unexpected large message data: %u", ++ __func__, fpm.msg_len); ++ FPM_RECONNECT(fnc); ++ return 0; ++ } ++ ++ stream_get(buf, fnc->ibuf, fpm.msg_len - FPM_MSG_HDR_LEN); ++ rv -= fpm.msg_len; ++ ++ switch (hdr->nlmsg_type) { ++ case RTM_NEWROUTE: ++ ctx = dplane_ctx_alloc(); ++ dplane_ctx_set_op(ctx, DPLANE_OP_ROUTE_NOTIFY); ++ if (netlink_route_change_read_unicast_internal( ++ hdr, 0, false, ctx) != 1) { ++ dplane_ctx_fini(&ctx); ++ stream_pulldown(fnc->ibuf); ++ return 0; ++ } ++ break; ++ default: ++ if (IS_ZEBRA_DEBUG_FPM) ++ zlog_debug( ++ "%s: Received message type %u which is not currently handled", ++ __func__, hdr->nlmsg_type); ++ break; ++ } ++ } ++ ++ stream_reset(fnc->ibuf); + return 0; + } + +diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c +index 5048bf7dc..336056abb 100644 +--- a/zebra/zebra_dplane.c ++++ b/zebra/zebra_dplane.c +@@ -2337,7 +2337,7 @@ static int dplane_ctx_ns_init(struct zebra_dplane_ctx *ctx, + int dplane_ctx_route_init_basic(struct zebra_dplane_ctx *ctx, + enum dplane_op_e op, struct route_entry *re, + const struct prefix *p, +- const struct prefix *src_p, afi_t afi, ++ const struct prefix_ipv6 *src_p, afi_t afi, + safi_t safi) + { + int ret = EINVAL; +@@ -2388,7 +2388,8 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + int ret = EINVAL; + const struct route_table *table = NULL; + const struct rib_table_info *info; +- const struct prefix *p, *src_p; ++ const struct prefix *p; ++ const struct prefix_ipv6 *src_p; + struct zebra_ns *zns; + struct zebra_vrf *zvrf; + struct nexthop *nexthop; +@@ -2405,7 +2406,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + */ + + /* Prefixes: dest, and optional source */ +- srcdest_rnode_prefixes(rn, &p, &src_p); ++ srcdest_rnode_prefixes(rn, &p, (const struct prefix **)&src_p); + table = srcdest_rnode_table(rn); + info = table->info; + +@@ -5328,6 +5329,9 @@ void dplane_rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, + if (!ctx) + rib_add_multipath(afi, safi, p, src_p, re, ng); + else { ++ dplane_ctx_route_init_basic(ctx, dplane_ctx_get_op(ctx), re, p, ++ src_p, afi, safi); ++ dplane_provider_enqueue_to_zebra(ctx); + } + } + +diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h +index 4732a1628..c3fe3ba40 100644 +--- a/zebra/zebra_dplane.h ++++ b/zebra/zebra_dplane.h +@@ -777,7 +777,7 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, + int dplane_ctx_route_init_basic(struct zebra_dplane_ctx *ctx, + enum dplane_op_e op, struct route_entry *re, + const struct prefix *p, +- const struct prefix *src_p, afi_t afi, ++ const struct prefix_ipv6 *src_p, afi_t afi, + safi_t safi); + + /* Encode next hop information into data plane context. */ +diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c +index abd6e07f9..50f19adcc 100644 +--- a/zebra/zebra_rib.c ++++ b/zebra/zebra_rib.c +@@ -2138,8 +2138,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx) + } + + /* Ensure we clear the QUEUED flag */ +- if (!zrouter.asic_offloaded) +- UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); ++ UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED); + + /* Is this a notification that ... matters? We mostly care about + * the route that is currently selected for installation; we may also +@@ -2182,6 +2181,19 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx) + dplane_ctx_get_type(ctx))); + } + goto done; ++ } else { ++ uint32_t flags = dplane_ctx_get_flags(ctx); ++ ++ if (CHECK_FLAG(flags, ZEBRA_FLAG_OFFLOADED)) { ++ UNSET_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED); ++ SET_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED); ++ } ++ if (CHECK_FLAG(flags, ZEBRA_FLAG_OFFLOAD_FAILED)) { ++ UNSET_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED); ++ SET_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED); ++ } ++ if (CHECK_FLAG(flags, ZEBRA_FLAG_TRAPPED)) ++ SET_FLAG(re->flags, ZEBRA_FLAG_TRAPPED); + } + + /* We'll want to determine whether the installation status of the +-- +2.30.2 + diff --git a/src/sonic-frr/patch/0022-Use-vrf_id-for-vrf-not-tabled_id.patch b/src/sonic-frr/patch/0022-Use-vrf_id-for-vrf-not-tabled_id.patch new file mode 100644 index 00000000000..d2f0a25a0d0 --- /dev/null +++ b/src/sonic-frr/patch/0022-Use-vrf_id-for-vrf-not-tabled_id.patch @@ -0,0 +1,103 @@ +From c721612eb8e9fb33c688e4ac1b11e7dbcedf293a Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Thu, 20 Oct 2022 11:03:14 +0000 +Subject: [PATCH 1/4] use vrf id instead of table id + +Signed-off-by: Stepan Blyschak +--- + zebra/rt_netlink.c | 64 ++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 51 insertions(+), 13 deletions(-) + +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c +index 24c01b7f5..0a9fdb909 100644 +--- a/zebra/rt_netlink.c ++++ b/zebra/rt_netlink.c +@@ -388,6 +388,30 @@ vrf_id_t vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id) + return VRF_DEFAULT; + } + ++static uint32_t table_lookup_by_vrf(vrf_id_t vrf_id, ns_id_t ns_id) ++{ ++ struct vrf *vrf; ++ struct zebra_vrf *zvrf; ++ ++ RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { ++ zvrf = vrf->info; ++ if (zvrf == NULL) ++ continue; ++ /* case vrf with netns : match the netnsid */ ++ if (vrf_is_backend_netns()) { ++ if (ns_id == zvrf_id(zvrf)) ++ return zvrf->table_id; ++ } else { ++ /* VRF is VRF_BACKEND_VRF_LITE */ ++ if (zvrf_id(zvrf) != vrf_id) ++ continue; ++ return zvrf->table_id; ++ } ++ } ++ ++ return RT_TABLE_UNSPEC; ++} ++ + /** + * @parse_encap_mpls() - Parses encapsulated mpls attributes + * @tb: Pointer to rtattr to look for nested items in. +@@ -754,14 +778,23 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id, + if (rtm->rtm_family == AF_MPLS) + return 0; + +- /* Table corresponding to route. */ +- if (tb[RTA_TABLE]) +- table = *(int *)RTA_DATA(tb[RTA_TABLE]); +- else +- table = rtm->rtm_table; ++ if (!ctx) { ++ /* Table corresponding to route. */ ++ if (tb[RTA_TABLE]) ++ table = *(int *)RTA_DATA(tb[RTA_TABLE]); ++ else ++ table = rtm->rtm_table; ++ ++ /* Map to VRF */ ++ vrf_id = vrf_lookup_by_table(table, ns_id); ++ } else { ++ /* With FPM, rtm_table contains vrf id, see netlink_route_multipath_msg_encode */ ++ vrf_id = rtm->rtm_table; ++ ++ /* Map to table */ ++ table = table_lookup_by_vrf(vrf_id, ns_id); ++ } + +- /* Map to VRF */ +- vrf_id = vrf_lookup_by_table(table, ns_id); + if (vrf_id == VRF_DEFAULT) { + if (!is_zebra_valid_kernel_table(table) + && !is_zebra_main_routing_table(table)) +@@ -1969,12 +2002,17 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, + #endif + /* Table corresponding to this route. */ + table_id = dplane_ctx_get_table(ctx); +- if (table_id < 256) +- req->r.rtm_table = table_id; +- else { +- req->r.rtm_table = RT_TABLE_UNSPEC; +- if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) +- return 0; ++ if (!fpm) { ++ if (table_id < 256) ++ req->r.rtm_table = table_id; ++ else { ++ req->r.rtm_table = RT_TABLE_UNSPEC; ++ if (!nl_attr_put32(&req->n, datalen, RTA_TABLE, table_id)) ++ return 0; ++ } ++ } else { ++ /* Put vrf if_index instead of table id */ ++ req->r.rtm_table = dplane_ctx_get_vrf(ctx); + } + + if (IS_ZEBRA_DEBUG_KERNEL) +-- +2.30.2 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index 01197120ef2..8fdae4b5d70 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -1,6 +1,5 @@ 0001-Add-support-of-bgp-tcp-DSCP-value.patch 0002-Reduce-severity-of-Vty-connected-from-message.patch -0003-Use-vrf_id-for-vrf-not-tabled_id.patch 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch 0005-nexthops-compare-vrf-only-if-ip-type.patch 0006-frr-remove-frr-log-outchannel-to-var-log-frr.log.patch @@ -13,3 +12,13 @@ cross-compile-changes.patch 0011-bgpd-enhanced-capability-is-always-turned-on-for-int.patch 0012-Ensure-ospf_apiclient_lsa_originate-cannot-accidently-write-into-stack.patch 0013-zebra-fix-dplane-fpm-nl-to-allow-for-fast-configuration.patch +0014-bgpd-Allow-network-XXX-to-work-with-bgp-suppress-fib.patch +0015-zebra-Return-statements-do-not-use-paranthesis.patch +0016-zebra-Add-zrouter.asic_notification_nexthop_control.patch +0017-zebra-Re-arrange-fpm_read-to-reduce-code-duplication.patch +0018-zebra-Add-dplane_ctx_get-set_flags.patch +0019-zebra-Rearrange-dplane_ctx_route_init.patch +0020-zebra-Add-ctx-to-netlink-message-parsing.patch +0021-zebra-Read-from-the-dplane_fpm_nl-a-route-update.patch +0022-Use-vrf_id-for-vrf-not-tabled_id.patch + diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index e55ba4c8257..e2e1a8376a9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -125,6 +125,15 @@ }, "DEVICE_METADATA_ADVERTISE_LO_PREFIX_AS_128": { "desc": "Verifying advertising lo prefix as /128." + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "desc": "Enable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "desc": "Disable bgp-suppress-fib-pending" + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "desc": "Enable bgp-suppress-fib-pending when synchronous mode is disabled", + "eStr": ["ASIC synchronous mode and APP_STATE_LOGGING for ROUTE_TABLE must be enabled in order to enable BGP suppress FIB pending feature"] } - } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index 638f83d562c..a6d94f332d0 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -332,5 +332,35 @@ } } } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "enable", + "suppress-pending-fib": "enabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-pending-fib": "disabled" + } + } + } + }, + "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "synchronous_mode": "disable", + "suppress-pending-fib": "enabled" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index d7b92bea82f..509f2937897 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -199,6 +199,19 @@ module sonic-device_metadata { description "Advertise Loopback0 interface IPv6 /128 subnet address as it is with set to true. By default SONiC advertises /128 subnet prefix in Loopback0 as /64 subnet route"; } + + leaf suppress-pending-fib { + description "Enable BGP suppress FIB pending feature. BGP will wait for route FIB installation before announcing routes"; + type enumeration { + enum enabled; + enum disabled; + } + default disabled; + + must "((current() = 'disabled') or (current() = 'enabled' and ../synchronous_mode = 'enable'))" { + error-message "ASIC synchronous mode must be enabled in order to enable BGP suppress FIB pending feature"; + } + } } /* end of container localhost */ } From 92f7e37b04ea73da1c853fe40cdd914c8dbd4251 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 16 Nov 2022 13:29:35 +0000 Subject: [PATCH 2/8] fix yang test Signed-off-by: Stepan Blyschak --- .../tests/yang_model_tests/tests/device_metadata.json | 2 +- src/sonic-yang-models/yang-models/sonic-device_metadata.yang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index e2e1a8376a9..bdcea63ebb2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -134,6 +134,6 @@ }, "DEVICE_METADATA_SUPPRESS_PENDING_FIB_ENABLED_SYNCHRONOUS_MODE_DISABLED": { "desc": "Enable bgp-suppress-fib-pending when synchronous mode is disabled", - "eStr": ["ASIC synchronous mode and APP_STATE_LOGGING for ROUTE_TABLE must be enabled in order to enable BGP suppress FIB pending feature"] + "eStr": ["ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"] } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 509f2937897..5905dca536c 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -209,7 +209,7 @@ module sonic-device_metadata { default disabled; must "((current() = 'disabled') or (current() = 'enabled' and ../synchronous_mode = 'enable'))" { - error-message "ASIC synchronous mode must be enabled in order to enable BGP suppress FIB pending feature"; + error-message "ASIC synchronous mode must be enabled in order to enable suppress FIB pending feature"; } } } From 735ab84c0ead9c63560d3660cc9593124bcdc981 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 16 Nov 2022 14:13:55 +0000 Subject: [PATCH 3/8] fix config-engine tests Signed-off-by: Stepan Blyschak --- src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf | 1 + .../data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf | 1 + src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf | 1 + src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf | 1 + .../tests/sample_output/py2/bgpd_frr_backend_asic.conf | 1 + .../tests/sample_output/py2/bgpd_frr_frontend_asic.conf | 1 + src/sonic-config-engine/tests/sample_output/py2/frr.conf | 1 + src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf | 1 + .../tests/sample_output/py3/bgpd_frr_backend_asic.conf | 1 + .../tests/sample_output/py3/bgpd_frr_frontend_asic.conf | 1 + src/sonic-config-engine/tests/sample_output/py3/frr.conf | 1 + 16 files changed, 16 insertions(+) diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index c39115706d7..a7f34245873 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -55,6 +55,7 @@ route-map HIDE_INTERNAL permit 20 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index c5ba79d3439..d2dc9e40e89 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf index 77cc9d6fffd..27d04b953a3 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf @@ -12,6 +12,7 @@ ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index 00b09bd40d9..b85dd67a5ca 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf index 50414a89a38..5ee5ce5443a 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf @@ -14,6 +14,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00::1/128 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf index 37ac8827dc4..0f7f227e0e2 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf index d8ee10ada1e..ef28d67c1c9 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 606788cba99..04040c722c7 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -70,6 +70,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf index 2c146698a96..088ac88724d 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-pending-fib no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf index d793dfa39a9..45cd03a540a 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf index 94bd37e3b90..8daeff2a61e 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 7d985db93b9..70fcc20063e 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -61,6 +61,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-pending-fib no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf index e7534d4b978..e5ad8964454 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf index d793dfa39a9..45cd03a540a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf index 94bd37e3b90..8daeff2a61e 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 43bed33c4bd..3c728cca380 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -61,6 +61,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! From 8a6b555d339f1160f576ff97082e02d10ef60b37 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 16 Nov 2022 14:39:02 +0000 Subject: [PATCH 4/8] Revert "fix config-engine tests" This reverts commit 735ab84c0ead9c63560d3660cc9593124bcdc981. --- src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf | 1 - .../tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf | 1 - .../tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf | 1 - .../tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf | 1 - .../tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf | 1 - .../data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf | 1 - .../tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf | 1 - src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf | 1 - src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf | 1 - .../tests/sample_output/py2/bgpd_frr_backend_asic.conf | 1 - .../tests/sample_output/py2/bgpd_frr_frontend_asic.conf | 1 - src/sonic-config-engine/tests/sample_output/py2/frr.conf | 1 - src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf | 1 - .../tests/sample_output/py3/bgpd_frr_backend_asic.conf | 1 - .../tests/sample_output/py3/bgpd_frr_frontend_asic.conf | 1 - src/sonic-config-engine/tests/sample_output/py3/frr.conf | 1 - 16 files changed, 16 deletions(-) diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index a7f34245873..c39115706d7 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -55,7 +55,6 @@ route-map HIDE_INTERNAL permit 20 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index d2dc9e40e89..c5ba79d3439 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -34,7 +34,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf index 27d04b953a3..77cc9d6fffd 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf @@ -12,7 +12,6 @@ ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index b85dd67a5ca..00b09bd40d9 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -34,7 +34,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf index 5ee5ce5443a..50414a89a38 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf @@ -14,7 +14,6 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00::1/128 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf index 0f7f227e0e2..37ac8827dc4 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -34,7 +34,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf index ef28d67c1c9..d8ee10ada1e 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf @@ -34,7 +34,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 04040c722c7..606788cba99 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -70,7 +70,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf index 088ac88724d..2c146698a96 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf @@ -42,7 +42,6 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-pending-fib no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf index 45cd03a540a..d793dfa39a9 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -53,7 +53,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf index 8daeff2a61e..94bd37e3b90 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -53,7 +53,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 70fcc20063e..7d985db93b9 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -61,7 +61,6 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-pending-fib no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf index e5ad8964454..e7534d4b978 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf @@ -42,7 +42,6 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf index 45cd03a540a..d793dfa39a9 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -53,7 +53,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf index 8daeff2a61e..94bd37e3b90 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -53,7 +53,6 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 3c728cca380..43bed33c4bd 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -61,7 +61,6 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes - bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! From 5c561808f584c567dd1352d3275d20c1dcdaac39 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Wed, 16 Nov 2022 16:05:16 +0000 Subject: [PATCH 5/8] fix tests Signed-off-by: Stepan Blyschak --- dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 2 +- src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf | 1 + .../tests/sample_output/py3/bgpd_frr_backend_asic.conf | 1 + .../tests/sample_output/py3/bgpd_frr_frontend_asic.conf | 1 + src/sonic-config-engine/tests/sample_output/py3/frr.conf | 1 + .../tests/sample_output/py3/t2-chassis-fe-bgpd.conf | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index 05b69458f3d..6e0b0bc6aa0 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -66,7 +66,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% block bgp_init %} bgp log-neighbor-changes - bgp suppress-fib-pendinng + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf index e7534d4b978..e5ad8964454 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf index d793dfa39a9..45cd03a540a 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf index 94bd37e3b90..8daeff2a61e 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 43bed33c4bd..3c728cca380 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -61,6 +61,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.200.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf index 20744efaa40..32a9abf88ba 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf @@ -58,6 +58,7 @@ ip prefix-list PL_LoopbackV4 permit 4.0.0.0/32 router bgp 4000 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! From 314be81f1e34e6472ae1de2eab2a608e81519462 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Thu, 17 Nov 2022 20:32:17 +0000 Subject: [PATCH 6/8] fix py2 tests Signed-off-by: Stepan Blyschak --- src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf | 1 + .../tests/sample_output/py2/bgpd_frr_backend_asic.conf | 1 + .../tests/sample_output/py2/bgpd_frr_frontend_asic.conf | 1 + src/sonic-config-engine/tests/sample_output/py2/frr.conf | 1 + .../tests/sample_output/py2/t2-chassis-fe-bgpd.conf | 1 + 5 files changed, 5 insertions(+) diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf index 2c146698a96..3828af13fd7 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr.conf @@ -42,6 +42,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf index d793dfa39a9..45cd03a540a 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf index 94bd37e3b90..8daeff2a61e 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -53,6 +53,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 7d985db93b9..9a9fc5ef897 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -61,6 +61,7 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 192.168.0.0/27 router bgp 65100 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf index 20744efaa40..32a9abf88ba 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf @@ -58,6 +58,7 @@ ip prefix-list PL_LoopbackV4 permit 4.0.0.0/32 router bgp 4000 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! From 711d48ba0fcc473f968c835136a16e995a19634b Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 21 Nov 2022 16:41:49 +0000 Subject: [PATCH 7/8] fix bgpcfgd tests Signed-off-by: Stepan Blyschak --- src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf | 1 + .../data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf | 1 + .../tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf | 1 + src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf | 1 + 8 files changed, 8 insertions(+) diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index c39115706d7..a7f34245873 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -55,6 +55,7 @@ route-map HIDE_INTERNAL permit 20 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index c5ba79d3439..d2dc9e40e89 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf index 77cc9d6fffd..27d04b953a3 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/base.conf @@ -12,6 +12,7 @@ ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index 00b09bd40d9..b85dd67a5ca 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf index 50414a89a38..5ee5ce5443a 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/ipv6_lo.conf @@ -14,6 +14,7 @@ ipv6 prefix-list PL_LoopbackV6 permit fc00::1/128 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf index 37ac8827dc4..0f7f227e0e2 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf index d8ee10ada1e..ef28d67c1c9 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf @@ -34,6 +34,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index 606788cba99..04040c722c7 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -70,6 +70,7 @@ route-map HIDE_INTERNAL permit 10 router bgp 55555 ! bgp log-neighbor-changes + bgp suppress-fib-pending no bgp default ipv4-unicast no bgp ebgp-requires-policy ! From 9f2cc0f60df8edc15531949e8a2a8924091e319f Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 25 Nov 2022 13:37:57 +0000 Subject: [PATCH 8/8] change field name Signed-off-by: Stepan Blyschak --- .../yang_model_tests/tests_config/device_metadata.json | 6 +++--- .../yang-models/sonic-device_metadata.yang | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index a6d94f332d0..800a6972a4a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -338,7 +338,7 @@ "sonic-device_metadata:DEVICE_METADATA": { "sonic-device_metadata:localhost": { "synchronous_mode": "enable", - "suppress-pending-fib": "enabled" + "suppress-fib-pending": "enabled" } } } @@ -348,7 +348,7 @@ "sonic-device_metadata:DEVICE_METADATA": { "sonic-device_metadata:localhost": { "synchronous_mode": "disable", - "suppress-pending-fib": "disabled" + "suppress-fib-pending": "disabled" } } } @@ -358,7 +358,7 @@ "sonic-device_metadata:DEVICE_METADATA": { "sonic-device_metadata:localhost": { "synchronous_mode": "disable", - "suppress-pending-fib": "enabled" + "suppress-fib-pending": "enabled" } } } diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 5905dca536c..5ff1f10a634 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -200,7 +200,7 @@ module sonic-device_metadata { By default SONiC advertises /128 subnet prefix in Loopback0 as /64 subnet route"; } - leaf suppress-pending-fib { + leaf suppress-fib-pending { description "Enable BGP suppress FIB pending feature. BGP will wait for route FIB installation before announcing routes"; type enumeration { enum enabled;