-
Notifications
You must be signed in to change notification settings - Fork 48
Added WRED with affected Leaf/LC/FM model check #379
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
Open
Priyanka-Patil14
wants to merge
16
commits into
datacenter:v4.2.0-dev
Choose a base branch
from
Priyanka-Patil14:bugfix/CSCwt50713
base: v4.2.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4ba163b
353 the script incorrectly detects vpc and port channel interfaces as…
monrog2 1595695
print cleanup
monrog2 7d7e263
Added WRED with affected Leaf/LC/FM model check
Priyanka-Patil14 6468f96
Addressed PR review comments
Priyanka-Patil14 b98e882
Addressed PR review comments
Priyanka-Patil14 592b918
Addressed PR review comments and updated the docs
Priyanka-Patil14 67a0b66
Upated the message
Priyanka-Patil14 49d3ed0
Addressed review comments
Priyanka-Patil14 b256105
Refactored result variable in wred_affected_model_check
Priyanka-Patil14 3ae8178
Updated wred_affected_model_check
Priyanka-Patil14 f10ba81
Addressed PR review comments
Priyanka-Patil14 82e6a08
Remove the sort method
Priyanka-Patil14 f2c2ff7
Addressed PR review comments
Priyanka-Patil14 b5ea520
Fix non-ASCII char in test comment
Priyanka-Patil14 abf0dc8
Fixed duplicate entries
Priyanka-Patil14 1ab5633
Address PR review comments
Priyanka-Patil14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/checks/wred_affected_model_check/eqptFC_affected.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [ | ||
| { | ||
| "eqptFC": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001/sys/ch/fcslot-1/fc", | ||
| "model": "N9K-C9508-FM-E" | ||
| } | ||
| } | ||
| } | ||
| ] |
18 changes: 18 additions & 0 deletions
18
tests/checks/wred_affected_model_check/eqptFC_duplicate.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [ | ||
| { | ||
| "eqptFC": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001/sys/ch/fcslot-2/fc", | ||
| "model": "N9K-C9508-FM-E" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "eqptFC": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001/sys/ch/fcslot-6/fc", | ||
| "model": "N9K-C9508-FM-E" | ||
| } | ||
| } | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [] |
|
Priyanka-Patil14 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [ | ||
| { | ||
| "eqptFC": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001/sys/ch/fcslot-1/fc", | ||
| "model": "N9K-C9508-FM-E" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "eqptFC": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001/sys/ch/fcslot-2/fc", | ||
| "model": "N9K-C9504-FM-G" | ||
| } | ||
| } | ||
| } | ||
| ] |
13 changes: 13 additions & 0 deletions
13
tests/checks/wred_affected_model_check/fabricNode_spine.json
|
Priyanka-Patil14 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [ | ||
| { | ||
| "fabricNode": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-1001", | ||
| "id": "1001", | ||
| "name": "spine1001", | ||
| "role": "spine", | ||
| "model": "N9K-C9504" | ||
| } | ||
| } | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [ | ||
| { | ||
| "qosCong": { | ||
| "attributes": { | ||
| "algo": "tail-drop" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "qosCong": { | ||
| "attributes": { | ||
| "algo": "wred" | ||
| } | ||
| } | ||
| } | ||
| ] |
9 changes: 9 additions & 0 deletions
9
tests/checks/wred_affected_model_check/qosCong_tail_drop.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "qosCong": { | ||
| "attributes": { | ||
| "algo": "tail-drop" | ||
| } | ||
| } | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| { | ||
| "qosCong": { | ||
| "attributes": { | ||
| "algo": "wred" | ||
| } | ||
| } | ||
| } | ||
| ] |
121 changes: 121 additions & 0 deletions
121
tests/checks/wred_affected_model_check/test_wred_affected_model_check.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| import os | ||
| import pytest | ||
| import importlib | ||
| from helpers.utils import read_data | ||
|
|
||
| script = importlib.import_module("aci-preupgrade-validation-script") | ||
|
|
||
| dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
|
||
| test_function = "wred_affected_model_check" | ||
|
|
||
| # icurl queries | ||
| qosCong_api = "qosCong.json" | ||
| eqptFC_api = "eqptFC.json" | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "tversion, fabric_nodes, icurl_outputs, expected_result, expected_data", | ||
| [ | ||
|
Priyanka-Patil14 marked this conversation as resolved.
|
||
| # Case 1: Target version not supplied. Expected: MANUAL. | ||
| ( | ||
| None, | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| {}, | ||
| script.MANUAL, | ||
| [], | ||
| ), | ||
| # Case 2: Target version 6.2(2e) is the first fixed release and not in the affected range. | ||
| # Version gate fails. Expected: NA without any API calls. | ||
| ( | ||
| "6.2(2e)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| {}, | ||
| script.NA, | ||
| [], | ||
| ), | ||
| # Case 2: All 3 gates triggered via an affected FM on a spine node. | ||
| # Version 6.2(1g) is in affected range, WRED is enabled, FM model N9K-C9508-FM-E is affected. | ||
| # Expected: FAIL_O with node 1001 reported. | ||
| ( | ||
| "6.2(1g)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_wred.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_affected.json"), | ||
| }, | ||
| script.FAIL_O, | ||
| [["1001", "spine1001", "N9K-C9508-FM-E"]], | ||
| ), | ||
| # Case 3: Version is affected but no affected FM hardware found. | ||
| # WRED is enabled so the script proceeds to the FM check, which finds nothing. | ||
| # Hardware gate fails. Expected: NA - issue is model-specific. | ||
| ( | ||
| "6.1(5e)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_wred.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_empty.json"), | ||
| }, | ||
| script.NA, | ||
| [], | ||
| ), | ||
| # Case 4: Version is affected and FM is affected, but WRED is not enabled (tail-drop). | ||
| # WRED gate fails. Expected: PASS - confirms all 3 gates must be true simultaneously. | ||
| ( | ||
| "6.1(5e)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_tail_drop.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_affected.json"), | ||
| }, | ||
| script.PASS, | ||
| [], | ||
| ), | ||
|
Priyanka-Patil14 marked this conversation as resolved.
|
||
| # Case 5: Multiple FM objects - one affected (N9K-C9508-FM-E), one unaffected (N9K-C9504-FM-G). | ||
| # WRED is enabled. Only the affected FM should be reported. | ||
| # Expected: FAIL_O with only the affected FM row reported. | ||
| ( | ||
| "6.1(5e)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_wred.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_mixed.json"), | ||
| }, | ||
| script.FAIL_O, | ||
| [["1001", "spine1001", "N9K-C9508-FM-E"]], | ||
| ), | ||
| # Case 6: Version is affected, WRED is enabled, but no affected FM models found. | ||
| # FM gate fails. Expected: NA. | ||
| ( | ||
| "6.2(1g)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_wred.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_empty.json"), | ||
| }, | ||
| script.NA, | ||
| [], | ||
| ), | ||
| # Case 7: Same node has two FM slots with the same affected model (duplicate eqptFC objects). | ||
| # Deduplication by (node_id, model) must result in only one row. | ||
| # Expected: FAIL_O with a single row for node 1001. | ||
| ( | ||
| "6.2(1g)", | ||
| read_data(dir, "fabricNode_spine.json"), | ||
| { | ||
| qosCong_api: read_data(dir, "qosCong_wred.json"), | ||
| eqptFC_api: read_data(dir, "eqptFC_duplicate.json"), | ||
| }, | ||
| script.FAIL_O, | ||
| [["1001", "spine1001", "N9K-C9508-FM-E"]], | ||
| ), | ||
| ], | ||
|
Priyanka-Patil14 marked this conversation as resolved.
|
||
| ) | ||
| def test_logic(run_check, mock_icurl, tversion, fabric_nodes, expected_result, expected_data): | ||
| result = run_check( | ||
| tversion=script.AciVersion(tversion) if tversion else None, | ||
| fabric_nodes=fabric_nodes, | ||
| ) | ||
| assert result.result == expected_result | ||
| assert result.data == expected_data | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.