mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user