Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SHOW][BGP] support show ip(v6) bgp summary for multi asic platform #1064

Merged
merged 3 commits into from
Aug 25, 2020

Conversation

arlakshm
Copy link
Contributor

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com

- What I did
This PR has following changes

  • Support show ip(v6) bgp summary for multi asic platforms
  • For FRR bgp containers, get the bgp summary in json and display to the user
  • Add unit test for show ip bgp summary

- How I did it

  • Support show ip(v6) bgp summary for multi asic platforms
    • Add the following 2 multi asic options to the cli command
      • [-n, --namespace] to allow user to display the information for given namespaces
        If this option is not present the information from all the namespaces will be displayed

      • [-d, --display] to allow user to display information related both internal and external interfaces
        If this option is not present only external interfaces/neighbors will be display

  • For FRR bgp containers, get the bgp summary in json and display to the user
    • add a new file bgp_util.py to have all the common bgp related functions.
    • add new functions to get bgp summary from FRR in json, parse the json and render the output
  • Add unit test for show ip(v4) bgp summary
    • add new unit test to show ip(v4) bgp summary

- How to verify it

  • Multi ASIC verify on the DUT
    Sample output
admin@sonic:~$ show ip bgp summary

IPv4 Unicast Summary:
asic0: BGP router identifier 10.0.107.16, local AS number 65100 vrf-id 0
BGP table version 13312
asic1: BGP router identifier 10.0.107.17, local AS number 65100 vrf-id 0
BGP table version 21365
asic2: BGP router identifier 10.0.107.18, local AS number 65100 vrf-id 0
BGP table version 8751
asic3: BGP router identifier 10.0.107.19, local AS number 65100 vrf-id 0
BGP table version 8766
RIB entries 52508, using 9661472 bytes of memory
Peers 32, using 669440 KiB of memory
Peer groups 16, using 1024 bytes of memory


Neighbhor       V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down      State/PfxRcd  NeighborName
------------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.10.192.33    4  64001         18       3261         0      0       0  00:00:37                6  ARISTA01T0
10.10.192.35    4  64002         18       3261         0      0       0  00:00:36                6  ARISTA02T0
10.10.192.37    4  64003         17       3258         0      0       0  00:00:34                7  ARISTA03T0
10.10.192.39    4  64004         17       3258         0      0       0  00:00:34                6  ARISTA04T0
10.10.192.41    4  64005         20       3266         0      0       0  00:00:40                7  ARISTA05T0
10.10.192.43    4  64006         19       3266         0      0       0  00:00:39                6  ARISTA06T0
10.10.192.45    4  64007         19       3266         0      0       0  00:00:40                6  ARISTA07T0
10.10.192.47    4  64008         19       3266         0      0       0  00:00:40                6  ARISTA08T0
10.10.192.49    4  64009         19       3266         0      0       0  00:00:39                6  ARISTA09T0
10.10.192.51    4  64010         19       3266         0      0       0  00:00:41                6  ARISTA10T0
10.10.192.53    4  64011         19       3264         0      0       0  00:00:41                6  ARISTA11T0
10.10.192.55    4  64012         19       3264         0      0       0  00:00:41                6  ARISTA12T0
10.10.192.57    4  64013         19       3264         0      0       0  00:00:42                6  ARISTA13T0
10.10.192.59    4  64014         19       3264         0      0       0  00:00:41                6  ARISTA14T0
10.10.192.61    4  64015         18       3260         0      0       0  00:00:38                6  ARISTA15T0
10.10.192.63    4  64016         18       3260         0      0       0  00:00:39                6  ARISTA16T0
10.10.192.65    4  64017         17       3258         0      0       0  00:00:35                6  ARISTA17T0
10.10.192.67    4  64018         17       3258         0      0       0  00:00:35                6  ARISTA18T0
10.10.192.69    4  64019         17       3258         0      0       0  00:00:34                6  ARISTA19T0
10.10.192.71    4  64020         16       3257         0      0       0  00:00:32                6  ARISTA20T0
10.106.0.1      4  65200       3232       6488         0      0       0  00:01:20             6402  ARISTA01T2
10.106.0.5      4  65200       3219       3376         0      0       0  00:00:40             6402  ARISTA03T2
10.106.0.9      4  65200       3219       3522         0      0       0  00:00:40             6402  ARISTA05T2
10.106.0.13     4  65200       3219       3522         0      0       0  00:00:41             6402  ARISTA07T2

admin@sonic:~$ show ip bgp summary -n asic0

IPv4 Unicast Summary:
asic0: BGP router identifier 10.0.107.16, local AS number 65100 vrf-id 0
BGP table version 39071
RIB entries 77, using 14168 bytes of memory
Peers 4, using 83680 KiB of memory
Peer groups 4, using 256 bytes of memory

Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down    State/PfxRcd    NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.106.0.1     4  65200       3244       6504         0      0       0  00:15:27   Idle (Admin)    ARISTA01T2
10.106.0.5     4  65200       3231       4302         0      0       0  00:15:26   Idle (Admin)    ARISTA03T2
admin@sonic:~$ show ip bgp summary -n asic0 -d all

IPv4 Unicast Summary:
asic0: BGP router identifier 10.0.107.16, local AS number 65100 vrf-id 0
BGP table version 39071
RIB entries 77, using 14168 bytes of memory
Peers 4, using 83680 KiB of memory
Peer groups 4, using 256 bytes of memory


Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down    State/PfxRcd    NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.0.107.0     4  65100       9713       9638         0      0       0  1d05h57m   38              ASIC4
10.0.107.2     4  65100       9704       9635         0      0       0  1d05h57m   38              ASIC5
10.106.0.1     4  65200       3244       6504         0      0       0  00:15:31   Idle (Admin)    ARISTA01T2
10.106.0.5     4  65200       3231       4302         0      0       0  00:15:30   Idle (Admin)    ARISTA03T2

UT results

tests/acl_loader_test.py ....                                            [  3%]
tests/aclshow_test.py ...........                                        [ 11%]
tests/bgp_commands_test.py ...                                           [ 13%]
tests/config_mgmt_test.py ....                                           [ 16%]
tests/config_test.py ..                                                  [ 18%]
tests/drops_group_test.py .......                                        [ 23%]
tests/feature_test.py ..........                                         [ 31%]
tests/filter_fdb_entries_test.py ..........                              [ 38%]
tests/gearbox_test.py ..                                                 [ 40%]
tests/interfaces_test.py .............                                   [ 50%]
tests/intfstat_test.py ........                                          [ 56%]
tests/intfutil_test.py ...............                                   [ 67%]
tests/port2alias_test.py ....                                            [ 70%]
tests/psu_test.py ...                                                    [ 72%]
tests/sflow_test.py ..                                                   [ 74%]
tests/sfp_test.py ...                                                    [ 76%]
tests/show_breakout_test.py ..                                           [ 78%]
tests/show_platform_test.py .                                            [ 78%]
tests/vlan_test.py ............................                          [100%]

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

Add Unit test for "show ip bgp summary" and "show ipv6 bgp summary"

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 21, 2020

This pull request introduces 3 alerts when merging 05a87fb into 5263b54 - view on LGTM.com

new alerts:

  • 3 for Unused import

pavel-shirshov
pavel-shirshov previously approved these changes Aug 21, 2020
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

LGTM
Please wait other reviews.

Comment on lines 10 to 11
import utilities_common.bgp_util as bgp_util
import utilities_common.constants as constants
Copy link
Contributor

Choose a reason for hiding this comment

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

These are also imported on lines 2-3. Why import twice?

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 24, 2020

This pull request introduces 3 alerts when merging 2f4f995 into 3e52604 - view on LGTM.com

new alerts:

  • 3 for Unused import

Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

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

LGTM. Please wait for other reviews.

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