# now dump the XML response output; print "showing as XML RPC response:" etree.dump( cmd_rsp ) # showing as XML RPC response: # <software-information> # <host-name>jnpr-dc-fw</host-name> # <product-model>junosv-firefly</product-model> # <product-name>junosv-firefly</product-name> # <package-information> # <name>junos</name> # <comment>JUNOS Software Release [12.1X44-D10.4]</comment> # </package-information> # </software-information> # of course, you could have gotten the exact same thing: print "And again another way ..." xml_rsp = jdev.cli( "show version", format='xml' ) etree.dump(xml_rsp) # but the 'rigth' way to invoke XML commands is to use # the :rpc: as the metaexec as intented, such as: xml_rsp = jdev.rpc.get_software_information(); print "And again using meta rpc" etree.dump(xml_rsp) jdev.close()
from jnpr.eznc import Netconf jdev = Netconf(user='******', host='vsrx_cyan', password='******') jdev.open() inv = jdev.rpc.get_chassis_inventory() print "model: %s" % inv.find('chassis/description').text print "serial-number: %s" % inv.find('chassis/serial-number').text # model: JUNOSV-FIREFLY # serial-number: cf2eaceba2b7 jdev.close()