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

[pfcwd] Fix test_pfcwd_mmu_change IndexError #4465

Merged
merged 1 commit into from
Oct 25, 2021
Merged
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
14 changes: 11 additions & 3 deletions tests/pfcwd/test_pfcwd_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"forward": "Verify proper function of forward action"
}
MMU_ACTIONS = ['change', 'noop', 'restore', 'noop']
DB_SEPARATORS = {'0': ':', '4': '|'}
BF_PROFILE = "BUFFER_PROFILE|{}"
BF_PROFILE_TABLE = "BUFFER_PROFILE_TABLE:{}"

pytestmark = [
pytest.mark.disable_loganalyzer,
Expand Down Expand Up @@ -128,10 +131,11 @@ def update_alpha(dut, port, profile, value):
db = "0"
else:
db = "4"
table_template = BF_PROFILE if db == "4" else BF_PROFILE_TABLE

asic.run_redis_cmd(
argv = [
"redis-cli", "-n", db, "HSET", profile, "dynamic_th", value
"redis-cli", "-n", db, "HSET", table_template.format(profile), "dynamic_th", value
]
)

Expand Down Expand Up @@ -162,11 +166,15 @@ def get_mmu_params(dut, port):
"redis-cli", "-n", db, "HGET",
pg_pattern.format(port), "profile"
]
)[0].encode("utf-8")[1:-1]
)[0].encode("utf-8")

if BF_PROFILE[:-2] in pg_profile or BF_PROFILE_TABLE[:-2] in pg_profile:
pg_profile = pg_profile.split(DB_SEPARATORS[db])[-1][:-1]
table_template = BF_PROFILE if db == "4" else BF_PROFILE_TABLE

alpha = asic.run_redis_cmd(
argv = [
"redis-cli", "-n", db, "HGET", pg_profile, "dynamic_th"
"redis-cli", "-n", db, "HGET", table_template.format(pg_profile), "dynamic_th"
]
)[0].encode("utf-8")

Expand Down