cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
12922
Views
16
Helpful
6
Comments
rsantoso
Level 1
Level 1

 

 

I. Introduction

 

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.

 

II. Create EPG Spreadsheet

 

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.

 

1.png

 

Once you create this table in your Excel spreadsheet, you can save this as .CSV.

 

2.png

 

Please note: To select the .csv format, as it’s the accepted format in Postman.

 

III.  Postman Collection Runner

 

1. Collect the EPG Object Information from ACI API Inspector

 

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.

 

2. Upload the Spreadsheet to the Postman Collection Runner

 
Now that you have the request ready with the associated variable. You are going to perform the run in the POSTMAN by clicking the '>' Arrow

 

3.png

 

 

 

And click RUN

 

4.png

 

The Postman will pop up browser with the Collection Runner.

 

Upload the Spreadsheet in .csv format that we defined previously.

 

5.png

 

 

Once Uploaded, verify the Spreadsheet is in the correct format.

 

6.png

 

3. Enter the Iteration Accordingly

 

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.

 

7.png

 

4. Run the Collection Runner

 

 

8.png 

Once you run the Collection Runner, you’ll find the output as below.

 

9.png

 

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.

 

10.png

 

5. Result in ACI

 

You’ll find the multiple EPGs being created in ACI once you run successfully.

 

11.png


 
Comments
Rick1776
Level 5
Level 5

Really like the series keep up the great work.

BobN184
Level 1
Level 1

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!!!

mikeok
Level 1
Level 1

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...

ind1g0
Level 1
Level 1

These tutorials are super helpful!

JanWillem
Level 1
Level 1

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

JanWillem_0-1715704401882.png

When running this job the login is successful but put the annotation not, it gives 400 error

Hope someone can help

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:

Review Cisco Networking for a $25 gift card