-
Notifications
You must be signed in to change notification settings - Fork 0
/
DevNet_ACI_toolkit_show_devices.py
52 lines (39 loc) · 1.09 KB
/
DevNet_ACI_toolkit_show_devices.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
# DevNet CCNA ACI toolkit show all hardware connected to the fabric
# Marc-Andre Theriault martheri@cisco.com
import acitoolkit.acitoolkit as aci
from acitoolkit.aciphysobject import Pod
LOGIN = "admin"
PASSWORD = "ciscopsdt"
URL = "https://sandboxapicdc.cisco.com"
def print_inventory(item):
"""
Display routine
:param item: Object to print
:return: None
"""
for child in item.get_children():
print_inventory(child)
print(item.info())
def main():
"""
Main execution routine
:return: None
"""
description = ('Simple application that logs on to the APIC and displays'
' the physical inventory.')
# Login to APIC
session = aci.Session(URL, LOGIN, PASSWORD)
session.login()
# Print the inventory of each Pod
pods = Pod.get(session)
for pod in pods:
pod.populate_children(deep=True)
pod_name = 'Pod: %s' % pod.name
print(pod_name)
print('=' * len(pod_name))
print_inventory(pod)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass