Fixed some bugs and added some code, still needs work but was able to…
Got this working with time I had today. Need to implement additional error checking and XML handling, if all we are returning is an XML object this shouldn't take too much work. If we want to return more, we need to talk about what and how.
Test
#! /usr/bin/python
from pynxos.device import Device as NXOSDevice
def main():
device = NXOSDevice('hostname', 'admin', 'admin')
hostname = device.show('show hostname')
print hostname
if __name__ == '__main__':
main()
Response
~/Desktop
❯ python test_xml.py
<?xml version="1.0"?>
<ins_api>
<type>cli_show</type>
<version>1.0</version>
<sid>eoc</sid>
<outputs>
<output>
<body>
<hostname>sje-labnexus01.corp.adobe.com</hostname>
</body>
<input>show hostname</input>
<msg>Success</msg>
<code>200</code>
</output>
</outputs>
</ins_api>
I have updated your suggestions and made some other modifications to this recent commit... https://github.com/networktocode/pynxos/pull/9/commits/6b23bea5a0148d8add8b2e3645551309a1607d79
Please review, I believe this is very close, if not ready to merge. Once this is done we can begin writing all the XML Getters for NXOS and NXOS-SSH, we can use pynxos for rest-api to get XML text for show commands but use the same parser for both NXOS and NXOS-SSH.