|
22 | 22 | from getpass import getpass |
23 | 23 | from collections import defaultdict |
24 | 24 | from datetime import datetime |
25 | | -import argparse |
| 25 | +from argparse import ArgumentParser |
26 | 26 | import warnings |
27 | 27 | import time |
28 | 28 | import pexpect |
@@ -5171,27 +5171,24 @@ def ave_eol_check(index, total_checks, tversion, **kwargs): |
5171 | 5171 | return result |
5172 | 5172 |
|
5173 | 5173 |
|
| 5174 | +def args(): |
| 5175 | + parser = ArgumentParser(description="ACI Pre-Upgrade Validation Script - %s" % SCRIPT_VERSION) |
| 5176 | + parser.add_argument("-t", "--tversion", action="store", type=str, help="Upgrade Target Version. Ex. 6.2(1a)") |
| 5177 | + parser.add_argument("-a", "--api-only", action="store_true", help="Run checks that are using only API. Checks using SSH are skipped.") |
| 5178 | + return parser.parse_args() |
| 5179 | + |
| 5180 | + |
5174 | 5181 | if __name__ == "__main__": |
5175 | | - parser = argparse.ArgumentParser() |
5176 | | - parser.add_argument("-v", "--version", help="CCO Version string, e.g. 6.0(2a)", type=str, default=None) |
5177 | | - parser.add_argument("-s", "--scriptcontainer", help="Running in APIC script container, icurl checks only", action="store_true") |
5178 | | - args = parser.parse_args() |
5179 | | - tversion = None |
5180 | | - if args.scriptcontainer: |
5181 | | - username = password = None |
5182 | | - else: |
5183 | | - prints(' ==== %s%s, Script Version %s ====\n' % (ts, tz, SCRIPT_VERSION)) |
5184 | | - prints('!!!! Check https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script for Latest Release !!!!\n') |
| 5182 | + args = args() |
| 5183 | + api_only = args.a |
| 5184 | + prints(' ==== %s%s, Script Version %s ====\n' % (ts, tz, SCRIPT_VERSION)) |
| 5185 | + prints('!!!! Check https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script for Latest Release !!!!\n') |
| 5186 | + if not api_only: |
5185 | 5187 | prints('To use a non-default Login Domain, enter apic#DOMAIN\\\\USERNAME') |
5186 | 5188 | username, password = get_credentials() |
5187 | | - |
5188 | | - if args.version: |
5189 | | - tversion = AciVersion(args.version) |
5190 | | - |
5191 | 5189 | try: |
5192 | 5190 | cversion = get_current_version() |
5193 | | - if not tversion: |
5194 | | - tversion = get_target_version() |
| 5191 | + tversion = AciVersion(args.t) if args.t else get_target_version() |
5195 | 5192 | vpc_nodes = get_vpc_nodes() |
5196 | 5193 | sw_cversion = get_switch_version() |
5197 | 5194 | except Exception as e: |
@@ -5314,8 +5311,7 @@ def ave_eol_check(index, total_checks, tversion, **kwargs): |
5314 | 5311 |
|
5315 | 5312 | ] |
5316 | 5313 | checks = conn_checks + api_checks |
5317 | | - if args.scriptcontainer: |
5318 | | - # No connections allowed within scriptcontainer |
| 5314 | + if api_only: |
5319 | 5315 | checks = api_checks |
5320 | 5316 | summary = {PASS: 0, FAIL_O: 0, FAIL_UF: 0, ERROR: 0, MANUAL: 0, POST: 0, NA: 0, 'TOTAL': len(checks)} |
5321 | 5317 | for idx, check in enumerate(checks): |
|
0 commit comments