Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
85ff014
synth class + write back each function
monrog2 Jun 25, 2025
3a2bb9f
add inspect to pull func name
monrog2 Jun 25, 2025
8671373
fix pytest from non str objects
monrog2 Jun 25, 2025
40c7485
py2
monrog2 Jun 25, 2025
d3ad348
args for input + global cleanup
monrog2 Jun 26, 2025
003e606
cleanup global
monrog2 Jun 26, 2025
e65ffbe
inspect cleanup
monrog2 Jun 26, 2025
46e1996
NA PASS logic in synth class
monrog2 Jun 26, 2025
8be4138
update args
monrog2 Jun 26, 2025
44e8713
tk review cleanup
monrog2 Jun 26, 2025
bca7298
cleanup
monrog2 Jun 26, 2025
41f9d72
synth pytest
monrog2 Jun 27, 2025
581825b
synth pytest
monrog2 Jun 27, 2025
d531743
fix args
monrog2 Jun 27, 2025
dac2901
instantiate uname pw for api-only
monrog2 Jun 27, 2025
764c6b2
--puv flag and live result cleanup logic
monrog2 Jun 27, 2025
8ecbb36
fix exeception writing
monrog2 Jun 27, 2025
77e6e27
Puv pytest (#258)
takishida Jul 1, 2025
78f9410
feat: Support QA version and AciVersion instance as input in AciVersi…
takishida Jul 2, 2025
4da893f
failureDetails.data + pytest
monrog2 Jul 2, 2025
d7098af
-c / -d args into puv (#265)
monrog2 Jul 11, 2025
3cfed10
merge v2.6.0 master
monrog2 Jul 11, 2025
654c2f1
Update synthMaintP with the latest schema with ruleId
takishida Jul 12, 2025
cebba59
Add decorator `@check_wrapper` for all check functions
takishida Jul 13, 2025
df586d9
rename synth class to AciResult + breakdown --puv into --api-only and…
monrog2 Jul 14, 2025
385fcb5
same updates
monrog2 Jul 14, 2025
c46c9c1
Add --version and --total-checks
takishida Jul 15, 2025
68be98a
Do not touch log folders with some options like --version
takishida Jul 15, 2025
d9efebb
arg verbiage update
monrog2 Jul 22, 2025
fbf65e7
ValueError when col and row len do not match + pytest + offending che…
monrog2 Jul 22, 2025
3c55922
fix more checks with mismatched col row length
monrog2 Jul 22, 2025
df5403e
header cleanup + cimc logic update for QA
monrog2 Jul 22, 2025
b509083
cleanup my testing
monrog2 Jul 22, 2025
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
2,237 changes: 1,157 additions & 1,080 deletions aci-preupgrade-validation-script.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/cimc_compatibilty_check/compatRsSuppHw_empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
10 changes: 9 additions & 1 deletion tests/cimc_compatibilty_check/test_cimc_compatibilty_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


# icurl queries
eqptCh_api = 'eqptCh.json?query-target-filter=wcard(eqptCh.descr,"APIC")'
eqptCh_api = 'eqptCh.json?query-target-filter=wcard(eqptCh.descr,"APIC")'

compatRsSuppHwL2_api = 'uni/fabric/compcat-default/ctlrfw-apic-6.0(5)/rssuppHw-[uni/fabric/compcat-default/ctlrhw-apicl2].json'
compatRsSuppHwM1_api = 'uni/fabric/compcat-default/ctlrfw-apic-6.0(5)/rssuppHw-[uni/fabric/compcat-default/ctlrhw-apicm1].json'
Expand Down Expand Up @@ -40,6 +40,14 @@
"6.0(5a)",
script.PASS,
),
# Seen in QA testing where version + model does not have catalog entry
(
{eqptCh_api: read_data(dir, "eqptCh_newver.json"),
compatRsSuppHwL2_api: read_data(dir, "compatRsSuppHw_605_L2.json"),
compatRsSuppHwM1_api: read_data(dir, "compatRsSuppHw_empty.json")},
"6.0(5a)",
script.MANUAL,
),
],
)
def test_logic(mock_icurl, tversion, expected_result):
Expand Down
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

script = importlib.import_module("aci-preupgrade-validation-script")

log = logging.getLogger(__name__)
log = logging.getLogger()


@pytest.fixture(scope="session", autouse=True)
def init():
script.initialize()


@pytest.fixture
Expand Down
222 changes: 222 additions & 0 deletions tests/test_AciResult.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
import pytest
import importlib
import json

script = importlib.import_module("aci-preupgrade-validation-script")


@pytest.mark.parametrize(
"func_name, name, description, result, recommended_action, reason, doc_url, column, row, unformatted_column, unformatted_rows, expected_show, expected_criticality, expected_passed",
[
# Check 1: NA
(
"fake_func_name_NA_test",
"NA",
"",
script.NA,
"",
"",
"",
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
False,
"informational",
"passed"
),
# Check 2: PASS
(
"fake_func_name_PASS_test",
"PASS",
"",
script.PASS,
"",
"",
"",
[],
[],
[],
[],
True,
"informational",
"passed"
),
# Check 3: POST
(
"fake_func_name_POST_test",
"POST",
"",
script.POST,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
False,
"informational",
"failed"
),
# Check 4: MANUAL
(
"fake_func_name_MANUAL_test",
"MANUAL",
"",
script.MANUAL,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
True,
"warning",
"failed"
),
# Check 5: ERROR
(
"fake_func_name_ERROR_test",
"ERROR",
"",
script.ERROR,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
True,
"major",
"failed"
),
# Check 6: FAIL_UF
(
"fake_func_name_FAIL_UF_test",
"FAIL_UF",
"",
script.FAIL_UF,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
["col1", "col2"],
[["row1", "row2"], ["row3", "row4"]],
True,
"critical",
"failed"
),
# Check 7: FAIL_O
(
"fake_func_name_FAIL_O_test",
"FAIL_O",
"",
script.FAIL_O,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2", "col3"],
[["row1", "row2", "row3"], ["row4", "row5", "row6"]],
["col4", "col5"],
[["row1", "row2"], ["row3", "row4"]],
True,
"critical",
"failed"
),
# Check 8: FAIL_O Formatted only
(
"fake_func_name_FAIL_O_formatted_only_test",
"FAIL_O Formatted only",
"",
script.FAIL_O,
"reboot",
"test reason",
"https://test_doc_url.html",
["col1", "col2", "col3"],
[["row1", "row2", "row3"], ["row4", "row5", "row6"]],
[],
[],
True,
"critical",
"failed"
),
# Check 9: FAIL_O unformatted only
(
"fake_func_name_FAIL_O_unformatted_only_test",
"FAIL_O Unformatted only",
"",
script.FAIL_O,
"reboot",
"test reason",
"https://test_doc_url.html",
[],
[],
["col1", "col2", "col3"],
[["row1", "row2", "row3"], ["row4", "row5", "row6"]],
True,
"critical",
"failed"
),
],
)
def test_AciResult(
func_name,
name,
description,
result,
recommended_action,
reason,
doc_url,
column,
row,
unformatted_column,
unformatted_rows,
expected_show,
expected_criticality,
expected_passed,
):
synth = script.AciResult(func_name, name, description)
synth.updateWithResults(result, recommended_action, reason, doc_url, column, row, unformatted_column, unformatted_rows)
file = synth.writeResult()
with open(file, "r") as f:
data = json.load(f)
assert data["ruleId"] == func_name
assert data["showValidation"] == expected_show
assert data["severity"] == expected_criticality
assert data["ruleStatus"] == expected_passed


@pytest.mark.parametrize(
"headers, data",
[
("", []), # invalid headers (columns)
([], {}), # invalid data (rows)
("", {}), # invalid headers and data
]
)
def test_invalid_headers_or_data(headers, data):
with pytest.raises(TypeError):
synth = script.AciResult("func_name", "Check Title", "A Description")
synth.craftData(
column=headers,
rows=data,
)

@pytest.mark.parametrize(
"headers, data",
[
(["col1", "col2"], [["row1"], ["row2"]]), # Rows are shorter
(["col1"], [["row1", "row2"], ["row3", "row4"]]), # columns are shorter
]
)
def test_mismatched_lengths(headers, data):
with pytest.raises(ValueError):
synth = script.AciResult("func_name", "Check Title", "A Description")
synth.craftData(
column=headers,
rows=data,
)
Loading