diff --git a/napalm_s350/s350.py b/napalm_s350/s350.py index ca01b2b..3e4c92f 100644 --- a/napalm_s350/s350.py +++ b/napalm_s350/s350.py @@ -277,11 +277,11 @@ class S350Driver(NetworkDriver): """ interfaces = {} - show_status_output = self._send_command('show interfaces status | include (Up|Down)') + show_status_output = self._send_command('show interfaces status') show_description_output = self._send_command('show interfaces description') # Since the MAC address for all the local ports are equal, get the address # from the first port and use it everywhere. - show_system_output = self._send_command('show lldp local GigabitEthernet1 | begin Device\ ID') + show_system_output = self._send_command('show lldp local GigabitEthernet1') try: mac = show_system_output.splitlines()[0].split(':', maxsplit=1)[1].strip() @@ -289,33 +289,34 @@ class S350Driver(NetworkDriver): mac = '0' for status_line in show_status_output.splitlines(): - interface, _, _, speed, _, _, link_state, _, _ = status_line.split() + if 'Up' in status_line or 'Down' in status_line: + interface, _, _, speed, _, _, link_state, _, _ = status_line.split() - if speed == '--': - is_enabled = False - speed = 0 - else: - is_enabled = True - speed = int(speed) + if speed == '--': + is_enabled = False + speed = 0 + else: + is_enabled = True + speed = int(speed) - is_up = (link_state == 'Up') + is_up = (link_state == 'Up') - for descr_line in show_description_output.splitlines(): - description = 0 - if descr_line.startswith(interface): - description = ' '.join(descr_line.split()[1:]) - break + for descr_line in show_description_output.splitlines(): + description = 0 + if descr_line.startswith(interface): + description = ' '.join(descr_line.split()[1:]) + break - entry = { - 'is_up': is_up, - 'is_enabled': is_enabled, - 'speed': speed, - 'last_flapped': -1, - 'description': description, - 'mac_address': napalm.base.helpers.mac(mac) - } + entry = { + 'is_up': is_up, + 'is_enabled': is_enabled, + 'speed': speed, + 'last_flapped': -1, + 'description': description, + 'mac_address': napalm.base.helpers.mac(mac) + } - interfaces[interface] = entry + interfaces[interface] = entry return interfaces