-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rebase welkin-issue-79 on master * Apply suggestions from code review * Add version, Use fabricNode, Add pytest --------- Co-authored-by: takishida <38262981+takishida@users.noreply.github.com> Co-authored-by: tkishida <tkishida@cisco.com>
- Loading branch information
1 parent
766ff1f
commit 4271899
Showing
6 changed files
with
206 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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
26 changes: 26 additions & 0 deletions
26
tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3H.json
This file contains 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,26 @@ | ||
[ | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-2/node-113", | ||
"fabricSt": "active", | ||
"id": "113", | ||
"model": "N9K-C93108TC-FX3H", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf113" | ||
} | ||
} | ||
}, | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-2/node-114", | ||
"fabricSt": "active", | ||
"id": "114", | ||
"model": "N9K-C93108TC-FX3H", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf114" | ||
} | ||
} | ||
} | ||
] |
26 changes: 26 additions & 0 deletions
26
tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P.json
This file contains 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,26 @@ | ||
[ | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-1/node-102", | ||
"fabricSt": "active", | ||
"id": "101", | ||
"model": "N9K-C93108TC-FX3P", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf101" | ||
} | ||
} | ||
}, | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-1/node-102", | ||
"fabricSt": "active", | ||
"id": "102", | ||
"model": "N9K-C93108TC-FX3P", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf102" | ||
} | ||
} | ||
} | ||
] |
50 changes: 50 additions & 0 deletions
50
tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P3H.json
This file contains 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,50 @@ | ||
[ | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-1/node-102", | ||
"fabricSt": "active", | ||
"id": "101", | ||
"model": "N9K-C93108TC-FX3P", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf101" | ||
} | ||
} | ||
}, | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-1/node-102", | ||
"fabricSt": "active", | ||
"id": "102", | ||
"model": "N9K-C93108TC-FX3P", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf102" | ||
} | ||
} | ||
}, | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-2/node-113", | ||
"fabricSt": "active", | ||
"id": "113", | ||
"model": "N9K-C93108TC-FX3H", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf113" | ||
} | ||
} | ||
}, | ||
{ | ||
"fabricNode": { | ||
"attributes": { | ||
"dn": "topology/pod-2/node-114", | ||
"fabricSt": "active", | ||
"id": "114", | ||
"model": "N9K-C93108TC-FX3H", | ||
"monPolDn": "uni/fabric/monfab-default", | ||
"name": "leaf114" | ||
} | ||
} | ||
} | ||
] |
50 changes: 50 additions & 0 deletions
50
tests/n9k_c93108tc_fx3p_interface_down_check/test_n9k_c93108tc_fx3p_interface_down_check.py
This file contains 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,50 @@ | ||
import os | ||
import pytest | ||
import logging | ||
import importlib | ||
from helpers.utils import read_data | ||
|
||
script = importlib.import_module("aci-preupgrade-validation-script") | ||
|
||
log = logging.getLogger(__name__) | ||
dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
# icurl queries | ||
api = 'fabricNode.json?query-target-filter=or(eq(fabricNode.model,"N9K-C93108TC-FX3P"),eq(fabricNode.model,"N9K-C93108TC-FX3H"))' | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"icurl_outputs, tversion, expected_result", | ||
[ | ||
# Version not supplied | ||
({api: []}, None, script.MANUAL), | ||
# Version not affected | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.2(8h)", script.PASS), | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.3(2b)", script.PASS), | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "6.0(4c)", script.PASS), | ||
# Affected version, no FX3P or FX3H | ||
({api: []}, "5.2(8g)", script.PASS), | ||
({api: []}, "5.3(1d)", script.PASS), | ||
({api: []}, "6.0(2h)", script.PASS), | ||
# Affected version, FX3P | ||
({api: read_data(dir, "fabricNode_FX3P.json")}, "5.2(8g)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3P.json")}, "5.3(1d)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3P.json")}, "6.0(2h)", script.FAIL_O), | ||
# Affected version, FX3H | ||
({api: read_data(dir, "fabricNode_FX3H.json")}, "5.2(8g)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3H.json")}, "5.3(1d)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3H.json")}, "6.0(2h)", script.FAIL_O), | ||
# Affected version, FX3P and FX3H | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.2(8g)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.3(1d)", script.FAIL_O), | ||
({api: read_data(dir, "fabricNode_FX3P3H.json")}, "6.0(2h)", script.FAIL_O), | ||
], | ||
) | ||
def test_logic(mock_icurl, tversion, expected_result): | ||
result = script.n9k_c93108tc_fx3p_interface_down_check( | ||
1, | ||
1, | ||
script.AciVersion(tversion) if tversion else None, | ||
) | ||
assert result == expected_result |