Tenant
Application
  • Introduction
  • Ansible and ACI
  • Dev/Ops
  • Cisco ACI API
  • Python Basics
  • ReST w/ Python Requests
  • Javascript
  • Web Application
  • Finished
  • References

One of the things we always want to do in this lab is inspire the posiblities of the users to create applications. Sometimes it is hard to understand how exactly the ACI ReST API actually can transform network access from the perspective of simple scsripts to full blown applications that complete network tasks with ease.

When you observe the various integrations that Cisco has accomplished for OpenStack, Kubernetes, OpenShift and others you are just seeing this concept in action. That which the API is used by different integration components to configure network elements.

To show this we have built for you a more complex application in JavaScript that you will be adding some functionality to. We have already integrated login/logout to the fabric, we have transfered the endpoints code over the full foundation of the app. We just want to provide a cool place to add some code to give you an idea of what could be accomplished with ACI.

In the previous example of javascript we created a application with NPM. For this portion of the lab we are going to use NPM again in a different directory that is going to contain a set of file structures that we have built for you to accelerate this more complex version of the lab.

Step 1 - Stop debugger from ep-viewer section of the lab.

As we are going to shift to a different application, we will repeat some steps that we had done previously. But first we have to STOP the current debugger session.

In the IDE window there should be a little debugger control panel on the top that looks like:

Click on the last button for STOP. This should close the debugger allowing us to start it for the new application.

Then click Terminal that is to the right of your Debug Console to return to your terminal window.

Step 2 - Change directory and initialize NPM

Back at the bottom of the IDE click on the Terminal window again if you haven't already. You will be working on a new directory struture that we have placed under the ~/ltrdcn-3225/jsapps. This new directory is called tenant. Under this directory is a bigger application structure. Here you have to initialize NPM for this application.


cd ~/ltrdcn-3225/jsapps/tenant

And then we will initialize NPM:


npm init

Tip

Use default options by hitting 'Enter' then typing 'yes' at the end.

Step 3 - Install http-server

Then install http-server on this NPM working environment.


npm install http-server --save-dev

Step 4 - Create SSL Certificates with OpenSSL

Just like the previous session we have to create a local cert to start the development web-server.


openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 -keyout key.pem -out cert.pem -config csr.conf

Step 5 - Update package.json file

In the IDE modify the package.json file in the ~/ltrdcn-3225/jsapps/tenant adding the following line to the scripts object. Don't forget to include the comma on the line above for correct JSON syntax.


{
    "name": "tenant",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
      "dev": "http-server -c-1 -S -C cert.pem -p 10004"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "http-server": "^14.1.1"
    }
}

Watch out!

Make sure to include the comma (as shown on line 7) for correct JSON syntax.

Step 6 - Start application debugger for Tenant APP

Just as we did in the ep-viewer section, you will now run the debugger but for the tenant application.

  1. On the left portion of the IDE there is a play button with a tiny lady bug.

  2. On the top there is a selection that will have two separate options.

    • EP Viewer
    • Tenant APP

  3. Select Tenant APP
  4. Then, click on the green play button. This will start the debugger


You should then be able to reach the application in the following url: https://10.0.226.241:10004 that will show you the application that you will be working on expanding functionality.

Step 7 - Login into APIC from this app

Click on the Login Form button and enter the credentials for the ACI fabric.

  • APIC IP Address: 10.0.226.41
  • Username: aciproglab04
  • Password: cisco.123

After that you should see some data show in the tool related to the lab ACI Fabric. We have included the same EndPoint viewer and we have some other widget type data for your pleasure. Now you will work in the create network section of this tool to configure some networks via this interface into the fabric.