-
Notifications
You must be signed in to change notification settings - Fork 850
[GCU E2E test] add stop pfcwd test #7308
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
Changes from all commits
618bef2
bf94752
a4cb4d7
4eb2479
5dab9a1
96676e6
362b7b1
d24bda9
0d1120e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,13 +120,52 @@ def get_new_interval(duthost, is_valid): | |
return min(detection_time, restoration_time) + 10 | ||
|
||
|
||
def test_stop_pfcwd(duthost, ensure_dut_readiness): | ||
start_pfcwd = duthost.shell('config pfcwd start_default') | ||
pytest_assert(not start_pfcwd['rc'], "Failed to start default pfcwd config") | ||
pfcwd_config = duthost.shell("show pfcwd config") | ||
pytest_assert(not pfcwd_config['rc'], "Unable to read pfcwd config") | ||
|
||
for line in pfcwd_config['stdout_lines']: | ||
if line.startswith('Ethernet'): | ||
interface = line.split()[0] | ||
break | ||
else: | ||
pytest_assert(False, "No interface found running pfcwd - unable to run test") | ||
|
||
json_patch = [ | ||
{ | ||
"op": "remove", | ||
"path": "/PFC_WD/{}/detection_time".format(interface), | ||
}, | ||
{ | ||
"op": "remove", | ||
"path": "/PFC_WD/{}/restoration_time".format(interface), | ||
}, | ||
{ | ||
"op": "remove", | ||
"path": "/PFC_WD/{}/action".format(interface) | ||
} | ||
] | ||
|
||
try: | ||
tmpfile = generate_tmpfile(duthost) | ||
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile) | ||
expect_op_success(duthost, output) | ||
pfcwd_updated_config = duthost.shell("show pfcwd config") | ||
pytest_assert(not pfcwd_config['rc'], "Unable to read updated pfcwd config") | ||
pytest_assert(interface not in pfcwd_updated_config['stdout'].split(), "pfcwd unexpectedly still running on interface {}".format(interface)) | ||
finally: | ||
delete_tmpfile(duthost, tmpfile) | ||
Comment on lines
+136
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this whole code needs to be indented. Needs to move under the 'for' block There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test only intends to test one interface, as the flow would be the same for all interfaces. I added a break statement to the for loop to stop once the first interface is identified for test |
||
|
||
|
||
@pytest.mark.parametrize("operation", ["add", "replace"]) | ||
@pytest.mark.parametrize("field_pre_status", ["existing", "nonexistent"]) | ||
@pytest.mark.parametrize("is_valid_config_update", [True, False]) | ||
def test_pfcwd_interval_config_updates(duthost, ensure_dut_readiness, operation, field_pre_status, is_valid_config_update): | ||
new_interval = get_new_interval(duthost, is_valid_config_update) | ||
|
||
operation_to_new_value_map = {"add": "{}".format(new_interval), "replace": "{}".format(new_interval), "remove": ""} | ||
operation_to_new_value_map = {"add": "{}".format(new_interval), "replace": "{}".format(new_interval)} | ||
detection_time, restoration_time = get_detection_restoration_times(duthost) | ||
pre_status = max(detection_time, restoration_time) | ||
field_pre_status_to_value_map = {"existing": "{}".format(pre_status), "nonexistent": ""} | ||
|
Uh oh!
There was an error while loading. Please reload this page.