From ff5ea39916667f7d5d28055d76af85776e856ab0 Mon Sep 17 00:00:00 2001 From: GM Date: Thu, 23 Sep 2021 20:45:55 -0400 Subject: [PATCH] added contract_22_defect_check (#6) * 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 --- README.md | 1 + aci-preupgrade-validation-script.py | 31 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f8f7f4b..0350b3d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index 1b11943..c71d37c 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -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 @@ -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() @@ -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):