If you are configuring Cisco ACI datacenter fabric it will sooner or later get to the point that you need to configure multiple objects inside the GUI which will, by using the click-n-click method, take a huge amount of time.
While using POSTMAN to create multiple objects of the same type is the preferred method that everybody is speaking about (because you can generate REST API calls using Python or something similar), the quickest way to do it is using POST of JSON configuration file directly through the GUI.
POSTing JSON config example
As described above, the POST of JSON for some simple yet repetitive configuration is the way to go. Let’s see how it’s done:
Creating multiple BDs inside a tenant in Cisco ACI:
-
- You enter the “test” tenant and save the JSON config of your existing environment – right click on the tenant name and select Save As:
After Save As config is selected ACI will ask you which kind of config format you would like to download. We are selecting the whole configuration in JSON format by selecting the things below:
- You enter the “test” tenant and save the JSON config of your existing environment – right click on the tenant name and select Save As:
- After you save the config in this way you can open the JSON file to see what’s inside: You see that you downloaded a JSON for a tenant that has no objects created so it is basically empty containing only the placeholders for objects that you want to create.
- In order to ease your orientation inside the JSON file (if you are not an expert in Cisco ACI configuration tree) you should go back to Cisco ACI APIC GUI and create first two objects in Bridge Domains so you see how they look like in JSON file:
Add subnet to that BD:
- Create another one in the same way and name is VLAN2-BD in our example.
- Save the json again:
- Open that new JSON file to see two BDs that you created:
- Take a look and try to find two BD configurations inside this JSON. You can safely enter blank lines to make the thing more readable – you will soon realize that each BD config starts with “fvBD” attribute:
- Turn Word wrap off inside notepad++ or Atom on OSX so that each BD gets its own line of config in the edit and then copy-paste the lines so many times how many BDs you want to create:
- Scroll to the right to find DB name attribute:
- Scroll more to find BD subnet ip and edit it for each BD:
- Save the JSON file.
- POST the JSON file by POST command on the tenant object:
- Select the JSON file and POST the JSON:
- Cisco ACI APIC will read the JSON and add to the configuration all objects that do not exist:
Note that the POST of json file will not delete a thing. It will only add the objects and their configuration if those objects are missing. POST cannot be used to delete any od the configuration and it can be used only to create or edit existing objects and their attributes.
What is the reasoning behind that way of doing this and not API call?
If you need to get those objects created fast, and you are not planning to do that kind od changes often, creation of multiple objects at once is easier with POST of JSON in the way described below.
POST of JSON is quicker because you don’t need to bother with going through REST calls generation and all that Python process of code generation for something you will do only once or twice.
This is good except it does not deal with the problem of the maximum buffer size of 512 being exceeded by the posted json file.