Skip to content

Added show ip/v6 route summary support for multi-asic platform#1320

Merged
gechiang merged 2 commits intosonic-net:masterfrom
gechiang:master
Dec 23, 2020
Merged

Added show ip/v6 route summary support for multi-asic platform#1320
gechiang merged 2 commits intosonic-net:masterfrom
gechiang:master

Conversation

@gechiang
Copy link
Contributor

- What I did
Added Multi-ASIC support of handling "show ip/v6 route summary"
This was not supported for multi-ASIC platform previously.
When running this cmd under multi-ASIC platform the following output are expected:

admin@SONiC:$ show ip route summary -d all
asic0:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic1:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic2:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 43                   43
ibgp                 6408                 6408
------
Totals               6467                 6466


asic3:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 42                   42
ibgp                 6409                 6409
------
Totals               6467                 6466


asic4:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 0                    0
ibgp                 6462                 6458
------
Totals               6470                 6465


asic5:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 0                    0
ibgp                 6462                 6458
------
Totals               6470                 6465


admin@SONiC:$ show ip route summary -n asic2
asic2:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 43                   43
ibgp                 6408                 6408
------
Totals               6467                 6466


admin@SONiC:$ show ip route summary
asic0:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic1:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic2:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 43                   43
ibgp                 6408                 6408
------
Totals               6467                 6466


asic3:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 42                   42
ibgp                 6409                 6409
------
Totals               6467                 6466


admin@SONiC:$
 

- How to verify it
Perform "show ip/v6 route summary" on multi-asic platform to see that this option is now supported.
Before the change:

admin@SONiC:~$ show ip route summary
% Unknown command: show ip route sum 

After the added support:

admin@SONiC:~$ show ip route summary
asic0:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic1:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            6                    6
static               1                    0
ebgp                 6371                 6371
ibgp                 88                   88
------
Totals               6467                 6466


asic2:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 43                   43
ibgp                 6408                 6408
------
Totals               6467                 6466


asic3:
Route Source         Routes               FIB  (vrf default)
kernel               1                    1
connected            14                   14
static               1                    0
ebgp                 42                   42
ibgp                 6409                 6409
------
Totals               6467                 6466


admin@SONiC:$

@gechiang
Copy link
Contributor Author

retest default please

@gechiang
Copy link
Contributor Author

retest this please

Copy link
Contributor

@arlakshm arlakshm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as comments

error_msg = output
print(error_msg)
return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one of the bgp instances in the middle returns error. Output from the remaining instances wont be displayed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That is the intention. Most of the case when the FRR of that namespace reject the cmd is due to the parameter the user specified. and if one name space rejects it, all other namespace will reject the same way so it is best to stop on first error. Also, if in case the user thinks the issue is only specific to the failing name space but not on other name space, user can always use -n option to display from which namespace he likes to see.

back_end_intf_set = None
# get all the other arguments except json that needs to be the last argument of the cmd if present
# Handling of multi-asic show ip/v6 route summary will print directly FRR result of each namespace
check_summary_set = set(["sum", "summ", "summa", "summar", "summary"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding the check for argument is "summary" here. Can we check if the args is empty to aggregate the routes from all namesapces for all other argument we can display the output as-is for each namespace ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also like to aggregate the routes from all namespaces for the case where the user specified specific route or in json format. So for these cases the argument will not be empty but we still like to combine the output from all namespaces and display it. Are you saying that other than these cases we should always default to let each specified namespace FRR to handle those additional parameter options similar to the "summary" case? There will be cases where the "json" option will also be honored and for those we will NOT combine the jason output but have each one displayed based on its own name space which will result to multiple json outputs depends on namespaces involved... Is this acceptable? Or should we handle this "summary" as designed for now and make additional enhancement as we see there is a need to do so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arlakshm I have made the changes to do as you suggested. So other than the specific route specified and the json option for "show ip/v6 route" command such as "summary, table, tables,...etc" will now be all handled by the corresponding namespace FRR directly. This should also be easier when SONiC decided to upgrade to higher FRR version in the future.

found_json = 1
elif str(arg) == "tables":
found_tables = 1
elif set([str(arg)]).issubset(check_summary_set):
Copy link
Contributor

@smaheshm smaheshm Dec 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the logic. Why not:

if str(arg) in check_summary_set:

or

if "summary".find(str(arg)) == 0:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is to allow partial matching so that user need not specify the complete word "summary".
This logic is needed so that if user specify something like "umm" it will not be accepted. it needs to start with "sum" and maybe additional matching chars after "sum".

…ow ip/v6 route cmd will default to be handled by the corresponding namespace FRR directly
@gechiang
Copy link
Contributor Author

retest this please

Copy link
Contributor

@arlakshm arlakshm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gechiang gechiang merged commit d63d11d into sonic-net:master Dec 23, 2020
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
…-net#1320)

* Added show ip/v6 route summary support for multi-asic platform by making any additional parameter handling other than specific route cases or json format to be handled by the corresponding namespace FRR directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants