cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1546
Views
0
Helpful
2
Replies

how to use the ACI Toolkit session module effectively ?

peterzhang
Level 1
Level 1

I just want to know how to use the ACI session module. I am testing subscripting and would really like some very simple examples: such as

here is how to create the session

     session = acisession(a,b,c)

here is how to start subscribing

     subscribe = session.subscribe()

here is how to specify the class that you want to subscribe

     subscribe = session.subscribe('aaaModLR')

2 Replies 2

peterzhang
Level 1
Level 1

made some progress, but I can't seem to get the count to increase, no matter what I do to the static binding. Any idea what's wrong with the code ?

session = acisession.Session(url, uid, pwd)

session.login()

count = session.get_event_count(url)

result = session.subscribe(url=url, only_new=True).json()

if count > 0:

   print(result['imdata'][0]['fvRsPathAtt']['attributes']['dn'])

Alex Stevenson
Cisco Employee
Cisco Employee

I would try inserting print statement to see value of count and also print the type, as it may be string, that you would need to convert to integer.

 

print(f'(the count is {count} and it is of type {type(count)}')

 

You may also need to drill down into the 'session' object and see what else you can work with

 

print(dir(session))

 

*I'm assuming you're using Python3