Created
October 10, 2015 20:11
-
-
Save jeffbrl/136fde2840e7915bb3f2 to your computer and use it in GitHub Desktop.
Using xpath to parse junos router configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jnpr.junos import Device | |
from lxml import etree | |
dev = Device(host='2001:DB8::1', user='jeffl', passwd='pass123') | |
dev.open() | |
config = dev.rpc.get_config() | |
interface_ip = config.xpath("//interface[name='ge-0/0/1']/unit/family/inet/address/name")[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment