Refactor junos modules to Use netconf and cliconf plugins (#32621)

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin
Fix CI failure
Fix unit test failure
Fix review comments
This commit is contained in:
Ganesh Nalawade 2017-11-24 12:04:47 +05:30 committed by GitHub
commit 3d63ecb6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 543 additions and 320 deletions

View file

@ -185,10 +185,10 @@ from copy import deepcopy
from time import sleep
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.netconf import send_request
from ansible.module_utils.netconf import exec_rpc
from ansible.module_utils.network_common import remove_default_spec
from ansible.module_utils.network_common import conditional
from ansible.module_utils.junos import junos_argument_spec, check_args
from ansible.module_utils.junos import junos_argument_spec
from ansible.module_utils.junos import load_config, map_params_to_obj, map_obj_to_ele
from ansible.module_utils.junos import commit_configuration, discard_changes, locked_config, to_param_list
@ -260,8 +260,6 @@ def main():
supports_check_mode=True)
warnings = list()
check_args(module, warnings)
result = {'changed': False}
if warnings:
@ -338,8 +336,7 @@ def main():
if result['changed']:
sleep(item.get('delay'))
reply = send_request(module, element, ignore_warning=False)
reply = exec_rpc(module, tostring(element), ignore_warning=False)
if state in ('up', 'down'):
admin_status = reply.xpath('interface-information/physical-interface/admin-status')
if not admin_status or not conditional(state, admin_status[0].text.strip()):
@ -361,7 +358,7 @@ def main():
intf_name = SubElement(element, 'interface-device')
intf_name.text = item.get('name')
reply = send_request(module, element, ignore_warning=False)
reply = exec_rpc(module, tostring(element), ignore_warning=False)
have_host = [item.text for item in reply.xpath('lldp-neighbors-information/lldp-neighbor-information/lldp-remote-system-name')]
have_port = [item.text for item in reply.xpath('lldp-neighbors-information/lldp-neighbor-information/lldp-remote-port-id')]