From c7d6577a2ca1ac145b4b41b0021856d9c362c3a6 Mon Sep 17 00:00:00 2001 From: Daniel Bacher Date: Fri, 30 Oct 2020 10:46:37 +0100 Subject: [PATCH] adjust get_interfaces_ip function for compatibility with sgx00 series include and begin are not available on sgx00 devices --- napalm_s350/s350.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/napalm_s350/s350.py b/napalm_s350/s350.py index 3e4c92f..5121234 100644 --- a/napalm_s350/s350.py +++ b/napalm_s350/s350.py @@ -324,10 +324,13 @@ class S350Driver(NetworkDriver): def get_interfaces_ip(self): """Returns all configured interface IP addresses.""" interfaces = {} - show_ip_int = self._send_command('show ip int | include (UP|DOWN)') + valid_interfaces = [] + show_ip_int = self._send_command('show ip int') # Limit to valid interfaces (i.e. ignore vlan 1) - valid_interfaces = [i for i in show_ip_int.splitlines() if i.split()[-1] == 'Valid'] + for line in show_ip_int.splitlines(): + if ('UP' in line or 'DOWN' in line) and line.split()[-1] == 'Valid': + valid_interfaces.append(line) for interface in valid_interfaces: network, name = interface.split()[:2]