Fix netconf module and plugin issues (#45140)

* Fix netconf netconf issues

*  Identifier is optional for get_schema api
*  Fix dispatch api mandatory argument check
*  Add save option handling to copy config from target datastore
   to startup datastore if supported
*  Validate config in check-mode or if validate option set to true

* Copy config if check-mode is not enabled
This commit is contained in:
Ganesh Nalawade 2018-09-04 13:23:18 +05:30 committed by GitHub
parent 177fbea351
commit 455dfbe732
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View file

@ -204,7 +204,7 @@ class NetconfBase(AnsiblePlugin):
:param filter: specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)
:return: Returns xml string containing the RPC response received from remote host
"""
if rpc_command:
if rpc_command is None:
raise ValueError('rpc_command value must be provided')
req = fromstring(rpc_command)
resp = self.m.dispatch(req, source=source, filter=filter)
@ -270,8 +270,6 @@ class NetconfBase(AnsiblePlugin):
:param format: format of the schema to be retrieved, yang is the default
:return: Returns xml string containing the RPC response received from remote host
"""
if identifier:
raise ValueError('identifier value must be provided')
resp = self.m.get_schema(identifier, version=version, format=format)
return resp.data_xml if hasattr(resp, 'data_xml') else resp.xml