Skip to content

[201911]show interface counters for multi ASIC devices #1104

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

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

arlakshm
Copy link
Contributor

@arlakshm arlakshm commented Sep 9, 2020

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- What I did
port #1013 to 201911
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 <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2020

This pull request introduces 1 alert and fixes 1 when merging fa44127 into 38f474e - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Result of integer division may be truncated

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.

Minor comment. Also, LGTM is complaining that the swsssdk module is unused. You didn't add it in this PR, but maybe you could remove it?

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm
Copy link
Contributor Author

arlakshm commented Sep 9, 2020

Minor comment. Also, LGTM is complaining that the swsssdk module is unused. You didn't add it in this PR, but maybe you could remove it?

removed the 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.

Looks good to me. Please wait for other reviewers.

@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2020

This pull request fixes 1 alert when merging 1ba78ee into 38f474e - view on LGTM.com

fixed alerts:

  • 1 for Result of integer division may be truncated

self.db.connect(self.db.COUNTERS_DB)
self.db.connect(self.db.APPL_DB)
def __init__(self, namespace, display_option):
self.db = None
Copy link
Contributor

Choose a reason for hiding this comment

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

self.config_db = None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

config_db is not used in here.

mutli_asic_intf_counters_after_clear = """\
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 0 0.00 B/s 0.00% 0 0 N/A 0 0.00 B/s 0.00% N/A N/A N/A
Copy link
Contributor

Choose a reason for hiding this comment

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

some non N/A would be good, not a big deal

Copy link
Contributor

@smaheshm smaheshm left a comment

Choose a reason for hiding this comment

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

optional minor changes.

@arlakshm arlakshm merged commit cd8b421 into sonic-net:201911 Sep 10, 2020
@arlakshm arlakshm deleted the masic_portstat_201911 branch September 10, 2020 05:58
abdosi pushed a commit that referenced this pull request Sep 11, 2020
abdosi added a commit that referenced this pull request Sep 19, 2020
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
 update the environment variable in the teardown (sonic-net#1101)
 Fix for show interface portchannel now working on 201911 (sonic-net#1105)
 [201911]show interface counters for multi ASIC devices (sonic-net#1104)

Signed-off-by: Abhishek Dosi <[email protected]>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
update the environment variable in the teardown (sonic-net#1101)
Fix for show interface portchannel now working on 201911 (sonic-net#1105)
Revert "Pfcstat (sonic-net#1097)"
Revert " [201911]show interface counters for multi ASIC devices
      (sonic-net#1104)"

Signed-off-by: Abhishek Dosi <[email protected]>
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Apr 28, 2022
Revert "Revert " [201911]show interface counters for multi ASIC devices
(sonic-net#1104)""
 Revert "Revert "Pfcstat (sonic-net#1097)""
  [show] Fix 'show int neighbor expected' (sonic-net#1106)
   Update argument for docker exec it->i (sonic-net#1118)
     Update to make config load/reload backward compatible. (sonic-net#1115)
     Handling deletion of Port Channel before deletion of its members
     (sonic-net#1062)
    Skip default route present in ASIC-DB but not in APP-DB. (sonic-net#1107)
     [CLI][PFCWD][Multi-ASIC] Added multi ASIC support to 'pfcwd' CLI
     (sonic-net#1102)
       [201911]  Multi asic platform config interface portchannel, show
       transceiver  (sonic-net#1087)
       [drop counters] Fix configuration for counters with lowercase
       names (sonic-net#1103)

Signed-off-by: Abhishek Dosi <[email protected]>
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