-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.py
More file actions
22 lines (17 loc) · 719 Bytes
/
Copy pathinterfaces.py
File metadata and controls
22 lines (17 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from netmiko import Netmiko
from pyats_parser import parser
con = Netmiko(host = '192.168.10.1',
username = 'username',
password = 'password',
port = 22,
device_type = 'cisco_xr',
timeout = 160,
verbose = False)
show_version = con.send_command('show interface description')
results = parser.parse(show_version,"show interface description","nxos")
#print(len(results["interfaces"]))
for key,value in results.items():
for key1,value1 in value.items():
for key2,value2 in value1.items():
if value2 == "up":
print(f"{key1} interfaces are in up state.")