Skip to content

Instantly share code, notes, and snippets.

@ksator
Last active January 12, 2018 02:08
Show Gist options
  • Save ksator/1e513cf0079efe243f7d177a4cd1aefc to your computer and use it in GitHub Desktop.
Save ksator/1e513cf0079efe243f7d177a4cd1aefc to your computer and use it in GitHub Desktop.
pass an rpc with an arg to Junos using pyez
from lxml import etree
from jnpr.junos import Device
dev=Device(host="172.30.54.108", user="lab", password='m0naco')
dev.open()
result=dev.rpc.get_interface_information(level_extra="descriptions")
type(result)
print (etree.tostring(result))
etree.dump(result)
dev.close()
@ksator
Copy link
Author

ksator commented Jan 12, 2018

How to get the equivalent rpc for show interface description | display xml

lab@dc-vmx-1> show interfaces descriptions | display xml rpc
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.4R1/junos">
    <rpc>
        <get-interface-information>
                <level-extra>descriptions</level-extra>
        </get-interface-information>
    </rpc>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment