In JUNOS, it’s very easy to find any RPC equivalent of the existing command by running “show route | display xml rpc”. This helps to find what is equivalent RPC command of show route as per below output.
get-route-information
It’s very difficult to find every time on cli what is equivalent of RPC of any Junos command. So we can leverage PyEZ to find the same and in the upcoming posts, you can check how it can be leverage to pass the different values directly in the RPC calls. In PyEZ we can call display_xml_rpc library to get the information of any RPC equivalent Junos Command.
from jnpr.junos import Device
from jnpr.junos.exception import ConnectError
dev = Device(host=’192.168.1.1′, user=’lab’, passwd=’lab’)
try:
dev.open()
except ConnectError as err:
print “Cannot connect to device: {0}”.format(err)
sys.exit(1)