-
Notifications
You must be signed in to change notification settings - Fork 19
/
canitreach.py
72 lines (58 loc) · 1.44 KB
/
canitreach.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
from netmiko import Netmiko
username = "networkchuck"
password = "Password123!"
access1 = {
"host": "192.168.243.238",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
flswitch = {
"host": "10.16.20.10",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
core2 = {
"host": "10.16.0.2",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
r1az = {
"host": "10.16.6.5",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
r2nv = {
"host": "10.16.7.6",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
r3fl = {
"host": "10.16.7.7",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
core1 = {
"host": "10.16.0.1",
"username": username,
"password": password,
"device_type": "cisco_ios",
}
devices = [flswitch, access1, core1, core2, r3fl, r2nv, r1az]
client = input("What is the IP address that your client can't reach? ")
for x in devices:
net_connect = Netmiko(**x)
showver = net_connect.send_command("show version", use_textfsm=True)
hostname = showver[0]['hostname']
ping = net_connect.send_command("ping " + client)
if "....." in ping:
print(hostname + " can't connect.")
else:
print(hostname + " -------> is good")
net_connect.disconnect()