Hello,
I am in the process of writing a Python script that uses PyEz to run some troubleshooting commands for our support team. The goal is to allow a teir 1 support person to do the basic troubleshooting with the need to have direct access to a switch or router.
In this current example, I am trying to return the configuration of an interface. I having issues getting the text version to print in a pretty format (all the proper return and space/tab characters. More information below.
XML format data of interface:
config = dev.rpc.get_config(filter_xml=etree.XML('<configuration><interfaces><interface><name>%s</name></interface></interfaces></configuration>' % args.interface), options={'format':'xml', 'database':'committed', 'inherit':'inherit'})
print(etree.tostring(config, pretty_print=True))
See the attachment pyez_XML_output.jpg for the sample output.
Text format data of interface:
config = dev.rpc.get_config(filter_xml=etree.XML('<configuration><interfaces><interface><name>%s</name></interface></interfaces></configuration>' % args.interface), options={'format':'text', 'database':'committed', 'inherit':'inherit'})
print(etree.tostring(config, pretty_print=True))
See the attachment pyez_TEXT_output.jpg for the sample output
The text version seems to print everything in a single line, instead of the output I see when running via cli.
I am looking to see if there is an easy way to print the text version with proper return, and tab characters. Example of what I wanted to see in attachment pyez_TEXT_desired_output.jpg
I have tired to see if there are any examples out there for this model, but I have not be able to locate anything yet.
Thanks for the help
#pyez#get_config