Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. from netmiko import ConnectHandler
  2. import json
  3. import getpass2
  4.  
  5. #device_list = {1 : "cisco_ios" , 2 : "cisco_xe", 3: "cisco_asa", 4: "cisco_nxos",5: "cisco_xr", 6: "cisco_wlc_ssh", 7:"arista_eos", 8:"hp_procurve", 9: "hp_comware", 10: "huawei", 11: "f5_ltm", 12: "juniper", 13: "brocade_vdx"}
  6.  
  7. class Credentials:
  8. def __init__(self):
  9. self.ip = raw_input("Enter IP:")
  10. self.username = raw_input("Enter Username:")
  11. self.password = raw_input("Enter Password:")
  12. self.secret = raw_input("Enter Enable Secret:")
  13. self.port = raw_input("Enter Port Number:")
  14.  
  15. connection = Credentials()
  16. connection_IP = connection.ip
  17. connection_USER = connection.username
  18. connection_PSW = connection.password
  19.  
  20. print("1.cisco_ios, 2.cisco_xe, 3.cisco_asa, 4.cisco_nxos, 5.cisco_xr, 6.cisco_wlc_ssh, \n"
  21. "7.arista_eos, 8.hp_procurve, 9.hp_comware, 10.huawei, 11.f5_ltm, 12.juniper, 13.brocade_vdx.")
  22.  
  23. device_type = raw_input("What type of device: ")
  24.  
  25. device_profile = {
  26. 'device_type': device_type,
  27. 'ip': connection_IP,
  28. 'username': connection_USER,
  29. 'password': connection_PSW,
  30. }
  31.  
  32. net_connect = ConnectHandler(**device_profile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement