Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. from netmiko import ConnectHandler
  2. from getpass import getpass
  3.  
  4. class Device:
  5. def __init__(self, credentials):
  6. self.device = {
  7. 'device_type': 'cisco_asa',
  8. 'ip': credentials["ip"],
  9. 'username': credentials["username"],
  10. 'password': credentials["password"],
  11. 'secret': credentials["secret"],
  12. }
  13. self.config = credentials["config"]
  14. def update(self):
  15. net_connect = Netmiko(**self.device)
  16. output = net_connect.send_config_from_file(self.config)
  17. return(output)
  18.  
  19. routers = [
  20. {"ip":"10.1.1.1","username":"bihdick","password":"massivepenis","config":"configfile.txt"},
  21. {"ip":"10.1.1.2","username":"bihdick","password":"massivepenis","config":"configfile2.txt"},
  22. ]
  23.  
  24. for router in routers:
  25. rt = Device(router)
  26. update = rt.update()
  27. print(update)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement