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.
Please stop the NPM process of the previous lab portion by pressing CTRL-C
to stop
the process in your terminal window. This should return you to the prompt.
Also, please close any of the tabs open in your VSCode editor to keep things clear for this next section.
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
Use default options by hitting 'Enter' then typing 'yes' at the end.
npm install lite-server --save-dev
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": "lite-server"
},
"author": "",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.6.1"
}
}
Make sure to include the comma (as shown on line 7) for correct JSON syntax.
You will now create another file in the IDE named bs-config.json in the
~/ltrdcn-3225/jsapps/tenant
directory
containing the following JSON data structure.
bs-config.json
{
"host": "10.0.226.241",
"port": 10004,
"open": false
}
You have to start NPM as we did previously to start lite-server that will be hosting the application on this server.
npm run dev
You should then be able to reach the application in the following url: http://10.0.226.241:10004 that will show you the application that you will be working on expanding functionality.
Click on the Login Form button and enter the credentials for the ACI fabric.
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.