diff --git a/napalm/eos/eos.py b/napalm/eos/eos.py index 32cd33418..312a0c347 100644 --- a/napalm/eos/eos.py +++ b/napalm/eos/eos.py @@ -85,25 +85,6 @@ class EOSDriver(NetworkDriver): re.VERBOSE, ) - def _determine_syntax_version(self, ver_output): - """ - Determine cli syntax version from "sh ver" output - Syntax versions: - 1: all EOS versions before 4.23.0 - 2: all EOS version 4.23.0 and higher - :param ver_output: list of lines for "sh ver" command output - :return: int: cli version - """ - regexp = re.compile(r"^Software image version:\s+(?P\d+\.\d+\.\d+)") - - for line in ver_output.split("\n"): - m = regexp.match(line) - - if m and EOSVersion(m.group("version")) >= EOSVersion("4.23.0"): - return 2 - - return 1 - def __init__(self, hostname, username, password, timeout=60, optional_args=None): """ Initialize EOS Driver. @@ -181,8 +162,9 @@ def open(self): # does not raise an Exception if unusable # let's try to determine if we need to use new EOS cli syntax - cli_version = self._determine_syntax_version( - self.device.run_commands(["show version"], encoding="text")[0]["output"] + sh_ver = self.device.run_commands(["show version"]) + cli_version = ( + 2 if EOSVersion(sh_ver[0]["version"]) >= EOSVersion("4.23.0") else 1 ) self.device.update_cli_version(cli_version) diff --git a/test/eos/mocked_data/show_version.json b/test/eos/mocked_data/show_version.json new file mode 100644 index 000000000..092d29bce --- /dev/null +++ b/test/eos/mocked_data/show_version.json @@ -0,0 +1,16 @@ +{ + "memTotal": 3954980, + "uptime": 200478.31, + "modelName": "DCS-7150S-64-CL-R", + "internalVersion": "4.21.8M-2GB-13902577.4218M", + "mfgName": "Arista", + "serialNumber": "JPE00000000", + "systemMacAddress": "00:1c:73:00:00:00", + "bootupTimestamp": 1588135848.0, + "memFree": 2558364, + "version": "4.21.8M-2GB", + "architecture": "i386", + "isIntlVersion": false, + "internalBuildId": "5af75062-ded5-4c99-8f44-daa88aa4414d", + "hardwareRevision": "01.03" +} diff --git a/test/eos/mocked_data/show_version.text b/test/eos/mocked_data/show_version.text deleted file mode 100644 index 9e8d32728..000000000 --- a/test/eos/mocked_data/show_version.text +++ /dev/null @@ -1,13 +0,0 @@ -Arista DCS-7150S-64-CL-R -Hardware version: 01.01 -Serial number: JPE00000000 -System MAC address: 001c.7327.07e0 - -Software image version: 4.22.4M-2GB -Architecture: i686 -Internal build version: 4.22.4M-2GB-15583082.4224M -Internal build ID: 523a3357-484c-4110-9019-39750ffa8af5 - -Uptime: 3 weeks, 1 days, 2 hours and 1 minutes -Total memory: 4009188 kB -Free memory: 2515256 kB