DEVNET.

My Third Step towards Automation: How to map Junos Commands to PyEZ RPC

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)

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

Become a member

Full Access to 739 Lessons. New Lessons Added Every Week!

Awesome Deal! Get 2 Months for FREE!

No Obligations. Cancel At Any Time!