I’m sure I’ll post some more quick little notes like this but I wanted to just share some of the random things I’ve learned over the past few weeks playing with ACI!
Factory Reset Things:
For the APIC, log in as admin, then run “eraseconfig setup,” you’ll be prompted to reload the box, viola factory defaulted! If you would like to also default the devices (which defaulting the APIC does NOT do), log into them via SSH, you’ll want to make sure the boot variables are set to the image you want them to boot to. You can view the image by looking at some Linux file that houses this information:
In my case, both files were already referencing the image I wanted the switches to boot to (11.1.1j in my case). Next up, is basically the a version of the good ol’ write erase were so used to:
If you’re using a different image, replace the image file above with the image you had configured in your boot vars.
Firmware Download to the Fabric:
Since I’m a noob with SCP and the only options for downloading images to the fabric are SCP and HTTP, I figured HTTP would be a bit easier, so here’s how I’ve been doing it. Obviously step one is getting the images you want! Next up, (I’m on a Mac, but this works on Linux too… Windows users… sorry, can’t help ya!) open terminal and cd to the directory you have the images in. You can then run a simple Python web server with the following command:
python -m SimpleHTTPServer [port]
Of course you can replace the port with whatever you’d like.
In ACI, head on over to the admin tab, and to the Firmware section. There is a ‘Download Tasks’ option in the left navigation pane. You can right-click and “Create Outside Firmware Source.” This is where you basically configure the server that the APIC will pull the file from. Give the firmware source a name (I just use temp and delete the object when I’m done), and then enter IP:Port/file you are wanting to download to the controller. Easy cheesy. You can go to the “Operational” tab and watch the download progress. The file goes straight to the firmware repository and then you can proceed with following the upgrade guides on Cisco.com.
One more thing, don’t be a noob like me — upgrade the APIC first, then the fabric devices! Oh, also, always keep the fabric and the APIC on the same version — that’s pretty obvious, but just wanted to put it out there!
Getting Prepared to do API Magic:
Jason Edelman wrote a great post about programming an ACI fabric. He jumped right into things, but here are the super easy tasks you need to do to get started for following his blog! Again, this assumes you’re on a Mac/Linux box.
Get pip installed if it isn’t already: “easy_install pip”
Install Arya (not the girl from Game of Thrones, the cool Python tool to convert JSON/XML data to executable code): “pip install arya”
Next you’re going to need to install the actual Cobra SDK, there are two files you need to snag off of an APIC, so web to: “https://apic ip/cobra/_downloads” and pull down those files. Then install them: “easy_install -Z /Path/to/file/[file]” apparently you should install the SDK file first (there are two, an SDK and a model file).
That’s all you really need to get going, you can pull up the API inspector, do some stuff in ACI, find the POST data, clean up the output, save just the JSON chunk as a .json, and then use arya to generate code for you. Magic! I’ll write more in a bit about what I’ve done so far with these tools and the API. Note that when you upgrade the firmware on the fabric you will want to make sure you update the Cobra files as well!