Skip to content

Commit

Permalink
added new postUpgradeCb check for CSCwe21982 (#147)
Browse files Browse the repository at this point in the history
* added new postUpgradeCb check for CSCwe21982

* fix when SinceVersion is list

* minor optimization for postUpgradeCb

* Change SinceVersion type from string to list for function post_upgrade_cb_check

* update test

* update docs

---------

Co-authored-by: Gabriel <[email protected]>
  • Loading branch information
welkin-he and monrog2 authored Aug 14, 2024
1 parent 6d0c6f3 commit 52a9918
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
31 changes: 20 additions & 11 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
Expand All @@ -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.
Expand Down
13 changes: 8 additions & 5 deletions docs/docs/validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
17 changes: 15 additions & 2 deletions tests/post_upgrade_cb_check/test_post_upgrade_cb_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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.
Expand All @@ -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"),
}


Expand Down

0 comments on commit 52a9918

Please sign in to comment.