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

[CLI][PFCWD][Multi-ASIC] Added multi ASIC support to 'pfcwd' CLI command #1080

Merged
merged 13 commits into from
Sep 3, 2020
Merged
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