ACI with Postman

Related Post

  • No related post.

I. Introduction

This article is a simple introduction on how to use automation in ACI.

In this article we’ll discuss on DN and Class name in ACI. As well as Postman, on how to login to ACI using Postman and creating a simple tenant.

II. Postman

1. What is Postman?

Postman is third party REST API tool. This can be used to create and retrieve object information in ACI. 

2. To download Postman

https://www.getpostman.com/

III. Distinguish Name and Managed Object

In ACI the components are represented in a management information tree (MIT). Each node in this MIT is a managed object (MO). MOs are identified by their unique distinguished name (DN). This DN provides the fully qualified path from the root of the object tree to the object itself.

DN is made up of a series of pieces known as relative names (RN).

dn = {rn}/{rn}/{rn}/{rn}…

The APIC REST API is a programmatic interface to the APIC. Here, you can use any programming language to generate REST calls, which contain JSON or XML formatted data to read and write objects in the APIC MIT.

IV. Logging to ACI with Postman

1. Define Your Variables

Click on Settings > Manage Environments

1.png
2.png

Click Add

Change the value of the apic, username and password accordingly.

2. Create Collections

On the top left hand side of your postman you can click either one of these button to create a new collections.

3.png

You can name it accordingly (e.g. Add Tenant) and click Create

3. Create New Request To Login To APIC

On the right hand side of the Postman, you can create a new request.

Inside the new request, you can fill in the following to login to APIC:

POST    https://{{apic}}/api/aaaLogin.json

Body

{ “aaaUser” : { “attributes”: {“name”:”{{username}}”,”pwd”:”{{password}}” } } } 

As you see here, the {{apic}} {{username}} {{password}} here is your variable where you define in earlier step IV.1. It contains the value of whichever Fabric you’re currently in. The variable have to be inside the double curly braces {{ }}.  

Click Send.

4.png

Once Send, you can see the response at the bottom of the Postman that shows you the token generated.

Click Save, this is next to your send button. This is to Save the request to your Collection folder that you created earlier.

V. Creating Simple Tenant

1. Create New Request For Creating Tenant

Below example will create the new tenant with the name “tenant-1”

POST   https://{{apic}}/api/node/mo/uni/tn-tenant-1.json

Body

{“fvTenant”:{“attributes”:{“dn”:”uni/tn-tenant-1″,”name”:”tenant-1″,”rn”:”tn-tenant-1″,”status”:”created”},”children”:[]}}

5.png

Click Send.

Make sure that this request is run after you logged in (Step 4). If this request is run without login, you’ll find the authentication error.

Save the request to the collection folder.

2. Result

In your APIC ALL TENANTS, you’ll find tenant-1 has been created.

6.png