diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index 41d7959..a0bce66 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -3144,32 +3144,37 @@ def post_upgrade_cb_check(index, total_checks, cversion, tversion, **kwargs): new_mo_dict = { "infraImplicitSetPol": { "CreatedBy": "", - "SinceVersion": "3.2(10e)", + "SinceVersion": ["3.2(10e)"], "Impact": "Infra implicit settings will not be deployed", }, "infraRsToImplicitSetPol": { "CreatedBy": "infraImplicitSetPol", - "SinceVersion": "3.2(10e)", + "SinceVersion": ["3.2(10e)"], "Impact": "Infra implicit settings will not be deployed", }, "fvSlaDef": { "CreatedBy": "fvIPSLAMonitoringPol", - "SinceVersion": "4.1(1i)", + "SinceVersion": ["4.1(1i)"], "Impact": "IPSLA monitor policy will not be deployed", }, "infraRsConnectivityProfileOpt": { "CreatedBy": "infraRsConnectivityProfile", - "SinceVersion": "5.2(4d)", + "SinceVersion": ["5.2(4d)"], "Impact": "VPC for missing Mo will not be deployed to leaf", }, "infraAssocEncapInstDef": { "CreatedBy": "infraRsToEncapInstDef", - "SinceVersion": "5.2(4d)", + "SinceVersion": ["5.2(4d)"], + "Impact": "VLAN for missing Mo will not be deployed to leaf", + }, + "infraRsToInterfacePolProfileOpt": { + "CreatedBy": "infraRsToInterfacePolProfile", + "SinceVersion": ["5.2(8d)","6.0(3d)"], "Impact": "VLAN for missing Mo will not be deployed to leaf", }, "compatSwitchHw": { "CreatedBy": "", # suppBit attribute is available from 6.0(2h) - "SinceVersion": "6.0(2h)", + "SinceVersion": ["6.0(2h)"], "Impact": "Unexpected 64/32 bit image can deploy to switches", }, } @@ -3178,12 +3183,16 @@ def post_upgrade_cb_check(index, total_checks, cversion, tversion, **kwargs): return POST for new_mo in new_mo_dict: - since_version = AciVersion(new_mo_dict[new_mo]['SinceVersion']) - created_by_mo = new_mo_dict[new_mo]['CreatedBy'] - - if since_version.newer_than(str(cversion)): + skip_current_mo=False + if cversion.older_than(new_mo_dict[new_mo]['SinceVersion'][0]): continue - + for version in new_mo_dict[new_mo]['SinceVersion']: + if version[0]==str(cversion)[0]: + if AciVersion(version).newer_than(str(cversion)): + skip_current_mo=True + if skip_current_mo: + continue + created_by_mo = new_mo_dict[new_mo]['CreatedBy'] api = "{}.json?rsp-subtree-include=count" if new_mo == "compatSwitchHw": # Expected to see suppBit in 32 or 64. Zero 32 means a failed postUpgradeCb. diff --git a/docs/docs/validations.md b/docs/docs/validations.md index ce90f9a..b86c8e7 100644 --- a/docs/docs/validations.md +++ b/docs/docs/validations.md @@ -388,11 +388,11 @@ This validation checks whether the number of objects for the existing and newly !!! example - If the existing class and the new class are `infraRsToEncapInstDef` and `infraAssocEncapInstDef`, the impact of incomplete post-upgrade callback (i.e. incomplete data conversion) is that VLANs will not be deployed on leaf switches after the upgrade of the switch. - You can check the number of objects for these classes via moquery and query option `rsp-subtree-include=count` as shown below. - If the Mo count for both classes are the same, it means that `infraAssocEncapInstDef` was created successfully after the APIC upgrade by `infraRsToEncapInstDef`'s post-upgrade callback. + If the old/new class result is `infraRsToEncapInstDef`/`infraAssocEncapInstDef` or `infraRsToInterfacePolProfile`/`infraRsToInterfacePolProfileOpt`, the impact of incomplete post-upgrade callback (i.e. incomplete data conversion) is that VLANs will not be deployed on leaf switches after the upgrade of the switch. + + You can check the number of objects for each of these classes via moquery and the query option `rsp-subtree-include=count`: ``` - apic1# moquery -c infraAssocEncapInstDef -x rsp-subtree-include=count + apic1# moquery -c infraRsToEncapInstDef -x rsp-subtree-include=count Total Objects shown: 1 # mo.Count @@ -404,7 +404,8 @@ This validation checks whether the number of objects for the existing and newly rn : cnt status : - apic1# moquery -c infraRsToEncapInstDef -x rsp-subtree-include=count + + apic1# moquery -c infraAssocEncapInstDef -x rsp-subtree-include=count Total Objects shown: 1 # mo.Count @@ -417,6 +418,8 @@ This validation checks whether the number of objects for the existing and newly status : ``` + If the Mo count for both old/new classes are the same, it means that new class was created successfully after the APIC upgrade by the old class's post-upgrade callback. + ### 6.0(2)+ requires 32 and 64 bit switch images diff --git a/tests/post_upgrade_cb_check/test_post_upgrade_cb_check.py b/tests/post_upgrade_cb_check/test_post_upgrade_cb_check.py index e41561a..c964ad9 100644 --- a/tests/post_upgrade_cb_check/test_post_upgrade_cb_check.py +++ b/tests/post_upgrade_cb_check/test_post_upgrade_cb_check.py @@ -13,13 +13,22 @@ # icurl queries mo1_new = "infraRsToImplicitSetPol.json?rsp-subtree-include=count" mo1_old = "infraImplicitSetPol.json?rsp-subtree-include=count" + mo2_new = "fvSlaDef.json?rsp-subtree-include=count" mo2_old = "fvIPSLAMonitoringPol.json?rsp-subtree-include=count" + mo3_new = "infraRsConnectivityProfileOpt.json?rsp-subtree-include=count" mo3_old = "infraRsConnectivityProfile.json?rsp-subtree-include=count" + mo4_new = "infraAssocEncapInstDef.json?rsp-subtree-include=count" mo4_old = "infraRsToEncapInstDef.json?rsp-subtree-include=count" -mo5_new = 'compatSwitchHw.json?rsp-subtree-include=count&query-target-filter=eq(compatSwitchHw.suppBit,"32")' + +mo5_new = "infraRsToInterfacePolProfileOpt.json?rsp-subtree-include=count" +mo5_old = "infraRsToInterfacePolProfile.json?rsp-subtree-include=count" + +mo6_new = 'compatSwitchHw.json?rsp-subtree-include=count&query-target-filter=eq(compatSwitchHw.suppBit,"32")' + + # icurl output sets mo_count_pass = { @@ -32,6 +41,8 @@ mo4_new: read_data(dir, "moCount_10.json"), mo4_old: read_data(dir, "moCount_10.json"), mo5_new: read_data(dir, "moCount_10.json"), + mo5_old: read_data(dir, "moCount_10.json"), + mo6_new: read_data(dir, "moCount_10.json"), } mo_count_fail = { # Both infraImplicitSetPol and infraRsToImplicitSetPol are brand new classes. @@ -46,9 +57,11 @@ mo3_old: read_data(dir, "moCount_10.json"), mo4_new: read_data(dir, "moCount_8.json"), mo4_old: read_data(dir, "moCount_10.json"), + mo5_new: read_data(dir, "moCount_8.json"), + mo5_old: read_data(dir, "moCount_10.json"), # suppBit is a new attribute in 6.0.2 that can be either 32 or 64. # When postUpgradeCb failed, there may be no compatSwitch with suppBit being 32. - mo5_new: read_data(dir, "moCount_0.json"), + mo6_new: read_data(dir, "moCount_0.json"), }