diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index c874dcd2..ff283150 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -958,7 +958,7 @@ def craftData(column, rows): raise ValueError("Row length ({}), data: {} does not match column length ({}).".format(r_len, rows[row_entry], c_len)) entry = {} for col_pos in range(c_len): - entry[column[col_pos]] = rows[row_entry][col_pos] + entry[column[col_pos]] = str(rows[row_entry][col_pos]) data.append(entry) return data @@ -1397,7 +1397,7 @@ def get_switch_version(): return None -@check_wrapper(check_title="APIC Cluster is Fully-Fit") +@check_wrapper(check_title="APIC Cluster Status") def apic_cluster_health_check(cversion, **kwargs): result = FAIL_UF msg = '' @@ -1431,7 +1431,7 @@ def apic_cluster_health_check(cversion, **kwargs): return Result(result=result, msg=msg, headers=headers, data=data, unformatted_headers=unformatted_headers, unformatted_data=unformatted_data, recommended_action=recommended_action, doc_url=doc_url) -@check_wrapper(check_title="Switches are all in Active state") +@check_wrapper(check_title="Switch Fabric Membership Status") def switch_status_check(**kwargs): result = FAIL_UF msg = '' @@ -4004,7 +4004,7 @@ def vmm_active_uplinks_check(**kwargs): return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) -@check_wrapper(check_title="Fabric Port is Down (F1394 ethpm-if-port-down-fabric)") +@check_wrapper(check_title="Fabric Port Status (F1394 ethpm-if-port-down-fabric)") def fabric_port_down_check(**kwargs): result = FAIL_O headers = ["Pod", "Node", "Int", "Reason", "Lifecycle"] @@ -4012,7 +4012,7 @@ def fabric_port_down_check(**kwargs): unformatted_data = [] data = [] recommended_action = 'Identify if these ports are needed for redundancy and reason for being down' - doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations#fabric-port-is-down' + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations#fabric-port-status' fault_api = 'faultInst.json' fault_api += '?&query-target-filter=and(eq(faultInst.code,"F1394")' @@ -4925,7 +4925,7 @@ def standby_sup_sync_check(cversion, tversion, **kwargs): return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) -@check_wrapper(check_title='Equipment Disk Limits Exceeded') +@check_wrapper(check_title='Equipment Disk Limits') def equipment_disk_limits_exceeded(**kwargs): result = PASS headers = ['Pod', 'Node', 'Code', '%', 'Description'] @@ -4933,7 +4933,7 @@ def equipment_disk_limits_exceeded(**kwargs): unformatted_headers = ['Fault DN', '%', 'Recommended Action'] unformatted_data = [] recommended_action = 'Review the reference document for commands to validate disk usage' - doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/##equipment-disk-limits-exceeded' + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#equipment-disk-limits' usage_regex = r"avail \(New: (?P\d+)\).+used \(New: (?P\d+)\)" f182x_api = 'faultInst.json' diff --git a/docs/docs/validations.md b/docs/docs/validations.md index 0b106d07..e46a8815 100644 --- a/docs/docs/validations.md +++ b/docs/docs/validations.md @@ -24,8 +24,8 @@ Items | This Script [Compatibility (Switch Hardware Gen1)][g4] | :white_check_mark: | :white_check_mark: 4.2(4) | :white_check_mark: [Compatibility (Remote Leaf Switch)][g5] | :white_check_mark: | :grey_exclamation: Except CSCvs16767 | :white_check_mark: [APIC Target version image and MD5 hash][g6] | :white_check_mark: | :white_check_mark: 5.2(3e)| :no_entry_sign: -[APIC Cluster is Fully-Fit][g7] | :white_check_mark: | :white_check_mark: 4.2(6) | :white_check_mark: -[Switches are all in Active state][g8] | :white_check_mark: | :no_entry_sign: | :white_check_mark: +[APIC Cluster Status][g7] | :white_check_mark: | :white_check_mark: 4.2(6) | :white_check_mark: +[Switch Fabric Membership Status][g8] | :white_check_mark: | :no_entry_sign: | :white_check_mark: [NTP Status][g9] | :white_check_mark: | :white_check_mark: 4.2(5) | :white_check_mark: [Firmware/Maintenance Groups when crossing 4.0 Release][g10] | :white_check_mark: | :no_entry_sign: | :white_check_mark: [Features that need to be disabled prior to Upgrade][g11] | :white_check_mark: | :grey_exclamation: 5.2(c)
Only AppCenter Apps | :white_check_mark: @@ -43,8 +43,8 @@ Items | This Script [g4]: #compatibility-switch-hardware-gen1 [g5]: #compatibility-remote-leaf-switch [g6]: #apic-target-version-image-and-md5-hash -[g7]: #apic-cluster-is-fully-fit -[g8]: #switches-are-all-in-active-state +[g7]: #apic-cluster-status +[g8]: #switch-fabric-membership-status [g9]: #ntp-status [g10]: #firmwaremaintenance-groups-when-crossing-40-release [g11]: #features-that-need-to-be-disabled-prior-to-upgrade @@ -77,8 +77,8 @@ Items | Faults | This Script [Different infra VLAN via LLDP][f16] | F0454: infra-vlan-mismatch | :white_check_mark: | :white_check_mark: 4.2(4) | :white_check_mark: [HW Programming Failure][f17] | F3544: L3Out Prefixes
F3545: Contracts | :white_check_mark: | :white_check_mark: 5.1(1) | :white_check_mark: [Scalability (faults related to Capacity Dashboard)][f18] | TCA faults for eqptcapacityEntity | :white_check_mark: | :no_entry_sign: | :white_check_mark: -[Fabric Port is Down][f19] | F1394: ethpm-if-port-down-fabric | :white_check_mark: | :no_entry_sign: | :no_entry_sign: -[Equipment Disk Limits Exceeded][f20] | F1820: 80% -minor
F1821: -major
F1822: -critical | :white_check_mark: | :no_entry_sign: | :no_entry_sign: +[Fabric Port Status][f19] | F1394: ethpm-if-port-down-fabric | :white_check_mark: | :no_entry_sign: | :no_entry_sign: +[Equipment Disk Limits][f20] | F1820: 80% -minor
F1821: -major
F1822: -critical | :white_check_mark: | :no_entry_sign: | :no_entry_sign: @@ -100,8 +100,8 @@ Items | Faults | This Script [f16]: #different-infra-vlan-via-lldp [f17]: #hw-programming-failure [f18]: #scalability-faults-related-to-capacity-dashboard -[f19]: #fabric-port-is-down -[f20]: #equipment-disk-limits-exceeded +[f19]: #fabric-port-status +[f20]: #equipment-disk-limits ### Configuration Checks @@ -308,7 +308,7 @@ Upgrade Image transfer touchpoints: ``` -### APIC Cluster is Fully-Fit +### APIC Cluster Status The script checks whether or not the APIC cluster is in the **Fully Fit** state. @@ -318,7 +318,7 @@ If your APICs are currently on release 4.2(1) or later, the command `acidiag clu -### Switches are all in Active state +### Switch Fabric Membership Status The script checks whether or not all ACI switches are in an **Active** state. @@ -1365,7 +1365,7 @@ Examples of what's monitored via `Operations > Capacity Dashboard > Leaf Capacit ``` -### Fabric Port is Down +### Fabric Port Status The script checks for fault code `F1394` with rule `ethpm-if-port-down-fabric`, which is raised against a fabric port that is admin up and used to be operaitonally up at some point in the past, but is now operationally down. @@ -1461,7 +1461,7 @@ Failure to do so may lead to outages during switch upgrades due to leaf nodes no ``` -### Equipment Disk Limits Exceeded +### Equipment Disk Limits This fault occurs when the disk usage of a partiton increases beyond its threshold. diff --git a/tests/test_AciResult.py b/tests/test_AciResult.py index 473e3552..c427712d 100644 --- a/tests/test_AciResult.py +++ b/tests/test_AciResult.py @@ -1,6 +1,7 @@ import pytest import importlib import json +from six import string_types script = importlib.import_module("aci-preupgrade-validation-script") @@ -137,7 +138,7 @@ "test reason", "https://test_doc_url.html", ["col1", "col2", "col3"], - [["row1", "row2", "row3"], ["row4", "row5", "row6"]], + [["row1", None, 3], ["row4", None, 3]], [], [], True, @@ -156,7 +157,7 @@ [], [], ["col1", "col2", "col3"], - [["row1", "row2", "row3"], ["row4", "row5", "row6"]], + [["row1", None, 3], ["row4", None, 3]], True, "critical", "failed" @@ -188,7 +189,12 @@ def test_AciResult( assert data["showValidation"] == expected_show assert data["severity"] == expected_criticality assert data["ruleStatus"] == expected_passed - + for entry in data["failureDetails"]["data"]: + for vals in entry.values(): + assert isinstance(vals, string_types) + for entry in data["failureDetails"]["unformatted_data"]: + for vals in entry.values(): + assert isinstance(vals, string_types) @pytest.mark.parametrize( "headers, data", @@ -209,8 +215,22 @@ def test_invalid_headers_or_data(headers, data): @pytest.mark.parametrize( "headers, data", [ - (["col1", "col2"], [["row1"], ["row2"]]), # Rows are shorter - (["col1"], [["row1", "row2"], ["row3", "row4"]]), # columns are shorter + # Rows are shorter + ( + ["col1", "col2"], + [ + ["row1"], + ["row2"] + ] + ), + # columns are shorter + ( + ["col1"], + [ + ["row1", "row2"], + ["row3", "row4"] + ] + ), ] ) def test_mismatched_lengths(headers, data):