01-27-2018 04:14 AM - edited 03-01-2019 06:07 AM
In previous article ACI Automation part 2, we discussed how to create single EPG in ACI using Postman.
Now, in this article we’ll discuss on creating multiple EPG in ACI using Postman. It’s advisable to go through the ACI Automation part 2 on creating single EPG before attempting for multiple EPG.
The reason is that in this article, I’ll refer to the fundamental that already discussed in the previous part.
In order to create multiple EPG, we’re going to use spreadsheet. The spreadsheet is a simple CSV file that can be created from Microsoft Excel.
Remember, we discussed the Postman variable in the previous article, if you not too familiar with the Postman variable, it’s suggest to go through the ACI Automation part 1.
Now these variables are filled inside the table. We can create the following table example to populate our EPG.
Once you create this table in your Excel spreadsheet, you can save this as .CSV.
Please note: To select the .csv format, as it’s the accepted format in Postman.
Please refer to the ACI Automation Part 2 on collecting the EPG Object Information.
Once you have this collected, you can change the EPG name with the corresponding variables that you defined in spreadsheet.
In this example, I'm going to create multiple EPG that we defined from the previous spreadsheet to the tenant 'rsantoso' within the 'rsantoso-ap' application profile.
The POSTMAN request would be the following:
POST https://{{apic}}/api/node/mo/uni/tn-rsantoso/ap-rsantoso-ap/epg-{{epgname}}.json
Payload:
{
"fvAEPg": {
"attributes": {
"dn": "uni/tn-rsantoso/ap-rsantoso-ap/epg-{{epgname}}",
"name": "{{epgname}}",
"rn": "epg-{{epgname}}",
"status": "created"
},
"children": [{
"fvRsBd": {
"attributes": {
"tnFvBDName": "BD-sample",
"status": "created,modified"
},
"children": []
}
}]
}
}
Note: Please add the login to the APIC using POSTMAN to the collection folder. If you haven't already add this. Otherwise you'll find the response with no authentication. Please refer to ACI Automation Part 1 on creating the login to APIC.
And click RUN
The Postman will pop up browser with the Collection Runner.
Upload the Spreadsheet in .csv format that we defined previously.
Once Uploaded, verify the Spreadsheet is in the correct format.
In the Collection Runner, you'll find the Iteration is based on the number of rows that you enter.
The first row will be the name of the variable.
If the Iteration hasn't been automatically updated after you upload the .csv spreadsheet, likely you have the data not correctly uploaded. You may want to double check the data by Preview.
If it's in the correct format that you see each value in the Iteration number, but the total iteration is still 1, you can enter the total iterations accordingly.
Once you run the Collection Runner, you’ll find the output as below.
As you see above, you can see each Iteration will perform Login to the APIC and Perform the EPG creation. It also give you the response 200 OK.
You can click on each of the POST request above and find more detail information on the Request / Response Headers and Body.
You’ll find the multiple EPGs being created in ACI once you run successfully.
Really like the series keep up the great work.
Went from no postman experience to creating a new BD and EPG in 2 hours using global environment variables and workspace variables. These 3 documents helped me get up to speed very quickly. Now I'm ready to start creating ACI configs in bulk. Thanks for the help!!!
Hello!
I have a question about these two strings in payload:
"tnFvBDName": "BD-sample",
"status": "created,modified"
BD-sample - Is it a name of Bridge Domain which has been already created and EPG is associated with? So it also should be changed in request according to real BD name in Tenant/VRF. Am I right?
Great help...
These tutorials are super helpful!
Hi thanks for these tutorials but i am trying to do something to test but is does not work, perhaps someone can help me out what is going wrong.
Collection
POST : https://{{apic}}/api/aaaLogin.json
Body: { "aaaUser" : { "attributes": {"name":"{{userName}}","pwd":"{{userPasswd}}" } } }
POST https://{{apic}}/api/node/mo/uni/tn-rabobank/ap-{{ap}}/epg-{{epg}}.json
Body: payload{"tagAnnotation":{"attributes":{"key":"aci","value":"rules"},"children":[]}}
csv file contains:
ap,epg
ap_vrf1,epg_vlan0614
ap_vrf1,epg_vlan0615
ap_vrf1,epg_vlan0901
ap_vrf1,epg_vlan0903
Variable {{apic}} is defined in Environment Globals
Variables {{ap}} and {{epg}} are in the csv file and below in the collection
When running this job the login is successful but put the annotation not, it gives 400 error
Hope someone can help
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: