Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #61 from napalm-automation/develop
Browse files Browse the repository at this point in the history
Release 0.3.2 - master
  • Loading branch information
mirceaulinic committed Nov 3, 2016
2 parents ecb952e + 27b57c6 commit cad2ed5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
22 changes: 15 additions & 7 deletions napalm_iosxr/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations under
# the License.

from __future__ import unicode_literals

# import stdlib
import re
import copy
Expand All @@ -32,6 +34,7 @@
# import NAPALM base
import napalm_base.helpers
from napalm_base.base import NetworkDriver
from napalm_base.utils import py23_compat
from napalm_base.exceptions import ConnectionException
from napalm_base.exceptions import MergeConfigException
from napalm_base.exceptions import ReplaceConfigException
Expand Down Expand Up @@ -1186,15 +1189,18 @@ def get_mac_address_table(self):

return mac_table

def get_route_to(self, destination='', protocol=''):
def get_route_to(self, destination=None, protocol=None):

routes = {}

if not isinstance(destination, str):
if not isinstance(destination, py23_compat.string_types):
raise TypeError('Please specify a valid destination!')

if not isinstance(protocol, str) or protocol.lower() not in ['static', 'bgp', 'isis']:
raise TypeError("Protocol not supported: {protocol}.".format(protocol=protocol))
if not isinstance(protocol, py23_compat.string_types) or \
protocol.lower() not in ('static', 'bgp', 'isis'):
raise TypeError("Protocol not supported: {protocol}.".format(
protocol=protocol
))

protocol = protocol.lower()
dest_split = destination.split('/')
Expand Down Expand Up @@ -1654,7 +1660,7 @@ def get_users(self):
user_details = _DEFAULT_USER_DETAILS.copy()
user_details.update({
'level': level,
'password': str(password)
'password': py23_compat.text_type(password)
})
users[username] = user_details

Expand All @@ -1669,8 +1675,10 @@ def get_config(self, retrieve='all'):
} # default values

if retrieve.lower() in ['running', 'all']:
config['running'] = self.device._execute_config_show('show running-config')
config['running'] = py23_compat.text_type(
self.device._execute_config_show('show running-config'))
if retrieve.lower() in ['candidate', 'all']:
config['candidate'] = self.device._execute_config_show('show configuration merge')
config['candidate'] = py23_compat.text_type(
self.device._execute_config_show('show configuration merge'))

return config
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
napalm_base==0.17.0
napalm-base>=0.18.0
pyIOSXR >= 0.20
netaddr
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

setup(
name="napalm-iosxr",
version="0.3.1",
version="0.3.2",
packages=find_packages(),
author="David Barroso",
author_email="dbarrosop@dravetech.com",
author="David Barroso, Mircea Ulinic",
author_email="dbarrosop@dravetech.com, mircea@cloudflare.com",
description="Network Automation and Programmability Abstraction Layer with Multivendor support",
classifiers=[
'Topic :: Utilities',
Expand Down

0 comments on commit cad2ed5

Please sign in to comment.