pynxos icon indicating copy to clipboard operation
pynxos copied to clipboard

Fixed some bugs and added some code, still needs work but was able to…

Open mattschwen opened this issue 7 years ago • 1 comments

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>

mattschwen avatar May 02 '18 23:05 mattschwen

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.

mattschwen avatar Jul 09 '18 22:07 mattschwen