-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* issue 57 fabricName check + pytests * bump to v1.5.0
- Loading branch information
Showing
6 changed files
with
339 additions
and
96 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
91 changes: 91 additions & 0 deletions
91
tests/fabricdomain_name_check/test_fabricdomain_name_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,91 @@ | ||
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 | ||
topSystem = 'topSystem.json?query-target-filter=eq(topSystem.role,"controller")' | ||
|
||
@pytest.mark.parametrize( | ||
"icurl_outputs, cversion, tversion, expected_result", | ||
[ | ||
# # char test | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_1POS.json") | ||
}, | ||
"5.2(3g)", | ||
"6.0(2h)", | ||
script.FAIL_O, | ||
), | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_1POS.json") | ||
}, | ||
"6.0(3a)", | ||
"6.0(2h)", | ||
script.FAIL_O, | ||
), | ||
# ; char test | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_2POS.json") | ||
}, | ||
"5.2(3g)", | ||
"6.0(2h)", | ||
script.FAIL_O, | ||
), | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_2POS.json") | ||
}, | ||
"6.0(3a)", | ||
"6.0(2h)", | ||
script.FAIL_O, | ||
), | ||
# Neither ; or # in fabricDomain | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_NEG.json") | ||
}, | ||
"5.2(3g)", | ||
"6.0(2h)", | ||
script.PASS, | ||
), | ||
# only affected 6.0(2h), regardless of special chars | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_1POS.json") | ||
}, | ||
"5.2(3g)", | ||
"6.0(1j)", | ||
script.PASS, | ||
), | ||
# Eventual 6.0(3) has fix | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_1POS.json") | ||
}, | ||
"5.2(3g)", | ||
"6.0(3a)", | ||
script.PASS, | ||
), | ||
( | ||
{ | ||
topSystem: read_data(dir, "topSystem_1POS.json") | ||
}, | ||
"6.0(3a)", | ||
"6.0(4a)", | ||
script.PASS, | ||
), | ||
], | ||
) | ||
def test_logic(mock_icurl, cversion, tversion, expected_result): | ||
result = script.fabricdomain_name_check(1, 1, cversion, tversion) | ||
assert result == expected_result |
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,38 @@ | ||
{ | ||
"totalCount": "3", | ||
"imdata": [ | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.1", | ||
"fabricId": "1", | ||
"id": "1", | ||
"fabricDomain": "fabric;4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.2", | ||
"fabricId": "1", | ||
"id": "2", | ||
"fabricDomain": "fabric;4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.3", | ||
"fabricId": "1", | ||
"id": "3", | ||
"fabricDomain": "fabric;4", | ||
"role": "controller" | ||
} | ||
} | ||
} | ||
] | ||
} |
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,38 @@ | ||
{ | ||
"totalCount": "3", | ||
"imdata": [ | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.1", | ||
"fabricId": "1", | ||
"id": "1", | ||
"fabricDomain": "fabric#4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.2", | ||
"fabricId": "1", | ||
"id": "2", | ||
"fabricDomain": "fabric#4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.3", | ||
"fabricId": "1", | ||
"id": "3", | ||
"fabricDomain": "fabric#4", | ||
"role": "controller" | ||
} | ||
} | ||
} | ||
] | ||
} |
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,38 @@ | ||
{ | ||
"totalCount": "3", | ||
"imdata": [ | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.1", | ||
"fabricId": "1", | ||
"id": "1", | ||
"fabricDomain": "fabric4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.2", | ||
"fabricId": "1", | ||
"id": "2", | ||
"fabricDomain": "fabric4", | ||
"role": "controller" | ||
} | ||
} | ||
}, | ||
{ | ||
"topSystem": { | ||
"attributes": { | ||
"address": "10.0.0.3", | ||
"fabricId": "1", | ||
"id": "3", | ||
"fabricDomain": "fabric4", | ||
"role": "controller" | ||
} | ||
} | ||
} | ||
] | ||
} |