Skip to content

Commit

Permalink
Node: fix SONiC detection, and bug fix (#919)
Browse files Browse the repository at this point in the history
The newer SONiC versions have a different string to match to extract
the version. Add that. Plus, fix a bug in extracting the version
during device init.

Signed-off-by: Dinesh Dutt <[email protected]>
  • Loading branch information
ddutt authored Jan 10, 2024
1 parent eddb708 commit 66a46d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions suzieq/config/textfsm_templates/sonic_showsys.tfsm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Start
^${bootupTimestamp}.*$$
^\s*Architecture:\s+${architecture}\s*$$
^SONiC Software Version\s*:\s*${version}\s*$$
^Software\s+Version\s*:\s*${version}.*$$
^Product: Enterprise SONiC Distribution by\s*${vendor}\s*$$
^HwSKU\s*:\s+${model}\s*$$
^Serial Number: ${serialNumber}
2 changes: 1 addition & 1 deletion suzieq/poller/worker/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ async def _parse_init_dev_data_devtype(self, output, cb_token) -> None:
if (len(output) > 1) and (output[1]["status"] == 0):
self.hostname = output[1]["data"].strip()
if (len(output) > 2) and (output[2]["status"] == 0):
self._extract_nos_version(output[1]["data"])
self._extract_nos_version(output[2]["data"])

def _extract_nos_version(self, data: str) -> None:
match = re.search(r'Version:\s+SONiC-OS-([^-]+)', data)
Expand Down

0 comments on commit 66a46d3

Please sign in to comment.