10-14-2016 07:37 AM
I've gotten stuck with a new script I'm creating. As part of it, I would like to pull the list of nodes that are in the fabric and then use that list to do other tasks. I have not been able to find the correct method to get the list of nodes. Following the examples for listing tenants - tenants = ACI.Tenant.get(session) - as an example, I would think it would be something like: nodes = ACI.xxxxx.get(session) I've tried node, fabricNode, Fabric.node, etc. I can see the model using APIC Object Browser, but I'm not sure how to refer to it, and I keep getting an error that it is undefined. Any help is appreciated.
10-27-2016 09:57 AM
Hi Scott,
Important is to import the physical module.
I posted an example script on my blog: https://www.richardstrnad.ch/2016/10/27/acitoolkit-get-all-nodes/
If you have further questions, i'm happy to help.
Cheers
Richard
07-16-2020 09:59 AM
Hi richard and all,
i am also looking sample code like, i want to search the required leaf id then i want to get the ouput of interface status, interface vlan and more import interface description output
could you please help
07-16-2020 11:20 PM
I would suggest to open a new thread.
Cheers,
Sergiu
11-10-2016 10:23 AM
The following function will return a list of "leaf" objects in Python. You could then iterate over the returned list and print or check values. Notice how I am checking item.role to see if it's a leaf.
def get_leafs(session):
from acitoolkit.aciphysobject import Node
data = []
items = Node.get(session)
for item in items:
if item.role == 'leaf':
data.append(item.node)
return data
07-22-2017 05:56 AM
Just to add more information for tigephillips,
We can use node.info() to get the complete information about the switches.
######sample code
from acitoolkit.acisession import Session
from acitoolkit.aciphysobject import Node
session = Session(url, usr_name, password)
resp = session.login()
nodes = Node.get(session)
for node in nodes:
if node.role == 'leaf': #This will filter for leaf nodes.
print node.node #you can use 'node.info()', either to see the complete information about the leaf nodes like
inband_ip, outband_ip, firmware running etc..
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide