Skip to content

Commit f7625ca

Browse files
Merge pull request #26 from aristanetworks/fix-os-version-for-release-swis
Use internal build version for release SWIs
2 parents 0986854 + 7740a07 commit f7625ca

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/pytest_netdut/factories.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def _sku(request):
150150
ssh = request.getfixturevalue(f"{name}_ssh")
151151
assert ssh.cli_flavor in {"eos", "mos"}
152152
output = ssh.sendcmd("show version", timeout=300)
153-
matcher = re.search(r"(DCS-7.*)", output)
154-
logging.info("Got SKU: %s", matcher.group(1))
155-
yield matcher.group(1)
153+
match = re.search(r"(DCS-7.*)", output)
154+
logging.info("Got SKU: %s", match.group(1))
155+
yield match.group(1)
156156

157157
return _sku
158158

@@ -163,9 +163,16 @@ def _os_version(request):
163163
ssh = request.getfixturevalue(f"{name}_ssh")
164164
assert ssh.cli_flavor in {"eos", "mos"}
165165
output = ssh.sendcmd("show version", timeout=300)
166-
matcher = re.search(r"Software image version: (\S*)", output)
167-
logging.info("Got OS version: %s", matcher.group(1))
168-
yield matcher.group(1)
166+
if ssh.cli_flavor == "mos":
167+
match = re.search(r"Software image version: (\S*)", output)
168+
else:
169+
# On release SWIs the "Sofware image version" only contains the version, e.g.
170+
# Software image version: 4.31.0F
171+
# Architecture: x86_64
172+
# Internal build version: 4.31.0F-33797590.4310F
173+
match = re.search(r"Internal build version: (\S*)", output)
174+
logging.info("Got OS version: %s", match.group(1))
175+
yield match.group(1)
169176

170177
return _os_version
171178

0 commit comments

Comments
 (0)