[Python-modules-commits] [napalm-eos] 01/03: Import napalm-eos_0.2.1.orig.tar.gz

Vincent Bernat bernat at moszumanska.debian.org
Sat Jun 25 14:07:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

bernat pushed a commit to branch master
in repository napalm-eos.

commit 09655180ea27f318cff2d86d7b67e6d85ceb582c
Author: Vincent Bernat <bernat at debian.org>
Date:   Sat Jun 25 16:05:24 2016 +0200

    Import napalm-eos_0.2.1.orig.tar.gz
---
 PKG-INFO                     |  2 +-
 napalm_eos.egg-info/PKG-INFO |  2 +-
 napalm_eos/eos.py            | 43 +++++++++++++++++++++++++++----------------
 setup.py                     |  2 +-
 4 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index da0ed1e..f546c4f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: napalm-eos
-Version: 0.2.0
+Version: 0.2.1
 Summary: Network Automation and Programmability Abstraction Layer with Multivendor support
 Home-page: https://github.com/napalm-automation/napalm-eos
 Author: David Barroso
diff --git a/napalm_eos.egg-info/PKG-INFO b/napalm_eos.egg-info/PKG-INFO
index da0ed1e..f546c4f 100644
--- a/napalm_eos.egg-info/PKG-INFO
+++ b/napalm_eos.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: napalm-eos
-Version: 0.2.0
+Version: 0.2.1
 Summary: Network Automation and Programmability Abstraction Layer with Multivendor support
 Home-page: https://github.com/napalm-automation/napalm-eos
 Author: David Barroso
diff --git a/napalm_eos/eos.py b/napalm_eos/eos.py
index 0ac698b..050e57c 100644
--- a/napalm_eos/eos.py
+++ b/napalm_eos/eos.py
@@ -176,13 +176,13 @@ class EOSDriver(NetworkDriver):
         commands = list()
         commands.append('show version')
         commands.append('show hostname')
-        commands.append('show interfaces status')
+        commands.append('show interfaces')
 
         result = self.device.run_commands(commands)
 
         version = result[0]
         hostname = result[1]
-        interfaces_dict = result[2]['interfaceStatuses']
+        interfaces_dict = result[2]['interfaces']
 
         uptime = time.time() - version['bootupTimestamp']
 
@@ -857,27 +857,34 @@ class EOSDriver(NetworkDriver):
 
         interfaces_ip = dict()
 
-        commands = list()
-        commands.append('show ip interface')
-        commands.append('show ipv6 interface')
-
-        interfaces_ip_out   = self.device.run_commands(commands)
-        interfaces_ipv4_out = interfaces_ip_out[0].get('interfaces', {})
-        interfaces_ipv6_out = interfaces_ip_out[1].get('interfaces', {})
+        interfaces_ipv4_out = self.device.run_commands(['show ip interface'])[0]['interfaces']
+        try:
+            interfaces_ipv6_out = self.device.run_commands(['show ipv6 interface'])[0]['interfaces']
+        except pyeapi.eapilib.CommandError as e:
+            if 'No IPv6 configured interfaces' in e.message:
+                interfaces_ipv6_out = {}
+            else:
+                raise
 
         for interface_name, interface_details in interfaces_ipv4_out.iteritems():
             ipv4_list = list()
             if interface_name not in interfaces_ip.keys():
                 interfaces_ip[interface_name] = dict()
+                
             if u'ipv4' not in interfaces_ip.get(interface_name):
                 interfaces_ip[interface_name][u'ipv4'] = dict()
-            ipv4_list.append(
-                {
-                    'address'   : interface_details.get('interfaceAddress', {}).get('primaryIp', {}).get('address'),
-                    'masklen'   : interface_details.get('interfaceAddress', {}).get('primaryIp', {}).get('maskLen')
-                }
-            )
-            for secondary_ip in interface_details.get('interfaceAddress', {}).get('secondaryIpsOrderedList', []):
+            if u'ipv6' not in interfaces_ip.get(interface_name):
+                interfaces_ip[interface_name][u'ipv6'] = dict()
+
+            iface_details = interface_details.get('interfaceAddress', {})
+            if iface_details.get('primaryIp', {}).get('address') != '0.0.0.0':
+                ipv4_list.append(
+                    {
+                        'address'   : iface_details.get('primaryIp', {}).get('address'),
+                        'masklen'   : iface_details.get('primaryIp', {}).get('maskLen')
+                    }
+                )
+            for secondary_ip in iface_details.get('secondaryIpsOrderedList', []):
                 ipv4_list.append(
                     {
                         'address'   : secondary_ip.get('address'),
@@ -897,8 +904,12 @@ class EOSDriver(NetworkDriver):
             ipv6_list = list()
             if interface_name not in interfaces_ip.keys():
                 interfaces_ip[interface_name] = dict()
+
+            if u'ipv4' not in interfaces_ip.get(interface_name):
+                interfaces_ip[interface_name][u'ipv4'] = dict()
             if u'ipv6' not in interfaces_ip.get(interface_name):
                 interfaces_ip[interface_name][u'ipv6'] = dict()
+
             ipv6_list.append(
                 {
                     'address'   : interface_details.get('linkLocal', {}).get('address'),
diff --git a/setup.py b/setup.py
index 10b9e3c..911066b 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ reqs = [str(ir.req) for ir in install_reqs]
 
 setup(
     name="napalm-eos",
-    version="0.2.0",
+    version="0.2.1",
     packages=find_packages(),
     author="David Barroso",
     author_email="dbarrosop at dravetech.com",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/napalm-eos.git



More information about the Python-modules-commits mailing list