Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ def get_config(
resp = self.dev.rpc.get_config(
filter_xml, options, model, namespace, remove_ns, **kwarg
)
return etree.tostring(resp)
if options['format'] == 'json':
return rsp
else:
return etree.tostring(resp)

def get_rpc_resp(self, rpc, ignore_warning, format):
"""Execute rpc on the device and get response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,10 @@ def get_config(
response = self._pyez_conn.get_config(
filter_xml, options, model, namespace, remove_ns, **kwarg
)
return self.etree.fromstring(response)
if options['format'] == 'json':
return response
else:
return self.etree.fromstring(response)

def get_rpc(self, rpc, ignore_warning=None, format=None):
rpc_1 = self.etree.tostring(rpc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def main():
parsed_output = None
if resp is True:
text_output = ""
elif isinstance(resp, junos_module.etree._Element):
elif (isinstance(resp, junos_module.etree._Element)) or (isinstance(resp, dict)):
# Handle the output based on format
if format == "text":
if resp.tag in ["output", "rpc-reply"]:
Expand Down