Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. import netmiko
  2. import json
  3.  
  4.  
  5. user_name = raw_input("username:")
  6. user_pass = raw_input("password:")
  7. ip_input = raw_input("please enter the IP of the device:")
  8.  
  9. #netmiko.ConnectHandler(ip='ip_input',device_type='cisco_ios',username=user_name,password =user_pass)
  10. #netmiko.ssh_dispatcher
  11. #netmiko.BaseConnection.remote_conn
  12.  
  13. #establish functions used to send commands for output verification.
  14. def tracemac():
  15. if raw_input() == "tracemac":
  16. netmiko.BaseConnection.send_command('show cdp neighbor',
  17. 'show mac address-table',)
  18.  
  19. def netinfo():
  20. if raw_input() == "netinfo":
  21. netmiko.BaseConnection.send_command('show ip interface brief',
  22. 'show run',
  23. 'show vlan')
  24. def pingtest():
  25. if raw_input() == "pingtest":
  26. netmiko.BaseConnection.send_command('ping' (raw_input('ip: ')))
  27.  
  28. def neighboradj():
  29. if raw_input() == "neighadj(eigrp)":
  30. netmiko.BaseConnection.send_command('show ip eigrp neighbor\n,',
  31. 'show ip eigrp summary\n',
  32. 'show ip eigrp status')
  33. print('sending commands...')
  34. elif raw_input(ospf) == "neighadj(ospf)":
  35. netmiko.BaseConnection.send_command('\n','\n','\n')
  36.  
  37. elif raw_input(bgp) == "neighadj(bgp)":
  38. netmiko.BaseConnection.send_command('\n','\n','\n')
  39.  
  40. #ask user option they would like to use after posting the legend.
  41. print("LEGEND:\n",
  42. "tracemac = shows neighbors and cam table \n",
  43. "netinfo = shows standard information about network config \n",
  44. "pingtest = self-explanatory\n",
  45. "neighadj(eigrp) = show discovered peering devices \n",
  46. "neighadj(ospf) = show discovered peering devices \n",
  47. "neighadj(bgp) = show discovered peering devices \n")
  48.  
  49. raw_input('which option?: ')
  50.  
  51.  
  52. tracemac()
  53. netinfo()
  54. pingtest()
  55. neighboradj()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement