4 steps |
|
set interface xxx disable from jnpr.junos import Device from jnpr.junos.utils.config import Config dev = Device(host='dc1a1.example.com').open() with Config(dev, mode='private') as cu: cu.load('set interface ge-0/0/7 disable', format='set') cu.pdiff() cu.commit() dev.close() | |
rpc command labuser@saltsackmaster:~/project/python_script$ more disable_int.py from jnpr.junos import Device from jnpr.junos.utils.config import Config from pprint import pprint junos_hosts = [ '172.30.95.177' ] for ip in junos_hosts: ## open session with juniper device dev = Device(host=ip, user='Netbox', password='Netbox') dev.open() ## Add or bound the configuration instance variable to the dev instance dev.bind(cu=Config) ## change config cmd_chg_hostname='set interfaces xe-0/0/10 disable' #cmd_chg_hostname='delete interfaces xe-0/0/10 disable' result = dev.cu.load(cmd_chg_hostname,format='set') pprint (result) dev.cu.pdiff() ## commit changes dev.cu.commit() ## close the session dev.close() | |
General
Content
Integrations