Guest User

Untitled

a guest
Oct 24th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. interfaces = {
  2. 'switch1':['Gi0/0/0', 'Gi0/0/0.12', 'Gi0/0/0.14', 'Gi0/0/0.100', 'Gi0/0/0.101', 'Gi0/0/0.102', 'Gi0/0/0.105', 'Gi0/0/0.106', 'Gi0/0/1', 'Gi0/0/3', 'Gi0/0/5'],
  3. 'switch2':['Gi0/0/0', 'Gi0/0/0.34', 'Gi0/0/0.100', 'Gi0/0/0.101', 'Gi0/0/0.102', 'Gi0/0/0.103', 'Gi0/0/0.105', 'Gi0/0/1'],
  4. 'switch3':['Te0/1/0', 'Te0/1/0.3246', 'Te0/1/2', 'Te0/1/3', 'Te0/1/4'],
  5. 'switch4':['Te0/1/0.3246', 'Te0/1/3', 'Te0/1/4', 'Te0/1/0'],
  6. 'nexus1':['Eth1/1', 'Eth1/2', 'Eth1/4', 'Eth1/5', 'Eth1/6', 'Eth1/49', 'Eth1/50'],
  7. 'nexus2':['Eth1/1', 'Eth1/2', 'Eth1/4', 'Eth1/5', 'Eth1/6', 'Eth1/49', 'Eth1/50'],
  8. 'switch5':['Gi0/0/0', 'Gi0/0/1', 'Gi0/0/1.99', 'Gi0/0/1.200', 'Gi0/0/1.210', 'Gi0/0/2', 'Gi0'],
  9. 'switch6':['Gi0/0/0', 'Gi0/0/1', 'Gi0/0/1.103 ', 'Gi0/0/1.200', 'Gi0/0/1.210', 'Gi0/0/2 ', 'Gi0'],
  10. 'switch7':['Gi0/0/0', 'Gi0/0/0.100 ', 'Gi0/0/1 ', 'Gi0/0/3 ', 'Te0/1/0 ', 'Te0/1/0.100', 'Te0/1/1 ', 'Te0/1/1.100', 'Te0/1/1.101', 'Te0/1/1.110'],
  11. 'switch8':['Gi0/0/0', 'Gi0/0/0.100', 'Gi0/0/1', 'Gi0/0/2 ', 'Gi0/0/3', 'Te0/1/0 ', 'Te0/1/0.100', 'Te0/1/1', 'Te0/1/1.100 ', 'Te0/1/1.101', 'Te0/1/1.110'],
  12. 'nexus3':['Eth1/1', 'Eth1/2', 'Eth1/3', 'Eth1/4', 'Eth1/5', 'Eth1/6', 'Eth1/7', 'Eth1/27', 'Eth1/29', 'Eth1/41'],
  13. 'nexus4':['Eth1/1', 'Eth1/2', 'Eth1/3', 'Eth1/4', 'Eth1/5', 'Eth1/6', 'Eth1/7', 'Eth1/8', 'Eth1/25', 'Eth1/26', 'Eth1/27', 'Eth1/28', 'Eth1/29']
  14. }
  15.  
  16.  
  17.  
  18. for key, value in interfaces.items():
  19.  
  20. if key == ('switch1' or 'switch2' or 'switch3' or 'switch4'or 'switch5' or 'switch6'):
  21. username = 'username'
  22. password = 'password'
  23. platform = 'cisco_xe'
  24.  
  25. elif key == ('switch7' or 'switch8'):
  26. username = 'username1'
  27. password = 'password1'
  28. platform = 'cisco_xe'
  29.  
  30. elif key == ('nexus1' or 'nexus2'):
  31. username = 'username2'
  32. password = 'password'
  33. platform = 'cisco_nxos'
  34.  
  35. else:
  36. username = 'username3'
  37. password = 'password4'
  38. platform = 'cisco_nxos'
  39.  
  40. print(key,username,password,platform)
  41.  
  42. switch1 username password cisco_xe
  43. switch2 username3 password4 cisco_nxos
  44. switch3 username3 password4 cisco_nxos
  45. switch4 username3 password4 cisco_nxos
  46. nexus1 username2 password cisco_nxos
  47. nexus2 username3 password4 cisco_nxos
  48. switch5 username3 password4 cisco_nxos
  49. switch6 username3 password4 cisco_nxos
  50. switch7 username1 password1 cisco_xe
  51. switch8 username3 password4 cisco_nxos
  52. nexus3 username3 password4 cisco_nxos
  53.  
  54. switch1 username password cisco_xe
  55. switch2 username password cisco_xe
  56. switch3 username password cisco_xe
  57. switch4 username password cisco_xe
  58. nexus1 username2 password cisco_nxos
  59. nexus2 username3 password4 cisco_nxos
  60. switch5 username password cisco_xe
  61. switch6 username password cisco_xe
  62. switch7 username1 password1 cisco_xe
  63. switch8 username1 password1 cisco_xe
  64. nexus3 username3 password4 cisco_nxos
  65. nexus4 username3 password4 cisco_nxos
  66.  
  67. for key, value in interfaces.items():
  68.  
  69. if key in {'switch1', 'switch2', 'switch3', 'switch4', 'switch5', 'switch6'}:
  70. username = 'username'
  71. password = 'password'
  72. platform = 'cisco_xe'
  73.  
  74. elif key in {'switch7', 'switch8'}:
  75. username = 'username1'
  76. password = 'password1'
  77. platform = 'cisco_xe'
  78.  
  79. elif key in {'nexus1', 'nexus2'}:
  80. username = 'username2'
  81. password = 'password'
  82. platform = 'cisco_nxos'
  83.  
  84. else:
  85. username = 'username3'
  86. password = 'password4'
  87. platform = 'cisco_nxos'
  88.  
  89. print(key,username,password,platform)
Add Comment
Please, Sign In to add comment