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

Jason Taranto Jason.Taranto at vocus.com.au
Mon Sep 3 20:33:20 EDT 2018


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





More information about the juniper-nsp mailing list