Skip to content

Commit

Permalink
[CLI][PFCWD][Multi-ASIC] Added multi ASIC support to 'pfcwd' CLI comm…
Browse files Browse the repository at this point in the history
…and (sonic-net#1080)

[CLI][PFCWD][Multi ASIC] Added multi ASIC support to the following CLI command:

>> show pfcwd config
>> show pfcwd stats.

* Added multi ASIC support to following script:

>> pfcwd

* Added unit tests for 'pfcwd show' commands.
  • Loading branch information
smaheshm authored Sep 3, 2020
1 parent 5aa3e88 commit 8152cec
Show file tree
Hide file tree
Showing 9 changed files with 2,830 additions and 260 deletions.
644 changes: 414 additions & 230 deletions pfcwd/main.py

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import utilities_common.cli as clicommon
from utilities_common.db import Db
from utilities_common.multi_asic import multi_asic_click_options
from utilities_common import multi_asic as multi_asic_util

import feature
import interfaces
Expand Down Expand Up @@ -372,7 +372,7 @@ def pfc():

# 'counters' subcommand ("show interfaces pfccounters")
@pfc.command()
@multi_asic_click_options
@multi_asic_util.multi_asic_click_options
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def counters(namespace, display, verbose):
"""Show pfc counters"""
Expand Down Expand Up @@ -416,20 +416,26 @@ def pfcwd():
pass

@pfcwd.command()
@multi_asic_util.multi_asic_click_options
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def config(verbose):
def config(namespace, display, verbose):
"""Show pfc watchdog config"""

cmd = "pfcwd show config"
cmd = "pfcwd show config -d {}".format(display)
if namespace is not None:
cmd += " -n {}".format(namespace)

run_command(cmd, display_cmd=verbose)

@pfcwd.command()
@multi_asic_util.multi_asic_click_options
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def stats(verbose):
def stats(namespace, display, verbose):
"""Show pfc watchdog stats"""

cmd = "pfcwd show stats"
cmd = "pfcwd show stats -d {}".format(display)
if namespace is not None:
cmd += " -n {}".format(namespace)

run_command(cmd, display_cmd=verbose)

Expand Down
26 changes: 25 additions & 1 deletion tests/mock_tables/asic0/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,29 @@
},
"PORTCHANNEL_MEMBER|PortChannel4001|Ethernet-BP4": {
"NULL": "NULL"
},
"PFC_WD|Ethernet0": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|Ethernet4": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|Ethernet-BP0": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|Ethernet-BP4": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|GLOBAL": {
"BIG_RED_SWITCH": "enable",
"POLL_INTERVAL": "199"
}
}
}
1,410 changes: 1,410 additions & 0 deletions tests/mock_tables/asic0/counters_db.json

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion tests/mock_tables/asic1/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,19 @@
},
"PORTCHANNEL_MEMBER|PortChannel4009|Ethernet-BP260" : {
"NULL": "NULL"
},
"PFC_WD|Ethernet-BP256": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|Ethernet-BP260": {
"action": "drop",
"detection_time": "200",
"restoration_time": "200"
},
"PFC_WD|GLOBAL": {
"BIG_RED_SWITCH": "enable",
"POLL_INTERVAL": "199"
}
}
}
Loading

0 comments on commit 8152cec

Please sign in to comment.