From c066f04c1bc392a788f6dfd2588ffbaa82646462 Mon Sep 17 00:00:00 2001 From: Arzhel Younsi Date: Tue, 25 Oct 2016 13:02:48 -0700 Subject: [PATCH 1/5] Add allow_agent Now that netmiko supports paramiko's "allow_agent" (see https://github.com/ktbyers/netmiko/releases/tag/v1.1.0 ) This patch is to add that option to the accepted optional args for napalm-ios --- napalm_ios/ios.py | 1 + 1 file changed, 1 insertion(+) diff --git a/napalm_ios/ios.py b/napalm_ios/ios.py index 1d4c8ba..96947f0 100644 --- a/napalm_ios/ios.py +++ b/napalm_ios/ios.py @@ -62,6 +62,7 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None) 'alt_host_keys': False, 'alt_key_file': '', 'ssh_config_file': None, + 'allow_agent': False, } # Build dict of any optional Netmiko args From 46272374b6d1124de9f753f74742a05a017fc603 Mon Sep 17 00:00:00 2001 From: Arzhel Younsi Date: Tue, 25 Oct 2016 15:12:00 -0700 Subject: [PATCH 2/5] Add allow_agent argument only if netmiko >= 1.1.0 --- napalm_ios/ios.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/napalm_ios/ios.py b/napalm_ios/ios.py index 96947f0..d808984 100644 --- a/napalm_ios/ios.py +++ b/napalm_ios/ios.py @@ -18,6 +18,7 @@ import re from netmiko import ConnectHandler, FileTransfer +from netmiko import __version__ as netmiko_version from napalm_base.base import NetworkDriver from napalm_base.exceptions import ReplaceConfigException, MergeConfigException @@ -62,9 +63,13 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None) 'alt_host_keys': False, 'alt_key_file': '', 'ssh_config_file': None, - 'allow_agent': False, } + maj_ver, min_ver, bug_fix = netmiko_version.split('.') + # allow_agent argument is only supported starting netmiko 1.1.0 + if int(maj_ver + min_ver + bug_fix) >= 110: + netmiko_argument_map['allow_agent'] = False + # Build dict of any optional Netmiko args self.netmiko_optional_args = {} for k, v in netmiko_argument_map.items(): From ca196ed6f7e13d001e9361fef932448c385d0bb5 Mon Sep 17 00:00:00 2001 From: Arzhel Younsi Date: Tue, 25 Oct 2016 16:08:28 -0700 Subject: [PATCH 3/5] Use better version comparison --- napalm_ios/ios.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/napalm_ios/ios.py b/napalm_ios/ios.py index d808984..620814f 100644 --- a/napalm_ios/ios.py +++ b/napalm_ios/ios.py @@ -65,9 +65,12 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None) 'ssh_config_file': None, } - maj_ver, min_ver, bug_fix = netmiko_version.split('.') - # allow_agent argument is only supported starting netmiko 1.1.0 - if int(maj_ver + min_ver + bug_fix) >= 110: + fields = netmiko_version.split('.') + fields = [int(x) for x in fields] + maj_ver, min_ver, bug_fix = fields + if maj_ver >= 2: + netmiko_argument_map['allow_agent'] = False + elif maj_ver == 1 and min_ver >= 1: netmiko_argument_map['allow_agent'] = False # Build dict of any optional Netmiko args From f74adfb93ec47045a5275fa90207fc517f065a13 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 1 Nov 2016 09:41:53 -0700 Subject: [PATCH 4/5] Pin to napalm-base >= 0.18.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7b6deef..be2156f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -napalm_base==0.17.0 +napalm_base>=0.18.0 netmiko>=1.0.0 From 5d6d143e547a5919a0804acc9c62ab4e8f54ea6a Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 1 Nov 2016 09:46:51 -0700 Subject: [PATCH 5/5] Rolling version to 0.3.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 202c10b..0840267 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="napalm-ios", - version="0.3.0", + version="0.3.1", packages=find_packages(), author="David Barroso", author_email="dbarrosop@dravetech.com",