Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from jnpr.junos.utils.config import Config
- from jnpr.junos import Device
- from lxml import etree as ET
- # pull info about the device itself
- def Factoids():
- target = Device(host='192.168.150.220', user='labmin', password='Labmin')
- target.open()
- tfacts = target.facts
- # just some random info as a demo
- print("*********************************************",'\n',
- "Target hostname is: ", tfacts['hostname'], ".", tfacts['domain'], sep='')
- #Factoids()
- # lock 'n load
- # target = Config(host='192.168.150.220', user='labmin', password='Labmin')
- # target.lock()
- target = Device(host='192.168.150.220', user='labmin', password='Labmin', gather_facts=False)
- target.open()
- # info = target.rpc.get_config(filter_xml="interfaces/interface/[description='Test Trunk']", model='ietf')
- info = target.rpc.get_config(filter_xml="<configuration><interfaces><interface><name>ge-0/0/0</name></interface></interfaces></configuration>")
- print(info.__class__)
- print(info.findtext('vlan-id'))
- print(info.findtext('unit'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement