[j-nsp] PyEZ - variable into rpc.get request

James Bensley jwbensley at gmail.com
Tue Sep 4 04:50:33 EDT 2018


On Tue, 4 Sep 2018 at 01:33, Jason Taranto <Jason.Taranto at vocus.com.au> wrote:
>
> Hi All,
>
> After a while of my head colliding with the wall beside me, would anyone know how to get a variable into an rpc command via pyez.
>
> My latest attempt is below.
>
>   r2check = raw_input("Route to check e.g XXX.XXX.XXX.XXX : ")
>   print ("Checking if route is in the table......")
>   time.sleep(2)
>   r2response = dev.rpc.get_route_information(table='inet.0', destination='r2check')
>   time.sleep(2)
>   print("################################################################################")
>   print("                                                                                ")
>   print("                      Response from router below...                             ")
>   print (etree.tostring(r2response))
>
>
> The error message I get is:
> jnpr.junos.exception.RpcError: RpcError(severity: error, bad_element: r2check, message: could not resolve name: r2check)

Hi Jason,

Someone with more knowledge than I has already provided some info to
you, I just wanted to point out you could also join this Slack
channel: https://networktocode.slack.com

There are rooms for Python, Juniper, Cisco, Ansible, Salt and many
others all relating to network coding and automation. It's a good
place to get help with your network coding issues if you didn't know
about it already.

Cheers,
James.


More information about the juniper-nsp mailing list