New ansible module netconf_rpc (#40358)

* New ansible module netconf_rpc

* add integration test for module netconf_rpc

* pep8/meta-data corrections

* usage of jxmlease for all XML processing
separation of attributes "rpc" and "content"

* removed unused imports
improved error handling

* fixed pep8

* usage of ast.literal_eval instead of eval
added description to SROS integration test for cases commented out
This commit is contained in:
wiso 2018-05-24 11:55:02 +02:00 committed by Ganesh Nalawade
commit 387a23c3d1
13 changed files with 561 additions and 19 deletions

View file

@ -48,13 +48,13 @@ def get_capabilities(module):
return module._netconf_capabilities
def lock_configuration(x, target=None):
conn = get_connection(x)
def lock_configuration(module, target=None):
conn = get_connection(module)
return conn.lock(target=target)
def unlock_configuration(x, target=None):
conn = get_connection(x)
def unlock_configuration(module, target=None):
conn = get_connection(module)
return conn.unlock(target=target)
@ -104,3 +104,13 @@ def get(module, filter, lock=False):
conn.unlock(target='running')
return response
def dispatch(module, request):
conn = get_connection(module)
try:
response = conn.dispatch(request)
except ConnectionError as e:
module.fail_json(msg=to_text(e, errors='surrogate_then_replace').strip())
return response