Skip to content

Instantly share code, notes, and snippets.

@jeffbrl
Created October 14, 2015 18:39
Show Gist options
  • Select an option

  • Save jeffbrl/50b67dbe87bd08aea032 to your computer and use it in GitHub Desktop.

Select an option

Save jeffbrl/50b67dbe87bd08aea032 to your computer and use it in GitHub Desktop.
Pyez - Get router configuration and save to file
# code courtesy of shermdog on pyez google group
from jnpr.junos import Device
dev = Device(host='IP', user='user', passwd='password')
dev.open()
config = dev.rpc.get_config()
from lxml import etree
f = open('config.xml', 'w')
f.write(etree.tostring(config))
f.close()
dev.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment