Update serial_number and model

Updated the match pattern of serial_number and model to the current 1.2/1.3 release of Vyos, maintained code for older versions
This commit is contained in:
Marcus Hoff 2020-10-18 14:22:50 +02:00
parent fe3d5560ab
commit a4a0645f27
1 changed files with 8 additions and 3 deletions

View File

@ -698,10 +698,15 @@ class VyOSDriver(NetworkDriver):
ver_str = [line for line in output if "Version" in line][0] ver_str = [line for line in output if "Version" in line][0]
version = self.parse_version(ver_str) version = self.parse_version(ver_str)
above_1_1 = True if version.startswith('1.0') or version.startswith(1.1) else False
if above_1_1:
sn_str = [line for line in output if "Hardware S/N" in line][0]
hwmodel_str = [line for line in output if "Hardware model" in line][0]
else:
sn_str = [line for line in output if "S/N" in line][0] sn_str = [line for line in output if "S/N" in line][0]
snumber = self.parse_snumber(sn_str)
hwmodel_str = [line for line in output if "HW model" in line][0] hwmodel_str = [line for line in output if "HW model" in line][0]
snumber = self.parse_snumber(sn_str)
hwmodel = self.parse_hwmodel(hwmodel_str) hwmodel = self.parse_hwmodel(hwmodel_str)
output = self.device.send_command("show configuration") output = self.device.send_command("show configuration")