Skip to content

Commit

Permalink
added contract_22_defect_check (#6)
Browse files Browse the repository at this point in the history
* added contract_22_defect_check

* added newer_than method + cfw check

* update ACIversion range; start at 1

* no target version = MANUAL

Co-authored-by: gmonroy <[email protected]>
  • Loading branch information
monrog2 and monrog2 authored Sep 24, 2021
1 parent 6ac87d9 commit ff5ea39
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Key:
|----------------------------------------|-----------------------------------------------------------|-------------------------------|
| EP Announce Compatibility | Checks if TVER and CVER are affected by CSCvi76161 | EP Announce version mismatch |
| Eventmgr DB size defect susceptibility | Check if CVER is affected by CSCvn20175 | None, Contact TAC for verification |
| Contract Port 22 defect susceptibility | Check if TVER is affected by CSCvz65560 | None |

## Log Files

Expand Down
31 changes: 29 additions & 2 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,17 @@ def __init__(self, version):
def older_than(self, version):
v = re.search(self.v_regex, version)
if not v: return None
for i in range(len(v.groups())):
for i in range(1, len(v.groups())):
if self.regex.group(i) > v.group(i): return False
elif self.regex.group(i) < v.group(i): return True
return False

def newer_than(self, version):
return not self.older_than(version) and not self.same_as(version)

def same_as(self, version):
v = re.search(self.v_regex, version)
ver = ('{major1}.{major2}.{maint}{patch}'
ver = ('{major1}.{major2}({maint}{patch})'
.format(**v.groupdict()) if v else None)
return self.version == ver

Expand Down Expand Up @@ -2044,6 +2047,29 @@ def gen1_switch_compatibility_check(index, total_checks, tversion, **kwargs):
return result


def contract_22_defect_check(index, total_checks, cversion, tversion, **kwargs):
title = 'Contract Port 22 Defect Check'
result = PASS
msg = ''
headers = ["Potential Defect", "Reason"]
data = []
recommended_action = 'Review Software Advisory for details'
doc_url = 'Cisco Software Advisory Notices for CSCvz65560 - http://cs.co/9007yh22H'
cfw = AciVersion(cversion)
print_title(title, index, total_checks)

if tversion:
tfw = AciVersion(tversion)
if cfw.older_than("5.0(1a)") and tfw.newer_than("5.0(1a)"):
result = FAIL_O
data.append(["CSCvz65560", "Target Version susceptible to Defect"])
else:
result = MANUAL
msg = 'Target version not supplied. Skipping.'

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

if __name__ == "__main__":
prints(' ==== %s%s ====\n' % (ts, tz))
username, password = get_credentials()
Expand Down Expand Up @@ -2106,6 +2132,7 @@ def gen1_switch_compatibility_check(index, total_checks, tversion, **kwargs):
# Bugs
ep_announce_check,
eventmgr_db_defect_check,
contract_22_defect_check,
]
summary = {PASS: 0, FAIL_O: 0, FAIL_UF: 0, ERROR: 0, MANUAL: 0, NA: 0, 'TOTAL': len(checks)}
for idx, check in enumerate(checks):
Expand Down

0 comments on commit ff5ea39

Please sign in to comment.