In this post we will see how to use Postman Runner in order to deploy ACI configuration with variables from a CSV file.
- Postman should be installed and running with access to your APIC
In this example we will configure 5 new Bridge Domains in a tenant.
Tenant = KM
VRF = vrfKM-1
New BD’s to be configured = BD1, BD2, BD3, BD4, and BD5
Currently the tenant KM looks like below figure. We have a tenant ‘KM’, an VRF ‘vrfKM-1’ and no BDs configured.
Next we will create a CSV file that must be saved in UNIX format.
‘bridge’ and ‘ip-addr’ = Postman variables (explained below)
BD1,BD2, …,BD5 = are BD names to be created
10.1.1.1/24 = SVI for BD1
10.2.2.1/24 = SVI for BD2 and so on
The variables ‘bridge’ and ‘ip-addr’ are user defined and we will use these variables in Postman Runner to insert more specific values when the script is run. For first iteration ‘bridge’ will be replaced with BD1 and then in the second iteration it will be replaced with BD2. Similarly, ‘ip-addr’ will be replaced with 10.1.1.1/24 and 10.2.2.1/24 in the first and second iteration and so on.
Make sure to save the file with extension .csv
Also make sure that it is saved in UNIX format
Now that the CSV file is created, we can move on to look at Postman configuration. Please look at the figure below which details some aspects of Postman.
If you need more information on how to use Postman and login into APIC with Postman please see this article: https://unofficialaciguide.com/2015/05/30/aci-using-postman-to-quickly-configure-interface-policies/
Step 1 To login to the APIC. ( use the above link if you need to refresh how to login into APIC using Postman)
Step 2 To add the REST API for the script. In our example we will use the below script to create new BDs.
<fvTenant name="KM" >
In the above figure we have the following fields to consider:
Collections – this is where you define the collection of your REST APIs to use.
Testing Runner – In our case we have defined the a collection named ‘Testing Runner’.
POST CreateBD copy – this is the REST API that is defined in our ‘Testing Runner’ collection. This simply defines 5 BDs with their SVIs as listed above.
SJ LAB – This is the environment that I created to store my username/passwords and APIC IPs. You can create your own environment or use hard-coded values instead.
Next we will select the ‘Testing Runner’ collection to run the script to create 5 BDs.
Use the small arrow to open the ‘Testing Runner’ collection and click the Run button.
In the new window, you need to fill the following information:
Environment (choose your environment if you had defined one earlier)
Iterations (5 in our case – look at the csv file)
Select File (choose the csv file)
Preview (after choosing the csv file you can also preview it here)
Then hit the ‘Run Testing Runner’ button to start the script.
Preview should look like this
It will return 200 OK as below
When you look at the APIC GUI you will see that 5 BDs have been created with their respective SVIs.