mirror of
https://github.com/theNetworkChuck/CCNA_200-301.git
synced 2025-12-06 04:12:00 +01:00
Create tshoottest.py
This commit is contained in:
parent
3427c283da
commit
8e6a320db2
38
tshoottest.py
Normal file
38
tshoottest.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from netmiko import Netmiko
|
||||
|
||||
username = "networkchuck"
|
||||
password = "Password123!"
|
||||
|
||||
|
||||
|
||||
access1 = {
|
||||
"host": "10.16.0.11",
|
||||
"username": username,
|
||||
"password": password,
|
||||
"device_type": "cisco_ios",
|
||||
}
|
||||
|
||||
flswitch = {
|
||||
"host": "10.16.20.10",
|
||||
"username": username,
|
||||
"password": password,
|
||||
"device_type": "cisco_ios",
|
||||
}
|
||||
|
||||
myswitches = [flswitch, access1]
|
||||
|
||||
for x in myswitches:
|
||||
net_connect = Netmiko(**x)
|
||||
ping = net_connect.send_command("show mac address-table address 0050.7966.6802", use_textfsm=True)
|
||||
showver = net_connect.send_command("show version", use_textfsm=True)
|
||||
hostname = showver[0]['hostname']
|
||||
try:
|
||||
thehost = ping[0]['destination_address']
|
||||
except TypeError:
|
||||
thehost = "nope"
|
||||
if thehost != "nope":
|
||||
print("The host is connected to " + hostname)
|
||||
|
||||
print("done")
|
||||
Loading…
Reference in a new issue