Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue100 #130

Merged
merged 9 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,7 @@ def subnet_scope_check(index, total_checks, cversion, **kwargs):
print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result


def rtmap_comm_match_defect_check(index, total_checks, tversion, **kwargs):
title = 'Route-map Community Match Defect'
result = PASS
Expand Down Expand Up @@ -3635,6 +3636,45 @@ def static_route_overlap_check(index, total_checks, cversion, tversion, **kwargs
return result


def validate_32_64_bit_image_check(index, total_checks, tversion, **kwargs):
title = '32 and 64-Bit Firmware Image for Switches'
result = PASS
msg = ''
headers = ["Target Switch Version", "32-Bit Image Found", "64-Bit Image Found"]
data = []
recommended_action = 'Upload the missing 32 or 64 bit Switch Image to the Firmware repository'
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#602-requires-32-and-64-bit-switch-images'
print_title(title, index, total_checks)

if not tversion:
print_result(title, MANUAL, "Target version not supplied. Skipping.")
return MANUAL

if tversion.newer_than("6.0(2a)"):
found32 = found64 = False
target_sw_ver = 'n9000-1' + tversion.version
firmware_api = 'firmwareFirmware.json'
firmware_api += '?query-target-filter=eq(firmwareFirmware.fullVersion,"%s")' % (target_sw_ver)
firmwares = icurl('class', firmware_api)

for firmware in firmwares:
if firmware['firmwareFirmware']['attributes']['bitInfo'] == '32':
found32 = True
elif firmware['firmwareFirmware']['attributes']['bitInfo'] == '64':
found64 = True

if not found32 or not found64:
result = FAIL_UF
data.append([target_sw_ver, found32, found64])

else:
result = NA
msg = 'Target version below 6.0(2)'

print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result


if __name__ == "__main__":
prints(' ==== %s%s, Script Version %s ====\n' % (ts, tz, SCRIPT_VERSION))
prints('!!!! Check https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script for Latest Release !!!!\n')
Expand Down Expand Up @@ -3674,6 +3714,7 @@ def static_route_overlap_check(index, total_checks, cversion, tversion, **kwargs
switch_group_guideline_check,
mini_aci_6_0_2_check,
post_upgrade_cb_check,
validate_32_64_bit_image_check,

# Faults
apic_disk_space_faults_check,
Expand Down
14 changes: 12 additions & 2 deletions docs/docs/validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Items | This Script
[Intersight Device Connector upgrade status][g13] | :white_check_mark: | :white_check_mark: 4.2(5) | :white_check_mark:
[Mini ACI Upgrade to 6.0(2)+][g14] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
[Post Upgrade CallBack Integrity][g15] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
[6.0(2)+ requires 32 and 64 bit switch images][g16] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:


[g1]: #compatibility-target-aci-version
Expand All @@ -50,7 +51,7 @@ Items | This Script
[g13]: #intersight-device-connector-upgrade-status
[g14]: #mini-aci-upgrade-to-602-or-later
[g15]: #post-upgrade-callback-integrity

[g16]: #602-requires-32-and-64-bit-switch-images

### Fault Checks
Items | Faults | This Script | APIC built-in | Pre-Upgrade Validator (App)
Expand Down Expand Up @@ -416,6 +417,14 @@ This validation checks whether the number of objects for the existing and newly
status :
```


### 6.0(2)+ requires 32 and 64 bit switch images

When targeting any version that is 6.0(2) or greater, download both the 32-bit and 64-bit Cisco ACI-mode switch images to the Cisco APIC. Downloading only one of the images may result in errors during the upgrade process.

For additional information, see the [Guidelines and Limitations for Upgrading or Downgrading][28] section of the Cisco APIC Installation and ACI Upgrade and Downgrade Guide.


## Fault Check Details

### APIC Disk Space Usage
Expand Down Expand Up @@ -1954,4 +1963,5 @@ If found, the target version of your upgrade should be a version with a fix for
[24]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwf00416
[25]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwb08081
[26]: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/kb/b_Cisco_ACI_and_Forward_Error_Correction.html#Cisco_Reference.dita_5cef69b3-b7fa-4bde-ba60-38129c9e7d82
[27]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwb91766
[27]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwb91766
[28]: https://www.cisco.com/c/en/us/td/docs/dcn/aci/apic/all/apic-installation-aci-upgrade-downgrade/Cisco-APIC-Installation-ACI-Upgrade-Downgrade-Guide/m-aci-upgrade-downgrade-architecture.html#Cisco_Reference.dita_22480abb-4138-416b-8dd5-ecde23f707b4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
78 changes: 78 additions & 0 deletions tests/validate_32_64_bit_image_check/firmwareFirmware_neg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[
{
"firmwareFirmware": {
"attributes": {
"annotation": "",
"autoloadCatalog": "no",
"bitInfo": "64",
"checksum": "26e61c295b00703002d69eda76526e3d",
"childAction": "",
"deleteIt": "no",
"description": "",
"dn": "fwrepo/fw-aci-n9000-system.16.0.3e-cs_64.bin",
"dnldStatus": "downloaded",
"downloadDate": "2024-04-09T11:18:11.054-04:00",
"extMngdBy": "",
"fullVersion": "n9000-16.0(3e)",
"iUrl": "/var/run/mgmt/fwrepos/fwrepo/aci-n9000-dk9.16.0.3e-cs_64.bin",
"isoname": "aci-n9000-dk9.16.0.3e-cs_64.bin",
"latest": "no",
"lcOwn": "local",
"minorVersion": "(3e)",
"modTs": "2024-04-11T15:53:39.984-04:00",
"name": "aci-n9000-system.16.0.3e-cs_64.bin",
"origFileName": "",
"releaseDate": "2023-08-18T01:41:46.000-04:00",
"restartType": "NA",
"rn": "fw-aci-n9000-system.16.0.3e-cs_64.bin",
"size": "2593945834",
"size64": "2593945834",
"status": "",
"syncComplete": "111",
"type": "switch",
"uid": "0",
"url": "/fwrepo/aci-n9000-dk9.16.0.3e-cs_64.bin",
"userdom": "all",
"version": "16.0"
}
}
},
{
"firmwareFirmware": {
"attributes": {
"annotation": "",
"autoloadCatalog": "no",
"bitInfo": "32",
"checksum": "fe7d6492a4d05e57910742f8f0d0252c",
"childAction": "",
"deleteIt": "no",
"description": "",
"dn": "fwrepo/fw-aci-n9000-system.16.0.3e.bin",
"dnldStatus": "downloaded",
"downloadDate": "2024-04-09T11:14:28.846-04:00",
"extMngdBy": "",
"fullVersion": "n9000-16.0(3e)",
"iUrl": "/var/run/mgmt/fwrepos/fwrepo/aci-n9000-dk9.16.0.3e.bin",
"isoname": "aci-n9000-dk9.16.0.3e.bin",
"latest": "no",
"lcOwn": "local",
"minorVersion": "(3e)",
"modTs": "2024-04-11T15:53:39.984-04:00",
"name": "aci-n9000-system.16.0.3e.bin",
"origFileName": "",
"releaseDate": "2023-08-18T01:48:25.000-04:00",
"restartType": "NA",
"rn": "fw-aci-n9000-system.16.0.3e.bin",
"size": "2418748405",
"size64": "2418748405",
"status": "",
"syncComplete": "111",
"type": "switch",
"uid": "0",
"url": "/fwrepo/aci-n9000-dk9.16.0.3e.bin",
"userdom": "all",
"version": "16.0"
}
}
}
]
40 changes: 40 additions & 0 deletions tests/validate_32_64_bit_image_check/firmwareFirmware_pos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"firmwareFirmware": {
"attributes": {
"annotation": "",
"autoloadCatalog": "no",
"bitInfo": "64",
"checksum": "26e61c295b00703002d69eda76526e3d",
"childAction": "",
"deleteIt": "no",
"description": "",
"dn": "fwrepo/fw-aci-n9000-system.16.0.3e-cs_64.bin",
"dnldStatus": "downloaded",
"downloadDate": "2024-04-09T11:18:11.054-04:00",
"extMngdBy": "",
"fullVersion": "n9000-16.0(3e)",
"iUrl": "/var/run/mgmt/fwrepos/fwrepo/aci-n9000-dk9.16.0.3e-cs_64.bin",
"isoname": "aci-n9000-dk9.16.0.3e-cs_64.bin",
"latest": "no",
"lcOwn": "local",
"minorVersion": "(3e)",
"modTs": "2024-04-11T15:53:39.984-04:00",
"name": "aci-n9000-system.16.0.3e-cs_64.bin",
"origFileName": "",
"releaseDate": "2023-08-18T01:41:46.000-04:00",
"restartType": "NA",
"rn": "fw-aci-n9000-system.16.0.3e-cs_64.bin",
"size": "2593945834",
"size64": "2593945834",
"status": "",
"syncComplete": "111",
"type": "switch",
"uid": "0",
"url": "/fwrepo/aci-n9000-dk9.16.0.3e-cs_64.bin",
"userdom": "all",
"version": "16.0"
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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
firmware_60_api = 'firmwareFirmware.json'
firmware_60_api += '?query-target-filter=eq(firmwareFirmware.fullVersion,"n9000-16.0(3e)")'

# icurl queries
firmware_52_api = 'firmwareFirmware.json'
firmware_52_api += '?query-target-filter=eq(firmwareFirmware.fullVersion,"n9000-15.2(7d)")'

@pytest.mark.parametrize(
"icurl_outputs, tversion, expected_result",
[
##FAILING = AFFECTED VERSION + AFFECTED MO
(
{firmware_60_api: read_data(dir, "firmwareFirmware_pos.json"),
},
"6.0(3e)", script.FAIL_UF,
),
## FAILING = AFFECTED VERSION + AFFECTED MO NON EXISTING
(
{firmware_60_api: read_data(dir, "firmwareFirmware_empty.json"),
},
"6.0(3e)", script.FAIL_UF,
),
##PASSING = AFFECTED VERSION + NON-AFFECTED MO
(
{firmware_60_api: read_data(dir, "firmwareFirmware_neg.json"),
},
"6.0(3e)", script.PASS,
),
##PASSING = NON-AFFECTED VERSION + AFFECTED MO
(
{firmware_52_api: read_data(dir, "firmwareFirmware_empty.json"),
},
"5.2(7d)", script.NA,
),

],
)
def test_logic(mock_icurl, tversion, expected_result):
result = script.validate_32_64_bit_image_check(1, 1, script.AciVersion(tversion))
assert result == expected_result

def test_manual():
result = script.validate_32_64_bit_image_check(1, 1, None)
assert result == script.MANUAL