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

89 newvalidation mini aci upgrade to 602+ #93

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -2790,6 +2790,46 @@ def oob_mgmt_security_check(index, total_checks, cversion, tversion, **kwargs):
print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result

def mini_aci_6_0_2_check(index, total_checks, cversion, tversion, **kwargs):
title = 'Mini ACI Upgrade to 6.0(2)+'
result = FAIL_UF
msg = ''
headers = ["Pod ID","Node ID", "APIC Type", "Failure Reason"]
data = []
recommended_action = "All virtual APICs must be removed from the cluster prior to upgrading to 6.0(2)+."
doc_url = 'Upgrading or Downgrading Virtual APIC - http://cs.co/9009bBTQB'

print_title(title, index, total_checks)

topSystem = kwargs.get("topSystem.json", None)
if not cversion:
cversion = kwargs.get("cversion", None)
if not tversion:
tversion = kwargs.get("tversion", None)

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

if cversion.older_than("6.0(2a)") and tversion.newer_than("6.0(2a)"):
if not topSystem:
topSystem = icurl('class', 'topSystem.json?query-target-filter=wcard(topSystem.role,"controller")')
if not topSystem:
print_result(title, ERROR, 'topSystem response empty. Is the cluster healthy?')
return ERROR

for controller in topSystem:
if controller['topSystem']['attributes']['nodeType'] == "virtual":
pod_id = controller["topSystem"]["attributes"]["podId"]
node_id = controller['topSystem']['attributes']['id']
data.append([pod_id, node_id, "virtual", "Virtual APIC must be removed prior to upgrade to 6.0(2)+"])

if not data:
result = PASS
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))
Expand Down Expand Up @@ -2826,6 +2866,7 @@ def oob_mgmt_security_check(index, total_checks, cversion, tversion, **kwargs):
maintp_grp_crossing_4_0_check,
features_to_disable_check,
switch_group_guideline_check,
mini_aci_6_0_2_check,

# Faults
apic_disk_space_faults_check,
Expand Down
39 changes: 38 additions & 1 deletion tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def upgradePaths():
{"cversion": script.AciVersion("4.2(3a)"), "tversion": script.AciVersion("4.2(7d)")},
{"cversion": script.AciVersion("2.2(3a)"), "tversion": script.AciVersion("2.2(4r)")},
{"cversion": script.AciVersion("5.2(1a)"), "tversion": None},
{"cversion": script.AciVersion("4.1(1a)"), "tversion": script.AciVersion("5.2(7f)")}]
{"cversion": script.AciVersion("4.1(1a)"), "tversion": script.AciVersion("5.2(7f)")},
{"cversion": script.AciVersion("4.2(2a)"), "tversion": script.AciVersion("6.0(2c)")},
{"cversion": script.AciVersion("4.2(2a)"), "tversion": script.AciVersion("6.0(5c)")},
{"cversion": script.AciVersion("6.0(2c)"), "tversion": script.AciVersion("6.0(5c)")}]


def test_aciversion(upgradePaths):
Expand Down Expand Up @@ -359,3 +362,37 @@ def test_bgp_golf_route_target_type_check(upgradePaths):
assert script.bgp_golf_route_target_type_check(pathnum, pathlen, **testdata) == script.MANUAL
if pathnum == 7:
assert script.bgp_golf_route_target_type_check(pathnum, pathlen, **testdata) == script.FAIL_O

def test_pos_mini_aci_6_0_2_check(upgradePaths):
script.prints("=====Starting Positive mini_aci_6_0_2_check\n")
pathlen = len(upgradePaths)
for i, testdata in enumerate(upgradePaths):
with open("tests/topSystem_controller.json_pos","r") as file:
testdata.update({"topSystem.json": json.loads(file.read())['imdata']})
pathnum = i+1
if pathnum == 7:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS
if pathnum == 8:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.FAIL_UF
if pathnum == 9:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.FAIL_UF
if pathnum == 10:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS


def test_neg_mini_aci_6_0_2_check(upgradePaths):
script.prints("=====Starting Negative mini_aci_6_0_2_check\n")
pathlen = len(upgradePaths)
for i, testdata in enumerate(upgradePaths):
with open("tests/topSystem_controller.json_neg","r") as file:
testdata.update({"topSystem.json": json.loads(file.read())['imdata']})
pathnum = i+1

if pathnum == 7:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS
if pathnum == 8:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS
if pathnum == 9:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS
if pathnum == 10:
assert script.mini_aci_6_0_2_check(pathnum, pathlen, **testdata) == script.PASS
179 changes: 179 additions & 0 deletions tests/topSystem_controller.json_neg
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"totalCount": "3",
"imdata": [
{
"topSystem": {
"attributes": {
"address": "10.0.0.1",
"bootstrapState": "none",
"childAction": "",
"clusterTimeDiff": "8185177",
"configIssues": "",
"controlPlaneMTU": "1500",
"currentTime": "2024-04-11T12:41:19.198-04:00",
"dn": "topology/pod-1/node-1/sys",
"enforceSubnetCheck": "no",
"etepAddr": "0.0.0.0",
"fabricDomain": "fab5",
"fabricId": "1",
"fabricMAC": "00:22:BD:F8:19:FF",
"id": "1",
"inbMgmtAddr": "40.5.5.1",
"inbMgmtAddr6": "fc00::1",
"inbMgmtAddr6Mask": "0",
"inbMgmtAddrMask": "24",
"inbMgmtGateway": "40.5.5.254",
"inbMgmtGateway6": "::",
"lastRebootTime": "2024-01-03T20:49:19.892-04:00",
"lastResetReason": "unknown",
"lcOwn": "local",
"modTs": "2024-02-01T15:14:43.241-04:00",
"mode": "unspecified",
"monPolDn": "uni/fabric/monfab-default",
"name": "fab5-apic1",
"nameAlias": "",
"nodeType": "unspecified",
"oobMgmtAddr": "192.168.4.84",
"oobMgmtAddr6": "fe80::2aac:9eff:fe41:fb0e",
"oobMgmtAddr6Mask": "0",
"oobMgmtAddrMask": "24",
"oobMgmtGateway": "192.168.4.1",
"oobMgmtGateway6": "::",
"podId": "1",
"remoteNetworkId": "0",
"remoteNode": "no",
"rlOperPodId": "0",
"rlRoutableMode": "no",
"rldirectMode": "no",
"role": "controller",
"serial": "FCH2209V0FW",
"serverType": "unspecified",
"siteId": "0",
"state": "in-service",
"status": "",
"systemUpTime": "98:18:08:25.000",
"tepPool": "0.0.0.0",
"unicastXrEpLearnDisable": "no",
"version": "6.0(4c)",
"virtualMode": "no"
}
}
},
{
"topSystem": {
"attributes": {
"address": "10.0.0.2",
"bootstrapState": "none",
"childAction": "",
"clusterTimeDiff": "8397050",
"configIssues": "",
"controlPlaneMTU": "1500",
"currentTime": "2024-04-11T12:41:19.203-04:00",
"dn": "topology/pod-1/node-2/sys",
"enforceSubnetCheck": "no",
"etepAddr": "0.0.0.0",
"fabricDomain": "fab5",
"fabricId": "1",
"fabricMAC": "00:22:BD:F8:19:FF",
"id": "2",
"inbMgmtAddr": "0.0.0.0",
"inbMgmtAddr6": "fc00::1",
"inbMgmtAddr6Mask": "0",
"inbMgmtAddrMask": "0",
"inbMgmtGateway": "0.0.0.0",
"inbMgmtGateway6": "::",
"lastRebootTime": "2024-02-13T12:59:46.015-04:00",
"lastResetReason": "unknown",
"lcOwn": "local",
"modTs": "2024-02-13T15:26:21.281-04:00",
"mode": "unspecified",
"monPolDn": "uni/fabric/monfab-default",
"name": "fab5-apic2",
"nameAlias": "",
"nodeType": "unspecified",
"oobMgmtAddr": "192.168.4.32",
"oobMgmtAddr6": "fe80::e6aa:5dff:fe13:b5bc",
"oobMgmtAddr6Mask": "0",
"oobMgmtAddrMask": "24",
"oobMgmtGateway": "192.168.4.1",
"oobMgmtGateway6": "::",
"podId": "1",
"remoteNetworkId": "0",
"remoteNode": "no",
"rlOperPodId": "0",
"rlRoutableMode": "no",
"rldirectMode": "no",
"role": "controller",
"serial": "FCH1937V0ZD",
"serverType": "unspecified",
"siteId": "0",
"state": "in-service",
"status": "",
"systemUpTime": "57:23:38:01.000",
"tepPool": "0.0.0.0",
"unicastXrEpLearnDisable": "no",
"version": "6.0(4c)",
"virtualMode": "no"
}
}
},
{
"topSystem": {
"attributes": {
"address": "10.0.0.3",
"bootstrapState": "none",
"childAction": "",
"clusterTimeDiff": "8270412",
"configIssues": "",
"controlPlaneMTU": "1500",
"currentTime": "2024-04-11T12:41:19.204-04:00",
"dn": "topology/pod-1/node-3/sys",
"enforceSubnetCheck": "no",
"etepAddr": "0.0.0.0",
"fabricDomain": "fab5",
"fabricId": "1",
"fabricMAC": "00:22:BD:F8:19:FF",
"id": "3",
"inbMgmtAddr": "0.0.0.0",
"inbMgmtAddr6": "fc00::1",
"inbMgmtAddr6Mask": "0",
"inbMgmtAddrMask": "0",
"inbMgmtGateway": "0.0.0.0",
"inbMgmtGateway6": "::",
"lastRebootTime": "2024-02-13T13:01:50.077-04:00",
"lastResetReason": "unknown",
"lcOwn": "local",
"modTs": "2024-02-13T15:27:15.193-04:00",
"mode": "unspecified",
"monPolDn": "uni/fabric/monfab-default",
"name": "fab5-apic3",
"nameAlias": "",
"nodeType": "unspecified",
"oobMgmtAddr": "192.168.4.34",
"oobMgmtAddr6": "fe80::e6aa:5dff:fe13:efea",
"oobMgmtAddr6Mask": "0",
"oobMgmtAddrMask": "24",
"oobMgmtGateway": "192.168.4.1",
"oobMgmtGateway6": "::",
"podId": "1",
"remoteNetworkId": "0",
"remoteNode": "no",
"rlOperPodId": "0",
"rlRoutableMode": "no",
"rldirectMode": "no",
"role": "controller",
"serial": "FCH1937V0Z9",
"serverType": "unspecified",
"siteId": "0",
"state": "in-service",
"status": "",
"systemUpTime": "57:23:38:04.000",
"tepPool": "0.0.0.0",
"unicastXrEpLearnDisable": "no",
"version": "6.0(4c)",
"virtualMode": "no"
}
}
}
]
}
Loading