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

Stacy W. Smith stacy at acm.org
Mon Sep 3 20:39:52 EDT 2018


Remove the quotes around r2check.

i.e. the line should be:
r2response = dev.rpc.get_route_information(table='inet.0', destination=r2check)

--Stacy

> On Sep 3, 2018, at 6:33 PM, 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)
> 
> 
> 
> Thanks in advance,
> Jason
> 
> 
> 
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp



More information about the juniper-nsp mailing list