Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/common/snappi_tests/common_helpers.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,21 @@ def get_pfcwd_stats(duthost, port, prio, asic_value=None):
return pfcwd_stats


def enable_default_pfcwd_status(duthost, asic_value=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

have we explored the option of enabling it at image level?

"""
Enable PFC watchdog default status.
Note: "pfcwd start_default" has no effect on config without enabling
"default_pfcwd_status".
"""
cmd_prefix = f'sudo ip netns exec {asic_value} ' if asic_value is not None else ''
cmd = cmd_prefix + 'sonic-db-dump -n CONFIG_DB -y -k \"DEVICE_METADATA|localhost\"'
res = duthost.shell(cmd)
meta_data = json.loads(res["stdout"])
pfc_status = meta_data["DEVICE_METADATA|localhost"]["value"].get("default_pfcwd_status", "")
if pfc_status == 'disable':
cmd = cmd_prefix + 'sonic-db-cli CONFIG_DB hset \"DEVICE_METADATA|localhost\" default_pfcwd_status enable'
Copy link
Contributor

Choose a reason for hiding this comment

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

need to revert back the change once test is finished.

duthost.shell(cmd)

def start_pfcwd(duthost, asic_value=None):
"""
Start PFC watchdog with default setting
Expand All @@ -805,6 +820,7 @@ def start_pfcwd(duthost, asic_value=None):
Returns:
N/A
"""
enable_default_pfcwd_status(duthost, asic_value)
if asic_value is None:
duthost.shell('sudo pfcwd start_default')
else:
Expand Down
Loading