02-01-2019 06:47 AM - edited 03-01-2019 05:45 AM
Hi Team,
I am using the below API call for generating the API token.
curl -k -X POST -H "Content-Type:application/json" -d '{"aaaUser" : {"attributes" : {"name" : "apic:myorg_Domain\\mytestuser","pwd" : "pass123"}}}' https://127.0.0.1/api/aaaLogin.json
The above command providing me the URL token, so kindly let me know how can I use that token to authenticate Cisco ACI and fetch the EPG network adapter details.
Your response is much appreciated.
Thanks and Regards,
Azhar
Solved! Go to Solution.
02-02-2019 04:59 PM
Can you clarify what you are referring to by EPG adapter details? For the token we can enable the test API in root (will need TAC to get root access)
1) Create a file named credentials.xml (or whatever name you want) with the following content
<aaaUser name="username" pwd="password"/>
2) Post credentials file to create an authenticated cookie within the local working directory
curl --cookie-jar cookie.txt --cookie cookie.txt -skX POST https://127.0.0.1/api/aaaLogin.xml -d @./credentials.xml
Then run your POST and call that cookie (here is an example of me deleting a physical domain for an EPG)
curl --cookie cookie.txt -skX POST "https://127.0.0.1/api/mo/uni/tn-MG/ap-AP1/epg-el" -d '<fvRsDomAtt tDn="uni/phys-MG-phys"
02-04-2019 06:51 AM
Hello Zorrom, I don't believe you would need to use any advanced API methods as in the previous answer.
You can use a normal API call to find this information. Because the Port Group name in vCenter is written as 'Tenant-Name|AP-name|EPG-Name' you can do a search for the EPGs in ACI and derive the vCenter port group name from the DN field.
Using the cookie, make another request for class EPG to find all the EPGs in the system, then use regex to parse the EPG dn field.
You can use this API call to find all the EPGs:
/api/node/class/fvAEPg.xml?
Hopefully this helps get you closer to your goal! You can use the Object Store Browser (AKA 'visore': https://{{apic-ip}}/visore.html) to help find objects and classes, and it can provide you the API call it uses as seen in the attached screenshot.
02-02-2019 04:59 PM
Can you clarify what you are referring to by EPG adapter details? For the token we can enable the test API in root (will need TAC to get root access)
1) Create a file named credentials.xml (or whatever name you want) with the following content
<aaaUser name="username" pwd="password"/>
2) Post credentials file to create an authenticated cookie within the local working directory
curl --cookie-jar cookie.txt --cookie cookie.txt -skX POST https://127.0.0.1/api/aaaLogin.xml -d @./credentials.xml
Then run your POST and call that cookie (here is an example of me deleting a physical domain for an EPG)
curl --cookie cookie.txt -skX POST "https://127.0.0.1/api/mo/uni/tn-MG/ap-AP1/epg-el" -d '<fvRsDomAtt tDn="uni/phys-MG-phys"
02-04-2019 01:26 AM
Hi Michael,
We have couple of EPG adapters created based on application like the following
cisco_app1
cisco_app2
cisco_app3
And we have the same network adapter names created for these applications in our vcenter. And we will be getting the app1,app2 and app3 as variables from SNOW and using that we need to make API calls to Cisco so that we can fetch the full EPG adapter name and use it for our VM build automation
Thanks and Regards,
Azhar
02-07-2019 09:27 PM
So you are looking for a way to moquery the port-groups? The adaptors on the VMs will be attached to port-groups which map back to the EPG name.
EPG = PORT GROUP
02-08-2019 01:47 AM - edited 02-08-2019 01:48 AM
Not exactly. Now I am able to fetch my network adapter name from the EPG using the API's which you provided. What I am looking for is the Gateway details (subnet) from the Bridge domain to whom these EPG's belong. To explain in more detail, I have attached 3 pictures named with Pic 1,2 and 3 respectively
Pic 1 - Shows my EPG panel , which shows the bridge domain section of my EPG
Pic 2 - Shows my bridge domain details
Pic 3 - Shows the L3 configurations tab of the Bridge domain, which contains the gateway (subnet) range that I would need to fetch via API
Thanks and Regards,
Azhar
02-04-2019 01:28 AM
02-04-2019 06:51 AM
Hello Zorrom, I don't believe you would need to use any advanced API methods as in the previous answer.
You can use a normal API call to find this information. Because the Port Group name in vCenter is written as 'Tenant-Name|AP-name|EPG-Name' you can do a search for the EPGs in ACI and derive the vCenter port group name from the DN field.
Using the cookie, make another request for class EPG to find all the EPGs in the system, then use regex to parse the EPG dn field.
You can use this API call to find all the EPGs:
/api/node/class/fvAEPg.xml?
Hopefully this helps get you closer to your goal! You can use the Object Store Browser (AKA 'visore': https://{{apic-ip}}/visore.html) to help find objects and classes, and it can provide you the API call it uses as seen in the attached screenshot.
02-06-2019 10:12 PM
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