Skip to content

Commit 06965df

Browse files
Remove suppress-fib-pending CLI and make route_check.py check suppress-fib in BGP configuration (sonic-net#3331)
What I did Revert suppress FIB pending feature Why I did it Some unresolved FRR issues in current version How I verified it Build and run [route_check] check if suppress fib is enabled in bgp Signed-off-by: Stepan Blyschak <[email protected]>
1 parent 3a8f0be commit 06965df

File tree

6 files changed

+31
-111
lines changed

6 files changed

+31
-111
lines changed

config/main.py

-12
Original file line numberDiff line numberDiff line change
@@ -2336,18 +2336,6 @@ def synchronous_mode(sync_mode):
23362336
config reload -y \n
23372337
Option 2. systemctl restart swss""" % sync_mode)
23382338

2339-
#
2340-
# 'suppress-fib-pending' command ('config suppress-fib-pending ...')
2341-
#
2342-
@config.command('suppress-fib-pending')
2343-
@click.argument('state', metavar='<enabled|disabled>', required=True, type=click.Choice(['enabled', 'disabled']))
2344-
@clicommon.pass_db
2345-
def suppress_pending_fib(db, state):
2346-
''' Enable or disable pending FIB suppression. Once enabled, BGP will not advertise routes that are not yet installed in the hardware '''
2347-
2348-
config_db = db.cfgdb
2349-
config_db.mod_entry('DEVICE_METADATA' , 'localhost', {"suppress-fib-pending" : state})
2350-
23512339
#
23522340
# 'yang_config_validation' command ('config yang_config_validation ...')
23532341
#

doc/Command-Reference.md

-38
Original file line numberDiff line numberDiff line change
@@ -2610,26 +2610,6 @@ This command displays the routing policy that takes precedence over the other ro
26102610
Exit routemap
26112611
```
26122612
2613-
**show suppress-fib-pending**
2614-
2615-
This command is used to show the status of suppress pending FIB feature.
2616-
When enabled, BGP will not advertise routes which aren't yet offloaded.
2617-
2618-
- Usage:
2619-
```
2620-
show suppress-fib-pending
2621-
```
2622-
2623-
- Examples:
2624-
```
2625-
admin@sonic:~$ show suppress-fib-pending
2626-
Enabled
2627-
```
2628-
```
2629-
admin@sonic:~$ show suppress-fib-pending
2630-
Disabled
2631-
```
2632-
26332613
**show bgp device-global**
26342614
26352615
This command displays BGP device global configuration.
@@ -2742,24 +2722,6 @@ This command is used to remove particular IPv4 or IPv6 BGP neighbor configuratio
27422722
admin@sonic:~$ sudo config bgp remove neighbor SONIC02SPINE
27432723
```
27442724

2745-
**config suppress-fib-pending**
2746-
2747-
This command is used to enable or disable announcements of routes not yet installed in the HW.
2748-
Once enabled, BGP will not advertise routes which aren't yet offloaded.
2749-
2750-
- Usage:
2751-
```
2752-
config suppress-fib-pending <enabled|disabled>
2753-
```
2754-
2755-
- Examples:
2756-
```
2757-
admin@sonic:~$ sudo config suppress-fib-pending enabled
2758-
```
2759-
```
2760-
admin@sonic:~$ sudo config suppress-fib-pending disabled
2761-
```
2762-
27632725
**config bgp device-global tsa/w-ecmp**
27642726

27652727
This command is used to manage BGP device global configuration.

scripts/route_check.py

+22-10
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,16 @@ def get_asicdb_routes(namespace):
328328
return (selector, subs, sorted(rt))
329329

330330

331+
def is_bgp_suppress_fib_pending_enabled(namespace):
332+
"""
333+
Retruns True if FIB suppression is enabled in BGP config, False otherwise
334+
"""
335+
show_run_cmd = ['show', 'runningconfiguration', 'bgp', '-n', namespace]
336+
337+
output = subprocess.check_output(show_run_cmd, text=True)
338+
return 'bgp suppress-fib-pending' in output
339+
340+
331341
def is_suppress_fib_pending_enabled(namespace):
332342
"""
333343
Returns True if FIB suppression is enabled, False otherwise
@@ -781,18 +791,20 @@ def check_routes(namespace):
781791
results[namespace] = {}
782792
results[namespace]["Unaccounted_ROUTE_ENTRY_TABLE_entries"] = rt_asic_miss
783793

784-
rt_frr_miss = check_frr_pending_routes(namespace)
794+
if is_bgp_suppress_fib_pending_enabled(namespace):
795+
rt_frr_miss = check_frr_pending_routes(namespace)
785796

786-
if rt_frr_miss:
787-
if namespace not in results:
788-
results[namespace] = {}
789-
results[namespace]["missed_FRR_routes"] = rt_frr_miss
797+
if rt_frr_miss:
798+
if namespace not in results:
799+
results[namespace] = {}
800+
results[namespace]["missed_FRR_routes"] = rt_frr_miss
790801

791-
if results:
792-
if rt_frr_miss and not rt_appl_miss and not rt_asic_miss:
793-
print_message(syslog.LOG_ERR, "Some routes are not set offloaded in FRR{} but all routes in APPL_DB and ASIC_DB are in sync".format(namespace))
794-
if is_suppress_fib_pending_enabled(namespace):
795-
mitigate_installed_not_offloaded_frr_routes(namespace, rt_frr_miss, rt_appl)
802+
if results:
803+
if rt_frr_miss and not rt_appl_miss and not rt_asic_miss:
804+
print_message(syslog.LOG_ERR, "Some routes are not set offloaded in FRR{} but all "
805+
"routes in APPL_DB and ASIC_DB are in sync".format(namespace))
806+
if is_suppress_fib_pending_enabled(namespace):
807+
mitigate_installed_not_offloaded_frr_routes(namespace, rt_frr_miss, rt_appl)
796808

797809
if results:
798810
print_message(syslog.LOG_WARNING, "Failure results: {", json.dumps(results, indent=4), "}")

show/main.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def get_config_json_by_namespace(namespace):
165165
iface_alias_converter = lazy_object_proxy.Proxy(lambda: clicommon.InterfaceAliasConverter())
166166

167167
#
168-
# Display all storm-control data
168+
# Display all storm-control data
169169
#
170170
def display_storm_all():
171171
""" Show storm-control """
@@ -465,7 +465,7 @@ def is_mgmt_vrf_enabled(ctx):
465465
return False
466466

467467
#
468-
# 'storm-control' group
468+
# 'storm-control' group
469469
# "show storm-control [interface <interface>]"
470470
#
471471
@cli.group('storm-control', invoke_without_command=True)
@@ -2111,7 +2111,7 @@ def summary(db):
21112111
key_values = key.split('|')
21122112
values = db.db.get_all(db.db.STATE_DB, key)
21132113
if "local_discriminator" not in values.keys():
2114-
values["local_discriminator"] = "NA"
2114+
values["local_discriminator"] = "NA"
21152115
bfd_body.append([key_values[3], key_values[2], key_values[1], values["state"], values["type"], values["local_addr"],
21162116
values["tx_interval"], values["rx_interval"], values["multiplier"], values["multihop"], values["local_discriminator"]])
21172117

@@ -2142,24 +2142,13 @@ def peer(db, peer_ip):
21422142
key_values = key.split(delimiter)
21432143
values = db.db.get_all(db.db.STATE_DB, key)
21442144
if "local_discriminator" not in values.keys():
2145-
values["local_discriminator"] = "NA"
2145+
values["local_discriminator"] = "NA"
21462146
bfd_body.append([key_values[3], key_values[2], key_values[1], values.get("state"), values.get("type"), values.get("local_addr"),
21472147
values.get("tx_interval"), values.get("rx_interval"), values.get("multiplier"), values.get("multihop"), values.get("local_discriminator")])
21482148

21492149
click.echo(tabulate(bfd_body, bfd_headers))
21502150

21512151

2152-
# 'suppress-fib-pending' subcommand ("show suppress-fib-pending")
2153-
@cli.command('suppress-fib-pending')
2154-
@clicommon.pass_db
2155-
def suppress_pending_fib(db):
2156-
""" Show the status of suppress pending FIB feature """
2157-
2158-
field_values = db.cfgdb.get_entry('DEVICE_METADATA', 'localhost')
2159-
state = field_values.get('suppress-fib-pending', 'disabled').title()
2160-
click.echo(state)
2161-
2162-
21632152
# asic-sdk-health-event subcommand ("show asic-sdk-health-event")
21642153
@cli.group(cls=clicommon.AliasedGroup)
21652154
def asic_sdk_health_event():

tests/route_check_test.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,11 @@ def run_test(self, ct_data):
252252

253253
def mock_check_output(self, ct_data, *args, **kwargs):
254254
ns = self.extract_namespace_from_args(args[0])
255-
routes = ct_data.get(FRR_ROUTES, {}).get(ns, {})
256-
return json.dumps(routes)
255+
if 'show runningconfiguration bgp' in ' '.join(args[0]):
256+
return 'bgp suppress-fib-pending'
257+
else:
258+
routes = ct_data.get(FRR_ROUTES, {}).get(ns, {})
259+
return json.dumps(routes)
257260

258261
def assert_results(self, ct_data, ret, res):
259262
expect_ret = ct_data.get(RET, 0)

tests/suppress_pending_fib_test.py

-34
This file was deleted.

0 commit comments

Comments
 (0)