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 interface counters for multi ASIC devices #1013

Merged
merged 11 commits into from
Sep 9, 2020

Conversation

arlakshm
Copy link
Contributor

Add the multi ASIC specific options for the command show interface portchannel

Depends on the following PRs

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

- What I did
Add support for multi ASIC CLI options for show interface portchannels
2 new options have added

[-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

One single ASIC platform, this options are not valid, so the behavior remains unchanged

- How I did it

  • Change the portstat script to get the interface counters from all the Namespaces
  • Add support for -n and -s options to portstat scripts

This new options are ignored for single ASIC platforms

- How to verify it
Help menu

admin@sonic:~$ sudo show interface counters -h
Usage: show interface counters [OPTIONS] COMMAND [ARGS]...

  Show interface counters

Options:
  -a, --printall
  -p, --period TEXT
  -i, --interface TEXT
  -d, --display [all|frontend]    Show internal interfaces  [default:
                                  frontend]
  -n, --namespace [asic0|asic1|asic2|asic3|asic4|asic5]
                                  Namespace name or all
  --verbose                       Enable verbose output
  -?, -h, --help                  Show this message and exit.

Commands:
  errors  Show interface counters errors
  rates   Show interface counters rates
  rif     Show interface counters

show interface counters for all ports in multi ASIC device

root@sonic:/home/admin# show interface counters
Last cached time was 2020-07-30 21:47:35.745725
      IFACE    STATE    RX_OK     RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK     TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
-----------  -------  -------  ---------  ---------  --------  --------  --------  -------  ---------  ---------  --------  --------  --------
  Ethernet0        U       46   9.97 B/s      0.00%         0         0         0       78  15.79 B/s      0.00%         0         0         0
  Ethernet4        U       78  14.43 B/s      0.00%         0         0         0       46  12.18 B/s      0.00%         0         0         0
  Ethernet8        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet12        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet16        U       46  10.02 B/s      0.00%         0         0         0       46  12.18 B/s      0.00%         0         0         0
 Ethernet20        U       77  14.37 B/s      0.00%         0         0         0       78  15.79 B/s      0.00%         0         0         0
 Ethernet24        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet28        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet32        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet36        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet40        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet44        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet48        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet52        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet56        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet60        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet64        U       46  10.17 B/s      0.00%         0         0         0       78  15.82 B/s      0.00%         0         0         0
 Ethernet68        U       79  14.74 B/s      0.00%         0         0         0       46  12.21 B/s      0.00%         0         0         0
 Ethernet72        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet76        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet80        U       46  10.17 B/s      0.00%         0         0         0       80  16.03 B/s      0.00%         0         0         0
 Ethernet84        U       80  14.86 B/s      0.00%         0         0         0       46  12.21 B/s      0.00%         0         0         0
 Ethernet88        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet92        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet96        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet100        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet104        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet108        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet112        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet116        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet120        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet124        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet128        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet132        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet136        U       78  14.70 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet140        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet144        U       81  15.06 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0
Ethernet148        U       84  15.39 B/s      0.00%         0         0         0       86  16.65 B/s      0.00%         0         0         0
Ethernet152        U       78  14.70 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet156        U       79  14.83 B/s      0.00%         0         0         0       79  15.87 B/s      0.00%         0         0         0
Ethernet160        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet164        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet168        U       82  15.24 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0
Ethernet172        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet176        U       80  14.95 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0
Ethernet180        U       78  14.70 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet184        U       80  14.95 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0
Ethernet188        U       81  15.05 B/s      0.00%         0         0         0       81  16.10 B/s      0.00%         0         0         0
Ethernet192        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet196        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet200        U       80  14.95 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0
Ethernet204        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet208        U       79  14.95 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet212        U       81  15.08 B/s      0.00%         0         0         0       81  16.12 B/s      0.00%         0         0         0
Ethernet216        U       79  14.83 B/s      0.00%         0         0         0       79  15.87 B/s      0.00%         0         0         0
Ethernet220        U       82  15.19 B/s      0.00%         0         0         0       81  16.12 B/s      0.00%         0         0         0
Ethernet224        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet228        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet232        U       78  14.70 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet236        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet240        U       78  14.70 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet244        U       79  14.88 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet248        U       79  14.88 B/s      0.00%         0         0         0       78  15.75 B/s      0.00%         0         0         0
Ethernet252        U       81  14.93 B/s      0.00%         0         0         0       80  16.00 B/s      0.00%         0         0         0

**show interface counters for specific ASIC **

  • Counters for external interfaces
root@sonic:/home/admin# show interface counters -n asic0
Last cached time was 2020-07-30 21:47:35.745725
     IFACE    STATE    RX_OK     RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK     TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
----------  -------  -------  ---------  ---------  --------  --------  --------  -------  ---------  ---------  --------  --------  --------
 Ethernet0        U       48   9.99 B/s      0.00%         0         0         0       84  16.05 B/s      0.00%         0         0         0
 Ethernet4        U       84  14.74 B/s      0.00%         0         0         0       48  12.20 B/s      0.00%         0         0         0
 Ethernet8        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet12        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet16        U       48  10.04 B/s      0.00%         0         0         0       48  12.20 B/s      0.00%         0         0         0
Ethernet20        U       79  14.22 B/s      0.00%         0         0         0       80  15.66 B/s      0.00%         0         0         0
Ethernet24        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet28        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet32        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet36        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet40        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet44        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet48        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet52        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet56        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
Ethernet60        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0

Counters for internal and external interfaces


root@sonic:/home/admin# show interface counters -n asic0 -d all
Last cached time was 2020-07-30 21:47:35.745725
        IFACE    STATE    RX_OK     RX_BPS    RX_UTIL    RX_ERR    RX_DRP    RX_OVR    TX_OK     TX_BPS    TX_UTIL    TX_ERR    TX_DRP    TX_OVR
-------------  -------  -------  ---------  ---------  --------  --------  --------  -------  ---------  ---------  --------  --------  --------
    Ethernet0        U       48   9.85 B/s      0.00%         0         0         0       88  16.30 B/s      0.00%         0         0         0
    Ethernet4        U       88  15.13 B/s      0.00%         0         0         0       48  12.03 B/s      0.00%         0         0         0
    Ethernet8        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet12        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet16        U       50  10.33 B/s      0.00%         0         0         0       48  12.03 B/s      0.00%         0         0         0
   Ethernet20        U       85  14.92 B/s      0.00%         0         0         0       84  15.83 B/s      0.00%         0         0         0
   Ethernet24        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet28        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet32        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet36        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet40        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet44        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet48        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet52        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet56        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
   Ethernet60        X        0   0.00 B/s      0.00%         0         0         0        0   0.00 B/s      0.00%         0         0         0
 Ethernet-BP0        U       48  11.90 B/s      0.00%         0         0         0       48  11.80 B/s      0.00%         0         0         0
 Ethernet-BP4        U       48  11.90 B/s      0.00%         0         0         0      178  25.77 B/s      0.00%         0         0         0
 Ethernet-BP8        U       90  16.41 B/s      0.00%         0         0         0       48  11.80 B/s      0.00%         0         0         0
Ethernet-BP12        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP16        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP20        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP24        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP28        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP32        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP36        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP40        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP44        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP48        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP52        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP56        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0
Ethernet-BP60        U       48  11.90 B/s      0.00%         0         0         0       48  11.84 B/s      0.00%         0         0         0

- 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)

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

lgtm-com bot commented Jul 30, 2020

This pull request introduces 2 alerts when merging 4deb0dc into c0c3cce - view on LGTM.com

new alerts:

  • 2 for Unused import

scripts/portstat Outdated
Comment on lines 24 to 31
from utilities_common.constants import DISPLAY_EXTERNAL
from utilities_common.constants import DISPLAY_ALL
from utilities_common.constants import PORT_OBJ
from utilities_common.netstat import ns_diff, ns_brate, ns_prate, ns_util, table_as_json
from utilities_common.intf_filter import parse_interface_in_filter
from utilities_common.multi_asic import MultiAsic
from utilities_common.multi_asic import run_on_all_asics

Copy link
Contributor

Choose a reason for hiding this comment

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

some of them can be grouped togetherr

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

lgtm-com bot commented Aug 18, 2020

This pull request introduces 1 alert when merging 7e69c2d into 8768580 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lguohan
Copy link
Contributor

lguohan commented Aug 20, 2020

missing unit tests?

@arlakshm
Copy link
Contributor Author

arlakshm commented Aug 20, 2020

missing unit tests?

@lguohan, the PR 1006 has common changes required for unit testing multi asic CLIs. Once that PR is merged in I will add the unit tests for portstat for single and multi asic platform together
Issue #1066 created to track this

show/main.py Outdated
@@ -20,6 +20,7 @@
import utilities_common.cli as clicommon

import mlnx
from utilities_common.multi_asic import multi_asic_click_options
Copy link
Contributor

Choose a reason for hiding this comment

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

move up to line 21 so they are grouped.

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

lgtm-com bot commented Aug 22, 2020

This pull request introduces 1 alert when merging 0e18118 into 2c0ff92 - view on LGTM.com

new alerts:

  • 1 for Unused import

@arlakshm
Copy link
Contributor Author

missing unit tests?

@lguohan, the PR 1006 has common changes required for unit testing multi asic CLIs. Once that PR is merged in I will add the unit tests for portstat for single and multi asic platform together
Issue #1066 created to track this

added Unit test in the latest commit

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2020

This pull request introduces 2 alerts when merging 17cdd63 into 62e44d9 - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once
  • 1 for Unused import

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

lgtm-com bot commented Sep 1, 2020

This pull request fixes 1 alert when merging c68d38e into 8d6d871 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@arlakshm arlakshm linked an issue Sep 2, 2020 that may be closed by this pull request
@lgtm-com
Copy link

lgtm-com bot commented Sep 4, 2020

This pull request fixes 1 alert when merging 3e37a85 into 96cb359 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@arlakshm arlakshm merged commit 8d802d4 into sonic-net:master Sep 9, 2020
@arlakshm arlakshm deleted the masic_portstat branch September 9, 2020 12:13
arlakshm added a commit to arlakshm/sonic-utilities that referenced this pull request Sep 9, 2020
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
arlakshm added a commit that referenced this pull request Sep 10, 2020
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
Add support for multi ASIC CLI options for show interface portchannels. This PR is port of #1013 to 201911
- Change the portstat script to get the interface counters from all the Namespaces
- Add support for -n and -s options to portstat scripts
- Add unit test for single and multi asic
@msosyak msosyak mentioned this pull request Sep 23, 2020
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.

[portstat] Add Unit Test
4 participants