Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #171 from napalm-automation/develop
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
mirceaulinic committed Jun 26, 2017
2 parents 3f96f3e + 4749885 commit 7b9f6d4
Show file tree
Hide file tree
Showing 23 changed files with 420 additions and 56 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -64,3 +64,5 @@ report.json
test/unit/TestEOSDriverKB2.py
test/unit/eos/cleanup.sh
test/unit/eos/prep_test.sh

tags
40 changes: 35 additions & 5 deletions napalm_eos/eos.py
Expand Up @@ -76,7 +76,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
if optional_args is None:
optional_args = {}

self.transport = optional_args.get('eos_transport', 'https')
# eos_transport is there for backwards compatibility, transport is the preferred method
self.transport = optional_args.get('transport', optional_args.get('eos_transport', 'https'))

if self.transport == 'https':
self.port = optional_args.get('port', 443)
Expand All @@ -85,6 +86,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)

self.enablepwd = optional_args.get('enable_password', '')

self.profile = ["eos"]

def open(self):
"""Implementation of NAPALM method open."""
try:
Expand Down Expand Up @@ -1181,10 +1184,14 @@ def _sshkey_type(sshkey):
user_details.pop('username', '')
sshkey_value = user_details.pop('sshAuthorizedKey', '')
sshkey_type, sshkey_value = _sshkey_type(sshkey_value)
if sshkey_value != '':
sshkey_list = [sshkey_value]
else:
sshkey_list = []
user_details.update({
'level': user_details.pop('privLevel', 0),
'password': py23_compat.text_type(user_details.pop('secret', '')),
'sshkeys': [sshkey_value]
'sshkeys': sshkey_list
})
users[user] = user_details

Expand Down Expand Up @@ -1677,11 +1684,34 @@ def ping(self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING
fields = line.split()
if 'icmp' in line:
if 'Unreachable' in line:
results_array.append({'ip_address': py23_compat.text_type(fields[1]),
'rtt': 0.0})
if "(" in fields[2]:
results_array.append(
{
'ip_address': py23_compat.text_type(fields[2][1:-1]),
'rtt': 0.0,
}
)
else:
results_array.append({'ip_address': py23_compat.text_type(fields[1]),
'rtt': 0.0})
elif 'truncated' in line:
if "(" in fields[4]:
results_array.append(
{
'ip_address': py23_compat.text_type(fields[4][1:-2]),
'rtt': 0.0,
}
)
else:
results_array.append(
{
'ip_address': py23_compat.text_type(fields[3][:-1]),
'rtt': 0.0,
}
)
elif fields[1] == 'bytes':
m = fields[6][5:]
results_array.append({'ip_address': py23_compat.text_type(fields[3]),
results_array.append({'ip_address': py23_compat.text_type(fields[3][:-1]),
'rtt': float(m)})
elif 'packets transmitted' in line:
ping_dict['success']['probes_sent'] = int(fields[0])
Expand Down
41 changes: 0 additions & 41 deletions napalm_eos/oc_templates/openconfig_bgp.j2

This file was deleted.

17 changes: 11 additions & 6 deletions napalm_eos/utils/textfsm_templates/vrf.tpl
@@ -1,12 +1,17 @@
Value Required Name (\S+)
Value Route_Distinguisher (\d+:\d+|<not set>)
Value List Interfaces (\S.+)
Value List Interfaces (.+?)


Start
^\s\S+\s+(\d|<) -> Continue.Record
^\s+${Name}\s+${Route_Distinguisher}\s+(ipv4,ipv6\s+)?v4:(incomplete|(no )?routing(; multicast)?),\s+$Interfaces
^\s+${Name}\s+${Route_Distinguisher}\s+(ipv4,ipv6\s+)?v4:(incomplete|(no )?routing(; multicast)?),
^\s+v6:(incomplete|(no )?routing)\s+$Interfaces
^\s+v6:(incomplete|(no )?routing) -> Record
^\s+$Interfaces
^\s+${Name}\s+${Route_Distinguisher}\s+(ipv4(,ipv6)?\s+)?v4:(incomplete|(no )?routing(; multicast)?),\s+${Interfaces}(?:,|\s|$$) -> Continue
^\s+\S+\s+(?:\d+:\d+|<not set>)\s+(ipv4(,ipv6)?\s+)?v4:(incomplete|(no )?routing(; multicast)?),\s+(.+?),\s${Interfaces}(\s|,|$$) -> Continue
^\s+\S+\s+(?:\d+:\d+|<not set>)\s+(ipv4(,ipv6)?\s+)?v4:(incomplete|(no )?routing(; multicast)?),\s+(.+?),\s(.+?),\s${Interfaces}(\s|,|$$) -> Continue
^\s+${Name}\s+${Route_Distinguisher}\s+(ipv4(,ipv6)?\s+)?v4:(incomplete|(no )?routing(; multicast)?), -> Continue
^\s{33,37}v6:(incomplete|(no )?routing)\s+${Interfaces}(?:\s|,|$$) -> Continue
^\s{33,37}v6:(incomplete|(no )?routing)\s+(.+?),\s+${Interfaces}(?:\s|,|$$) -> Continue
^\s{33,37}v6:(incomplete|(no )?routing)\s+(.+?),\s+(.+?),\s+${Interfaces}(?:\s|,|$$) -> Continue
^\s{58,62}\s+${Interfaces}(?:\s|,|$$) -> Continue
^\s{58,62}\s+.+?,${Interfaces}(?:\s|,|$$) -> Continue
^\s{58,62}\s+.+?,.+?,${Interfaces}(?:\s|,|$$) -> Continue
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -12,7 +12,7 @@

setup(
name="napalm-eos",
version="0.5.6",
version="0.6.0",
packages=find_packages(),
author="David Barroso, Mircea Ulinic",
author_email="dbarrosop@dravetech.com, mircea@cloudflare.com",
Expand Down
@@ -0,0 +1 @@
{"TEST": {"interfaces": {"interface": {"Ethernet1": {}, "Vlan103": {}, "Vlan102": {}, "Vlan101": {}, "Vlan100": {}, "Vlan104": {}}}, "state": {"route_distinguisher": "0:1"}, "type": "L3VRF", "name": "TEST"}, "default": {"interfaces": {"interface": {"Management1": {}, "Ethernet3": {}}}, "state": {"route_distinguisher": ""}, "type": "DEFAULT_INSTANCE", "name": "default"}, "NON": {"interfaces": {"interface": {}}, "state": {"route_distinguisher": ""}, "type": "L3VRF", "name": "NON"}, "TEST2": {"interfaces": {"interface": {}}, "state": {"route_distinguisher": "1234:4321"}, "type": "L3VRF", "name": "TEST2"}, "MGMT": {"interfaces": {"interface": {"Vlan2": {}, "Vlan3": {}, "Vlan4": {}}}, "state": {"route_distinguisher": "0:0"}, "type": "L3VRF", "name": "MGMT"}}

0 comments on commit 7b9f6d4

Please sign in to comment.