From f1b7fe13f57f98cf0b7a43227fa30d538d617c20 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Thu, 17 Dec 2015 19:54:27 -0800 Subject: [PATCH 1/8] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f1012bf..c3b8358 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ docs/_build/ .DS_Store env +*.swp From b5628f82d78d06c07c0786eb52072e2d4b6b2140 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Thu, 17 Dec 2015 19:54:27 -0800 Subject: [PATCH 2/8] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f1012bf..c3b8358 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ docs/_build/ .DS_Store env +*.swp From ae600e9a148c4d39feec6d5e6613368da69e6c7d Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 5 Jan 2016 19:42:26 -0800 Subject: [PATCH 3/8] Removing some IOS unit test .conf files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index c3b8358..951a9ba 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,8 @@ docs/_build/ env *.swp + +test/unit/ios/new_good.conf +test/unit/ios/initial.conf.orig +napalm/fix_script.sh + From 64ac8f6e182477ec11b77bb0415cb168f16efa5f Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 5 Jan 2016 19:43:23 -0800 Subject: [PATCH 4/8] restoring gitignore --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 951a9ba..4ee73da 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,3 @@ docs/_build/ env *.swp -test/unit/ios/new_good.conf -test/unit/ios/initial.conf.orig -napalm/fix_script.sh - From be9f52a3e186aba9d9bfcaa2ebe373e76340d9cd Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Wed, 6 Jan 2016 21:35:58 -0800 Subject: [PATCH 5/8] Add support for optional arguments --- ansible/napalm_get_facts | 8 ++++++-- ansible/napalm_install_config | 10 ++++++++-- napalm/fortios.py | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ansible/napalm_get_facts b/ansible/napalm_get_facts index 3f5933b..09609d6 100644 --- a/ansible/napalm_get_facts +++ b/ansible/napalm_get_facts @@ -38,19 +38,23 @@ def main(): username=dict(required=True), password=dict(required=True), dev_os=dict(required=True), + optional_args=dict(required=False, type='dict', default=None) ), supports_check_mode=True ) + if module.params['optional_args'] is None: + optional_args = {} + else: + optional_args = module.params['optional_args'] hostname = module.params['hostname'] username = module.params['username'] dev_os = module.params['dev_os'] password = module.params['password'] - network_driver = get_network_driver(dev_os) - device = network_driver(hostname, username, password) + device = network_driver(hostname, username, password, optional_args=optional_args) device.open() facts = device.get_facts() diff --git a/ansible/napalm_install_config b/ansible/napalm_install_config index 438bd56..838478d 100644 --- a/ansible/napalm_install_config +++ b/ansible/napalm_install_config @@ -125,11 +125,17 @@ def main(): commit_changes=dict(required=True), replace_config=dict(required=True), diff_file=dict(required=False, default=None), - get_diffs=dict(required=False, choices=BOOLEANS, type='bool', default=True) + get_diffs=dict(required=False, choices=BOOLEANS, type='bool', default=True), + optional_args=dict(required=False, type='dict', default=None) ), supports_check_mode=True ) + if module.params['optional_args'] is None: + optional_args = {} + else: + optional_args = module.params['optional_args'] + hostname = module.params['hostname'] username = module.params['username'] dev_os = module.params['dev_os'] @@ -149,7 +155,7 @@ def main(): network_driver = get_network_driver(dev_os) - device = network_driver(hostname, username, password, timeout) + device = network_driver(hostname, username, password, timeout, optional_args=optional_args) device.open() if replace_config: diff --git a/napalm/fortios.py b/napalm/fortios.py index 818ab2c..8f7304b 100644 --- a/napalm/fortios.py +++ b/napalm/fortios.py @@ -34,7 +34,9 @@ def execute_get(device, cmd, separator=':', auto=False): class FortiOSDriver(NetworkDriver): - def __init__(self, hostname, username, password, timeout=60): + def __init__(self, hostname, username, password, timeout=60, optional_args=None): + if optional_args is None: + optional_args = {} self.hostname = hostname self.username = username self.password = password From af0a6ea04ceaf6989ff0cb60b3d9eda6a65f5aab Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 26 Jan 2016 11:51:20 -0800 Subject: [PATCH 6/8] tmp gitignore for rebase --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 4ee73da..0e912f4 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ docs/_build/ env *.swp +test/unit/ios/*.conf +napalm/fix_script.sh From 5149c362ca772eb5c6b24b80b4d983db80527479 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 26 Jan 2016 12:33:37 -0800 Subject: [PATCH 7/8] Restore back to original gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0e912f4..4ee73da 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,3 @@ docs/_build/ env *.swp -test/unit/ios/*.conf -napalm/fix_script.sh From 4f6b617cf6d28f33f9de2ebc3eb26f3daec8e583 Mon Sep 17 00:00:00 2001 From: Kirk Byers Date: Tue, 26 Jan 2016 12:38:18 -0800 Subject: [PATCH 8/8] fix .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 4ee73da..a6efb9e 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,6 @@ docs/_build/ env *.swp +napalm/fix_script.sh +test/unit/ios/*.conf +