From 4563edcae58896b4a699ee09ff4cc52c3c2ba33d Mon Sep 17 00:00:00 2001 From: Kenny Lau Date: Fri, 20 Oct 2023 17:54:55 +1100 Subject: [PATCH 1/2] Use internal build version for release SWIs Software image version for release SWIs only contains the version and not the changenum. --- src/pytest_netdut/factories.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pytest_netdut/factories.py b/src/pytest_netdut/factories.py index 4efb085..06f7715 100644 --- a/src/pytest_netdut/factories.py +++ b/src/pytest_netdut/factories.py @@ -163,7 +163,14 @@ def _os_version(request): ssh = request.getfixturevalue(f"{name}_ssh") assert ssh.cli_flavor in {"eos", "mos"} output = ssh.sendcmd("show version", timeout=300) - matcher = re.search(r"Software image version: (\S*)", output) + if ssh.cli_flavor == "mos": + matcher = re.search(r"Software image version: (\S*)", output) + else: + # On release SWIs the "Sofware image version" only contains the version, e.g. + # Software image version: 4.31.0F + # Architecture: x86_64 + # Internal build version: 4.31.0F-33797590.4310F + matcher = re.search(r"Internal build version: (\S*)", output) logging.info("Got OS version: %s", matcher.group(1)) yield matcher.group(1) From 7740a076b89878ab3d84990724e7b429534a6f70 Mon Sep 17 00:00:00 2001 From: Kenny Lau Date: Wed, 25 Oct 2023 10:20:22 +1100 Subject: [PATCH 2/2] Rename matcher to match --- src/pytest_netdut/factories.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pytest_netdut/factories.py b/src/pytest_netdut/factories.py index 06f7715..ca7a7ab 100644 --- a/src/pytest_netdut/factories.py +++ b/src/pytest_netdut/factories.py @@ -150,9 +150,9 @@ def _sku(request): ssh = request.getfixturevalue(f"{name}_ssh") assert ssh.cli_flavor in {"eos", "mos"} output = ssh.sendcmd("show version", timeout=300) - matcher = re.search(r"(DCS-7.*)", output) - logging.info("Got SKU: %s", matcher.group(1)) - yield matcher.group(1) + match = re.search(r"(DCS-7.*)", output) + logging.info("Got SKU: %s", match.group(1)) + yield match.group(1) return _sku @@ -164,15 +164,15 @@ def _os_version(request): assert ssh.cli_flavor in {"eos", "mos"} output = ssh.sendcmd("show version", timeout=300) if ssh.cli_flavor == "mos": - matcher = re.search(r"Software image version: (\S*)", output) + match = re.search(r"Software image version: (\S*)", output) else: # On release SWIs the "Sofware image version" only contains the version, e.g. # Software image version: 4.31.0F # Architecture: x86_64 # Internal build version: 4.31.0F-33797590.4310F - matcher = re.search(r"Internal build version: (\S*)", output) - logging.info("Got OS version: %s", matcher.group(1)) - yield matcher.group(1) + match = re.search(r"Internal build version: (\S*)", output) + logging.info("Got OS version: %s", match.group(1)) + yield match.group(1) return _os_version