set_routing_instance() Function (Python)
Syntax
jcs.set_routing_instance(routing-instance-name)
Description
Use to program the protocol software (TCP/UDP) to use non-default routing instances. You can use this function in op scripts and on-box Juniper Extension Toolkit (JET) applications.
In Junos OS Release 19.3R1, this feature is supported only on 32-bit architecture.
Starting in Junos OS Release 19.4R1, this feature is also supported on 64-bit architecture.
Parameters
routing-instance-name | String specifying the routing instance through which the connection is made. |
Usage Examples
The following Python script uses the jcs.set_routing_instance()
function to connect to a
device through a non-default routing instance. In the script, you
must set the non-default routing instance before you connect to the
device.
Python script:
user@r1> file show /var/db/scripts/op/python-routing-instance.py from junos import Junos_Context from jnpr.junos import Device from pprint import pprint import jcs user = Junos_Context['user-context']['user'] password = jcs.get_secret('Enter user password: ') routing_instance = jcs.get_input('Enter routing instance: ') # set routing instance option before connecting jcs.set_routing_instance(routing_instance) try: with Device(host='198.51.100.2', user=user, password=password) as dev: pprint (dev.facts) except Exception as err: print (err)
Release Information
Function introduced in Junos OS Release 19.3R1 on MX Series routers.