Adding RPC attribute parameters to junos_rpc network module (#32649)

* Adding RPC attribute arguments to `junos_rpc` network module.

* Specifying module argument version.

* Fixing DOCUMENTATION block.

* First attempt at new test fixture.

* Updated RPC_CLI_MAP.

* Use `result` instead of `reply`.
This commit is contained in:
Corban Johnson 2017-11-20 23:15:13 -06:00 committed by Ganesh Nalawade
commit d9a52db17d
3 changed files with 30 additions and 1 deletions

View file

@ -39,6 +39,11 @@ options:
accepts a set of key=value arguments.
required: false
default: null
attrs:
description:
- The C(attrs) arguments defines a list of attributes and their values
to set for the RPC call. This accepts a dictionary of key-values.
version_added: "2.5"
output:
description:
- The C(output) argument specifies the desired output of the
@ -66,6 +71,13 @@ EXAMPLES = """
- name: get system information
junos_rpc:
rpc: get-system-information
- name: load configuration
junos_rpc:
rpc: load-configuration
attrs:
action: override
url: /tmp/config.conf
"""
RETURN = """
@ -101,6 +113,7 @@ def main():
argument_spec = dict(
rpc=dict(required=True),
args=dict(type='dict'),
attrs=dict(type='dict'),
output=dict(default='xml', choices=['xml', 'json', 'text']),
)
@ -120,9 +133,13 @@ def main():
module.fail_json(msg='invalid rpc for running in check_mode')
args = module.params['args'] or {}
attrs = module.params['attrs'] or {}
xattrs = {'format': module.params['output']}
for key, value in iteritems(attrs):
xattrs.update({key: value})
element = Element(module.params['rpc'], xattrs)
for key, value in iteritems(args):