Advertisement
Guest User

Switch Config

a guest
May 11th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from pprint import pprint
  2. from jnpr.junos import Device
  3. from jnpr.junos.utils.config import Config
  4. dev = Device(host='192.168.140.240',user='root',password='admin12345')
  5. dev.open()
  6.  
  7. config_script = """
  8. edit ethernet-switching-options secure-access-port
  9. set interface ge-0/0/46 allowed-mac 8C:AE:4C:F4:6B:50
  10. """
  11.  
  12. cu = Config(dev)
  13. cu.load(config_script, format="set", merge=True)
  14. cu.commit()
  15. print cu.diff()
  16. dev.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement