Cisco ACI Programmability - Intro to Postman

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay for our first demo let's take a quick tour around Google postman as we said in the slides Google postman is a REST API client and it is freely downloadable there's no charge we said also said in the slides that using a REST API was pretty simple kind of like using a web browser so the there's sort of three components to the puzzle the first is that we need to have a URL or a location that points to the object that we want to manipulate modify or create so if you look here we can see that we've got that address here and that is the address of my my apec now in this particular case i'm actually going to do a login function to generate a session cookie that we can use for future work with with post map so we've got the URL we've got the command the second thing is we want to say do we want to get post or do something else in this case we want to post because we want to send data to a pic in the form of my login credentials which brings us to the third part which is in the body this is technically Jason so we've got this particularly Jane JSON formatted script that contains my username admin and my password that you can see here now if I were to go ahead and click send you'll see that something happened down here at the bottom my first I got a status code of ok 200 which is exactly what I want to see and then we can see what the response was and we can see the generation of a token or a web cookie down here at the bottom that says that I have successfully logged in where did I get that information how did I know what the address was to the object and how do I know what the payload is well when you're first getting started with Google postman if you search for the Cisco APIC REST API user guide you'll actually find a lot of little code snippets that you can very easily copy and paste and then just modify the values to fit your own environment so if I scroll down here and I go down to the JSON area you can see this is exactly the the location to the object change out the IP and then this would be the payload so that's as simple as that really so one of the things that I like to do as an easy example using Google postman is I've got a a brand-new ACI fabric it's it's it's it hasn't been configured at all in fact we haven't done fabric discovery so one of the things we can do is we can manually discover things in the fabric and right click and assign node names and node IDs or we could be clever and use Google postman to do that as well so as you can see here I'm at the very first stage of bringing up my fabric discovery but instead of doing it manually I'll use Google postman so if we go to postman what I've done here is in postman there's something called collections and collections are kind of like bookmarks or common tasks that you do over and over again that you don't want to have to keep sort of copying and pasting and you want to just be able to come back to it so I created a collection here called register notes and that collection has two tasks in it the first is login to a pick which we've just done but in case you haven't logged in or your session cookie has timed out you'll want to include that step and then the second one is actually register my notes and as you can see it's got a different payload that I copied and pasted from that APEC API starter guide and basically all I did was copy this payload change my serial numbers because that's required for fabric discovery setup my leaf and spine names and then my node IDs as well now I'm also going to show you something a little shortcut I guess a little helpful tip when you're when you're using Google postman so if you remember from the earlier example my url and my body had actual values that actually hard-coded values well what if I had multiple a picks that I wanted to log into or I didn't want a hard code anything what you can actually do in in postman is using a double curly bracket like you see here replace the hard coded information and declare a variable so as you can see here I've declared a variable called a pick and then in the body I've actually declared two more variables in double curly brackets one called user name one called password well where does the system find that where do I input that information well in the upper right corner of Google postman they have something called environments so if you click on the environment I'm sorry click on manage environments you'll see that I created one called AMS - ACI and if I click on it you actually can see the variable names in the first column and the values for those variables in the second column you can create multiple environments so let's say you had you were working with ten different customers or you had multiple lab environments and you're in your setup you could create an environment for each of them and keep reusing the same tasks and collections and just change your environment to to point to the right one so I'm going to close that and what we're gonna do here is we're gonna do a register node so the first step is going to be login and the second one is actually register my notes now we've already logged in so I should have a valid session cookie so if I go ahead right now and click send my environment is set properly I should be able to register all of my notes with this information and as you can see down in the bottom I got a 200 okay if we go back and we look at APEC we can actually see that all of the the nodes have shown up as as I wanted what's happening in the background now is the DHCP discovery of tunnel endpoints is happening IP addresses will get handed out and in just the Commendatore two will actually have discovered the fabric now of course with only five devices in my small lab it's not entirely impressive but imagine if you had a whole bunch of leaves like maybe 200 leaves and a handful of spines doing it manually could take you you know a couple of hours and and using a programmatic tool is it's clearly a faster way to get things done
Info
Channel: Cisco ACI Training
Views: 4,498
Rating: 5 out of 5
Keywords: Cisco, ACI, Application Centric Infrastructure, SDN, Software Defined Networking, Programmability, Orchestration, DevOps
Id: Rad2v7gZYVc
Channel Id: undefined
Length: 6min 1sec (361 seconds)
Published: Mon Nov 14 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.