Skip to content

Commit b4e06c9

Browse files
Updated the if condition for maintenance release,6.1(5e) and variable name for impacted nodes.Also, updated pytest test cases
1 parent 2b7e329 commit b4e06c9

3 files changed

Lines changed: 31 additions & 28 deletions

File tree

aci-preupgrade-validation-script.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,25 +6032,28 @@ def n9k_c9408_model_lem_count_check(tversion, fabric_nodes, **kwargs):
60326032
headers = ["Node ID", "Switch Model", "LEM Model", "LEM Count"]
60336033
data = []
60346034
recommended_action = (
6035-
"Upgrade from pre-16.1(2f) to 16.1(2f) or later on N9K-C9408 with 6 or more LEMs will result in boot loop.Choose a different version."
6035+
"Upgrade from pre-16.1(2f) to 16.1(2f) or later on N9K-C9408 with 6 or more LEMs will result in boot loop. Choose a different version."
60366036
)
60376037
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#n9k-c9408-with-6-n9k-x9400-16w-lems'
60386038

6039-
if tversion.older_than("6.1(2f)") or tversion.newer_than("6.2(1g)"):
6039+
if tversion.older_than("6.1(2f)") or (tversion.newer_than("6.1(5e)") and not tversion.same_as("6.2(1g)")):
60406040
return Result(result=NA, msg=VER_NOT_AFFECTED)
60416041

6042-
c9408_nodes = {}
6042+
affected_nodes = {}
60436043
for node in fabric_nodes:
60446044
node_id = node['fabricNode']['attributes']['id']
60456045
model = node['fabricNode']['attributes']['model']
60466046
if model == "N9K-C9408":
6047-
c9408_nodes[node_id] = "N9K-C9408"
6047+
affected_nodes[node_id] = "N9K-C9408"
60486048

6049-
if not c9408_nodes:
6049+
if not affected_nodes:
60506050
return Result(result=NA, msg='No N9K-C9408 nodes found. Skipping.')
60516051

60526052
eqptLC_api = 'eqptLC.json?query-target-filter=eq(eqptLC.model,"N9K-X9400-16W")'
6053-
eqptLCs = icurl('class', eqptLC_api)
6053+
try:
6054+
eqptLCs = icurl('class', eqptLC_api)
6055+
except Exception as e:
6056+
return Result(result=ERROR, msg="Failed to query {}: {}".format(eqptLC_api, e))
60546057

60556058
lem_count_per_node = defaultdict(int)
60566059
for eqptLC in eqptLCs:
@@ -6059,13 +6062,13 @@ def n9k_c9408_model_lem_count_check(tversion, fabric_nodes, **kwargs):
60596062
if not dn_match:
60606063
continue
60616064
node_id = dn_match.group("node")
6062-
if node_id in c9408_nodes:
6065+
if node_id in affected_nodes:
60636066
lem_count_per_node[node_id] += 1
60646067

6065-
for node_id in sorted(c9408_nodes, key=int):
6068+
for node_id in sorted(affected_nodes, key=int):
60666069
lem_count = lem_count_per_node[node_id]
60676070
if lem_count > 5:
6068-
data.append([node_id, c9408_nodes[node_id], "N9K-X9400-16W", lem_count])
6071+
data.append([node_id, affected_nodes[node_id], "N9K-X9400-16W", lem_count])
60696072

60706073
if data:
60716074
result = FAIL_O
@@ -6405,4 +6408,4 @@ def main(_args=None):
64056408
msg = "Abort due to unexpected error - {}".format(e)
64066409
prints(msg)
64076410
log.error(msg, exc_info=True)
6408-
sys.exit(1)
6411+
sys.exit(1)

docs/docs/validations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ Items | Defect | This Script
187187
[Nexus 950X FM or LC Might Fail to boot after reload][d20] | CSCvg26013 | :white_check_mark: | :no_entry_sign:
188188
[Stale Decommissioned Spine][d21] | CSCwf58763 | :white_check_mark: | :no_entry_sign:
189189
[N9K-C9408 Platform Model][d22] | CSCwk77800 | :white_check_mark: | :no_entry_sign:
190-
[N9K-C9408 with 6+ N9K-X9400-16W LEMs][d29] | CSCws82819 | :white_check_mark: | :no_entry_sign:
191190
[PBR High Scale][d23] | CSCwi66348 | :white_check_mark: | :no_entry_sign:
192191
[Standby Sup Image Sync][d24] | CSCwi66348 | :white_check_mark: | :no_entry_sign:
193192
[Observer Database Size][d25] | CSCvw45531 | :white_check_mark: | :no_entry_sign:
194193
[Stale pconsRA Object][d26] | CSCwp22212 | :warning:{title="Deprecated"} | :no_entry_sign:
195194
[ISIS DTEPs Byte Size][d27] | CSCwp15375 | :white_check_mark: | :no_entry_sign:
196195
[Policydist configpushShardCont Crash][d28] | CSCwp95515 | :white_check_mark: |
196+
[N9K-C9408 with 6+ N9K-X9400-16W LEMs][d29] | CSCws82819 | :white_check_mark: | :no_entry_sign:
197197

198198
[d1]: #ep-announce-compatibility
199199
[d2]: #eventmgr-db-size-defect-susceptibility

tests/checks/n9k_c9408_model_lem_count_check/test_n9k_c9408_model_lem_count_check.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[],
3737
script.VER_NOT_AFFECTED,
3838
),
39-
# Version not affected (higher than 6.2(1g))
39+
# Applicable version but no N9K-C9408 nodes found
4040
(
4141
{eqptLC_api: read_data(dir, "eqptLC_6_node.json")},
4242
"6.1(2f)",
@@ -54,7 +54,7 @@
5454
[],
5555
"",
5656
),
57-
# Applicable version, exactly 5 LEMs -> PASS
57+
# Applicable version, C9408 exists, with <=5 LEMs -> PASS
5858
(
5959
{eqptLC_api: read_data(dir, "eqptLC_5_node.json")},
6060
"6.2(1g)",
@@ -63,6 +63,15 @@
6363
[],
6464
"",
6565
),
66+
# Applicable version with 6 LEMs -> FAIL_O
67+
(
68+
{eqptLC_api: read_data(dir, "eqptLC_6_node.json")},
69+
"6.2(1g)",
70+
read_data(dir, "fabricNode_n9k_c9408.json"),
71+
script.FAIL_O,
72+
[["101", "N9K-C9408", "N9K-X9400-16W", 6]],
73+
"",
74+
),
6675
# Applicable mid-train version 6.1(5e), less than 6 LEMs on C9408 -> PASS
6776
(
6877
{eqptLC_api: read_data(dir, "eqptLC_5_node.json")},
@@ -81,14 +90,14 @@
8190
[["101", "N9K-C9408", "N9K-X9400-16W", 6]],
8291
"",
8392
),
84-
# Applicable mid-train version 6.1(5e), more than 6 LEMs on C9408 -> FAIL_O
93+
# Version not affected (fixed after 6.1(5e))
8594
(
86-
{eqptLC_api: read_data(dir, "eqptLC_7_node.json")},
87-
"6.1(5e)",
95+
{eqptLC_api: read_data(dir, "eqptLC_6_node.json")},
96+
"6.1(5f)",
8897
read_data(dir, "fabricNode_n9k_c9408.json"),
89-
script.FAIL_O,
90-
[["101", "N9K-C9408", "N9K-X9400-16W", 7]],
91-
"",
98+
script.NA,
99+
[],
100+
script.VER_NOT_AFFECTED,
92101
),
93102
# Applicable version, 6 LEMs on C9408 -> FAIL_O
94103
(
@@ -99,15 +108,6 @@
99108
[["101", "N9K-C9408", "N9K-X9400-16W", 6]],
100109
"",
101110
),
102-
# Applicable version, more than 6 LEMs on C9408 -> FAIL_O
103-
(
104-
{eqptLC_api: read_data(dir, "eqptLC_7_node.json")},
105-
"6.1(2f)",
106-
read_data(dir, "fabricNode_n9k_c9408.json"),
107-
script.FAIL_O,
108-
[["101", "N9K-C9408", "N9K-X9400-16W", 7]],
109-
"",
110-
),
111111
# Count only C9408 nodes and only matching LEM model
112112
(
113113
{eqptLC_api: read_data(dir, "eqptLC_mixed.json")},

0 commit comments

Comments
 (0)