Skip to content
This repository was archived by the owner on Feb 10, 2018. It is now read-only.

Commit 6277c84

Browse files
authored
Merge pull request #73 from napalm-automation/develop
Release 0.4.3 - master
2 parents da7da3f + 4dd98dc commit 6277c84

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

napalm_junos/junos.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
"""Driver for JunOS devices."""
1717

18+
from __future__ import unicode_literals
19+
1820
# import stdlib
1921
import re
2022
import collections
@@ -33,6 +35,7 @@
3335
import napalm_base.helpers
3436
from napalm_base.base import NetworkDriver
3537
from napalm_base.utils import string_parsers
38+
from napalm_base.utils import py23_compat
3639
from napalm_base.exceptions import ConnectionException
3740
from napalm_base.exceptions import MergeConfigException
3841
from napalm_base.exceptions import CommandErrorException
@@ -948,14 +951,15 @@ def get_mac_address_table(self):
948951

949952
return mac_address_table
950953

951-
def get_route_to(self, destination='', protocol=''):
954+
def get_route_to(self, destination=None, protocol=None):
952955
"""Return route details to a specific destination, learned from a certain protocol."""
953956
routes = {}
954957

955-
if not isinstance(destination, str):
958+
if not isinstance(destination, py23_compat.string_types):
956959
raise TypeError('Please specify a valid destination!')
957960

958-
if not isinstance(protocol, str) or protocol.lower() not in ['static', 'bgp', 'isis']:
961+
if not isinstance(protocol, py23_compat.string_types) or \
962+
protocol.lower() not in ('static', 'bgp', 'isis'):
959963
raise TypeError("Protocol not supported: {protocol}.".format(
960964
protocol=protocol
961965
))
@@ -1253,6 +1257,10 @@ def get_users(self):
12531257
d[0]: d[1] for d in user_entry[1] if d[1]
12541258
})
12551259
user_class = user_details.pop('class', '')
1260+
user_details = {
1261+
key: py23_compat.text_type(user_details[key])
1262+
for key in user_details.keys()
1263+
}
12561264
level = _JUNOS_CLASS_CISCO_PRIVILEGE_LEVEL_MAP.get(user_class, 0)
12571265
user_details.update({
12581266
'level': level
@@ -1335,11 +1343,11 @@ def get_config(self, retrieve='all'):
13351343

13361344
if retrieve in ('candidate', 'all'):
13371345
config = self.device.rpc.get_config(filter_xml=None, options=options)
1338-
rv['candidate'] = config.text.encode('ascii', 'replace')
1346+
rv['candidate'] = py23_compat.text_type(config.text.encode('ascii', 'replace'))
13391347

13401348
if retrieve in ('running', 'all'):
13411349
options['database'] = 'committed'
13421350
config = self.device.rpc.get_config(filter_xml=None, options=options)
1343-
rv['running'] = config.text.encode('ascii', 'replace')
1351+
rv['running'] = py23_compat.text_type(config.text.encode('ascii', 'replace'))
13441352

13451353
return rv

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
napalm_base==0.17.0
1+
napalm-base>=0.18.0
22
junos-eznc

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="napalm-junos",
15-
version="0.4.2",
15+
version="0.4.3",
1616
packages=find_packages(),
1717
author="David Barroso, Mircea Ulinic",
1818

0 commit comments

Comments
 (0)