Skip to content

Commit 7928e4f

Browse files
jeestr4dtakishida
authored andcommitted
issue264 fixed
1 parent 128ab55 commit 7928e4f

4 files changed

Lines changed: 142 additions & 2 deletions

File tree

aci-preupgrade-validation-script.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,6 +6026,28 @@ def apic_downgrade_compat_warning_check(cversion, tversion, **kwargs):
60266026
return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)
60276027

60286028

6029+
@check_wrapper(check_title='Auto Firmware Update on Switch Discovery')
6030+
def auto_firmware_update_ondiscovery_check(cversion, tversion, **kwargs):
6031+
result = NA
6032+
headers = ["Auto firmware Policy Dn", "Switch enforced Version"]
6033+
data = []
6034+
recommended_action = 'Disable the Auto Firmware Update on Switch Discovery policy before upgrade'
6035+
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#auto-firmware-update-on-switch-discovery'
6036+
6037+
if not tversion or not cversion:
6038+
return Result(result=MANUAL, msg=TVER_MISSING)
6039+
if (cversion.older_than("5.2(7a)") and tversion.newer_than("6.0(3a)")) or (cversion.older_than("6.0(3a)") and tversion.newer_than("6.0(3a)")):
6040+
result = PASS
6041+
auto_firmware_update_api = 'firmwareRepoP.json'
6042+
auto_firmware_update_api += '?query-target-filter=eq(firmwareRepoP.enforceBootscriptVersionValidation,"true")'
6043+
auto_firmware_update = icurl('class', auto_firmware_update_api)
6044+
if auto_firmware_update:
6045+
data.append([auto_firmware_update[0]["firmwareRepoP"]["attributes"]["dn"], auto_firmware_update[0]["firmwareRepoP"]["attributes"]["defaultSwitchVersion"]])
6046+
if data:
6047+
result = FAIL_O
6048+
6049+
return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)
6050+
60296051
# ---- Script Execution ----
60306052

60316053

@@ -6188,6 +6210,7 @@ class CheckManager:
61886210
standby_sup_sync_check,
61896211
isis_database_byte_check,
61906212
configpush_shard_check,
6213+
auto_firmware_update_ondiscovery_check,
61916214

61926215
]
61936216
ssh_checks = [

docs/docs/validations.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ Items | Defect | This Script
192192
[Observer Database Size][d25] | CSCvw45531 | :white_check_mark: | :no_entry_sign:
193193
[Stale pconsRA Object][d26] | CSCwp22212 | :warning:{title="Deprecated"} | :no_entry_sign:
194194
[ISIS DTEPs Byte Size][d27] | CSCwp15375 | :white_check_mark: | :no_entry_sign:
195-
[Policydist configpushShardCont Crash][d28] | CSCwp95515 | :white_check_mark: |
195+
[Policydist configpushShardCont Crash][d28] | CSCwp95515 | :white_check_mark: | :no_entry_sign:
196+
[Auto Firmware Update on Switch Discovery][d29] | CSCwe83941 | :white_check_mark: | :no_entry_sign:
196197

197198
[d1]: #ep-announce-compatibility
198199
[d2]: #eventmgr-db-size-defect-susceptibility
@@ -222,7 +223,7 @@ Items | Defect | This Script
222223
[d26]: #stale-pconsra-object
223224
[d27]: #isis-dteps-byte-size
224225
[d28]: #policydist-configpushshardcont-crash
225-
226+
[d29]: #auto-firmware-update-on-switch-discovery
226227

227228
## General Check Details
228229

@@ -2647,6 +2648,14 @@ Due to [CSCwp95515][59], upgrading to an affected version while having any `conf
26472648

26482649
If any instances of `configpushShardCont` are flagged by this script, Cisco TAC must be contacted to identify and resolve the underlying issue before performing the upgrade.
26492650

2651+
### Auto Firmware Update on Switch Discovery
2652+
2653+
Due to [CSCwe83941][62] if 'Auto Firmware Update on Switch Discovery' is enabled with the target release of 16.0(3) and later, a new switch commissioned to ACI Fabric could fail discovery.
2654+
2655+
The download of firmware image fails, causing the switch to become "soft-brick" , the switch needs to be recovered.
2656+
2657+
Do not upgrade with 'Auto Firmware Update on Switch Discovery' enabled, to avoid this escenario.
2658+
26502659

26512660
[0]: https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script
26522661
[1]: https://www.cisco.com/c/dam/en/us/td/docs/Website/datacenter/apicmatrix/index.html
@@ -2710,3 +2719,4 @@ If any instances of `configpushShardCont` are flagged by this script, Cisco TAC
27102719
[59]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwp95515
27112720
[60]: https://www.cisco.com/c/en/us/solutions/collateral/data-center-virtualization/application-centric-infrastructure/white-paper-c11-743951.html#Inter
27122721
[61]: https://www.cisco.com/c/en/us/solutions/collateral/data-center-virtualization/application-centric-infrastructure/white-paper-c11-743951.html#EnablePolicyCompression
2722+
[62]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwe83941
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"firmwareRepoP": {
4+
"attributes": {
5+
"annotation": "",
6+
"childAction": "",
7+
"defaultSwitchVersion": "n9000-16.0(9d)",
8+
"descr": "",
9+
"dn": "uni/fabric/fwrepop",
10+
"enforceBootscriptVersionValidation": "yes",
11+
"extMngdBy": "",
12+
"lcOwn": "local",
13+
"modTs": "2025-08-13T17:50:54.830+00:00",
14+
"monPolDn": "uni/fabric/monfab-default",
15+
"name": "default",
16+
"nameAlias": "",
17+
"ownerKey": "",
18+
"ownerTag": "",
19+
"status": "",
20+
"uid": "0",
21+
"userdom": "all"
22+
}
23+
}
24+
}
25+
]
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import os
2+
import pytest
3+
import logging
4+
import importlib
5+
from helpers.utils import read_data
6+
7+
script = importlib.import_module("aci-preupgrade-validation-script")
8+
9+
log = logging.getLogger(__name__)
10+
dir = os.path.dirname(os.path.abspath(__file__))
11+
12+
# icurl queries
13+
auto_firmware_update_api = 'firmwareRepoP.json'
14+
auto_firmware_update_api += '?query-target-filter=eq(firmwareRepoP.enforceBootscriptVersionValidation,"true")'
15+
16+
@pytest.mark.parametrize(
17+
"icurl_outputs, cversion, tversion, expected_result",
18+
[
19+
20+
# MANUAL cases
21+
(
22+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
23+
None, None,
24+
script.MANUAL,
25+
),
26+
(
27+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
28+
"5.2(7a)", None,
29+
script.MANUAL,
30+
),
31+
(
32+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
33+
None, "6.0(3d)",
34+
script.MANUAL,
35+
),
36+
# NA cases
37+
# firmwareRepoP cversion < 5.2(7) , tversion < 6.0(3) Result NA
38+
(
39+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
40+
"5.2(7a)", "6.0(2d)",
41+
script.NA,
42+
),
43+
# firmwareRepoP cversion > 6.0(3) , tversion > 6.0(3) Result NA
44+
(
45+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
46+
"6.0(3a)", "6.0(9d)",
47+
script.NA,
48+
),
49+
# Failure cases
50+
# firmwareRepoP cversion < 5.2(7) , tversion > 6.0(3) Result FAIL_O
51+
(
52+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
53+
"5.2(7a)", "6.0(3d)",
54+
script.FAIL_O,
55+
),
56+
# firmwareRepoP cversion is < 6.0(2) , tversion > 6.0(3) Result FAIL_O
57+
(
58+
{auto_firmware_update_api: read_data(dir, "firmwareRepoP-pos.json")},
59+
"6.0(2a)", "6.0(3d)",
60+
script.FAIL_O,
61+
),
62+
# Pass cases
63+
# no firmwareRepoP cversion is < 5.2(7) , tversion > 6.0(3) Result PASS
64+
(
65+
{auto_firmware_update_api: []},
66+
"5.2(7a)", "6.0(3d)",
67+
script.PASS,
68+
),
69+
# no firmwareRepoP cversion is < 6.0(2) , tversion > 6.0(3) Result PASS
70+
(
71+
{auto_firmware_update_api: []},
72+
"5.2(7a)", "6.0(3d)",
73+
script.PASS,
74+
),
75+
]
76+
)
77+
def test_logic(mock_icurl, cversion, tversion, expected_result):
78+
tversion = script.AciVersion(tversion) if tversion else None
79+
cversion = script.AciVersion(cversion) if cversion else None
80+
81+
result = script.auto_firmware_update_ondiscovery_check(1, 1, cversion, tversion)
82+
assert result == expected_result

0 commit comments

Comments
 (0)