cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1504
Views
0
Helpful
9
Replies

Is there an ACI API call to get the serial number of the target APIC?

bmckibben
Level 1
Level 1

ACII have a JSON list of APIC FQDNs:

[

   "apic1.fabric1.somewhere.net",

   "apic2.fabric1.somewhere.net",

   "apic3.fabric1.somewhere.net",

   "apic1.fabric2.somewhere.net",

   ...

]

 

I can step through that list and login to each APIC and get the list of APICs in that fabric's controller cluster.  By comparing cluster members, I can then figure out which APICs belong to which fabric.

 

What I can't seem to find is an API call to tell me what the serial number is of the APIC I am currently connected to.

 

I am using Javascript, so I cannot lookup hostnames or IP addresses.  The hostname doesn't necessarily match the name given to the APIC in MIT, so I can't assume that, either.

 

Anyone got any ideas?

9 Replies 9

Francesco Molino
VIP Alumni
VIP Alumni

Hi

 

If you know on which node id you are, you can execute a GET on the url https://x.x.x.x/api/node/mo/topology/pod-1/node-1.json

 

This will give you the serial number:

                    "fabricNode": {
                        "attributes": {
                            "adSt": "on",
                            "address": "x.x.x.x",
                            "annotation": "",
                            "apicType": "apic",
                            "childAction": "",
                            "delayedHeartbeat": "no",
                            "dn": "topology/pod-1/node-1",
                            "extMngdBy": "",
                            "fabricSt": "unknown",
                            "id": "1",
                            "lastStateModTs": "1969-12-31T19:00:00.000-05:00",
                            "lcOwn": "local",
                            "modTs": "2022-01-11T17:17:06.723-05:00",
                            "model": "APIC-SERVER-L3",
                            "monPolDn": "uni/fabric/monfab-default",
                            "name": "TEST",
                            "nameAlias": "",
                            "nodeType": "unspecified",
                            "role": "controller",
                            "serial": "XXXXXXXXXXXX",
                            "status": "",
                            "uid": "0",
                            "userdom": "all",
                            "vendor": "Cisco Systems, Inc",
                            "version": "5.2(3g)"

Hope this answers your question

 

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Ah, so there's the rub!  I have no way of knowing which APIC in the cluster (and therefore the node ID) I am connected to.  That's why I am looking for some API call to essentially ask, "Hey you that is servicing this API call:  what's your node ID/Serial number/IP?"

Never tested this because you usually send API requests to the primary node so not sure if there's whoami api call.

When you said to know which one you're on, you're accessing it through an API call so you have the hostname or IP in the url right?

 

Or are you connecting through other method?


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

API requests can be sent to any node in the cluster.  As I said in the first post, I only have a list of APIC fully qualified domain names to iterate through.  There is no guarantee that those FQDNs match the APIC nodes' node names.  And since I am using Javascript, there is no way for me to programmatically do a DNS lookup to find the IP addresses associated with the FQDNs.

Hi @bmckibben 

I am just curious, why do you need the SN of the specific APIC you send API calls to? In the end, regardless of which one you are connected to the APIs will return the same info.

And since you only want to get the SNs of the APICs part of the same cluster, you can do that from any APIC from the cluster.

 

I hope I expressed my thoughts in an understandable way. ^_^

 

Stay safe,

Sergiu

I can build a picture of each "cluster as seen by node" as I iterate through the list of APIC FQDNs.  However, it would be easier/faster to follow this logic:

 

// apicList = [ that list of APICs in the first post ]

// clusterList = []

// for each APIC in apicList

   // Login to APIC

   // If clusterList.length > 0

      // Get this APIC's S/N

      // if clusterList doesn't yet contain that S/N

         // Get the cluster-as-seen-by-node of the current APIC

         // Add that cluster to the clusterList

   // else

      // Get the cluster-as-seen-by-node of the current APIC

      // Add that cluster to the clusterList

 

That's why I want to know how to identify which node I am connected to when I send an API call.  I guess I assumed something like this would be easy....

In your pseudocode I see one flaw - the following section will never be executed simply because you will always get the clusterList with all APICs at the first iteration (the else statement):

      // if clusterList doesn't yet contain that S/N

         // Get the cluster-as-seen-by-node of the current APIC

         // Add that cluster to the clusterList

 

Cheers,

Sergiu

The "fabric1" versus "fabric2" implies that the "cluster-as-seen-by-node" values will be different for the two fabrics.  So the logic will work.

I am a bit confused. You want to have a list with all SNs or a list of SNs per cluster?

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:


This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community