-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab_ac.py
More file actions
62 lines (45 loc) · 1.52 KB
/
tab_ac.py
File metadata and controls
62 lines (45 loc) · 1.52 KB
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
# list of packages that should be imported for this code to work
import cobra.mit.access
import cobra.mit.request
import cobra.mit.session
import cobra.model.draw
import cobra.model.fv
import cobra.model.pol
import cobra.model.vz
from cobra.internal.codec.xmlcodec import toXMLStr
from tabulate import tabulate
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
def table(i):
# It's an Atomic Counter viewer app
# log into an APIC and create a directory object
ls = cobra.mit.session.LoginSession('https://10.75.53.131', 'admin', 'Nbv!2345')
md = cobra.mit.access.MoDirectory(ls)
md.login()
clAcPath = cobra.mit.access.ClassQuery('dbgAcPath')
dbgAcPathA_objlist = md.query(clAcPath)
dbgAclist = []
for mo in dbgAcPathA_objlist:
# if int(mo.dropPkt) !=0:
row = {
"Path":mo.dn,
"DropPackets":mo.dropPkt,
"DropPacketsPercentage":mo.dropPktPercentage,
# "ExcessPakets":mo.excessPkt,
# "ExcessPaketsPercentage":mo.excessPktPercentage,
# "TransceivePakets":mo.txPkt,
# "ReceivePakets":mo.rxPkt,
# "TotalDropPackets":mo.totDropPkt,
# "TotalDropPacketsPercentage":mo.totDropPktPercentage,
}
dbgAclist.append(row)
print tabulate(sorted(dbgAclist,),tablefmt='grid',headers="keys")
return
def main():
# for i in range (1,2):
# if i <= 2:
# time.sleep(5)
# y = i + 1
table(1)
if __name__ == '__main__':
main()