Cisco CCNP Enterprise 300-435 ENAUTO – 5.0 SD-WAN Part 3
January 30, 2023

7. 5.2 SDWAN API integration with Python part 03

All right. So you can see here that the program that I have here in my automation tool is different. So let me show you that I haven’t created the new one. But let me go back and show you this nano SD one. This is a program actually I have copied directly from the Getting started folder. Now suppose if you don’t want this, because again I want to add some new functions and feature inside this. So what I have done again, I have added some more functionality and already I have explained this. So I can go back here, I can open my new SDWAN and I can paste here. Now, once this is pasted, then we can go and executed this. So let me copy one more time and I can go back to the display and I can paste here. Let me check maybe some issue with the pasta one dot PY and let me copy and paste.

Okay, so now it got pasted. And here you can see that if you go and compare the program that is there in the folder, in the GitHub, there are not many functions, but I have added ompus, PFT, log and so many others as well. So let me save and let me go out from here. And if I can show you the login detail, so I have login SDWAN detail. This is my environment variable. I want to set this first and then we are ready to run this program. So I can go here and run python three and then my new SDWAN say one PY. And first of all, I want to show you the functions that we have. So I have long list of function encoded the API or converted the APIs inside the python. Here you can see the app route, interface, VFT, et cetera. We are looking here just to get the devicespecific information so I can select that enter. Now, maybe you’re thinking that how it is doing the query inside the lab environment.

Let me quickly show you my GNS. Here I have my automation tool and here I have the cloud set up in the cloud. This is the net from where my automation tool is getting the IP. But I have the reachability to the cloud in the GNS, correct? So I’m running my program here and then you can see that we have the information. So first of all, the list actually whatever information that I want, that’s the format we have in the table format. So the host name, the device name, the device ID, the system, IP, version, model, platform, certificate validity and estate. Now, these information are very important in terms of monitoring as well. Suppose if you have so many devices and you want to monitor just few clicks and you can check the status. Likewise in this program I have added some other information as well, like the we manage in sync success is that template status, status state and the expiration date apart from that the information. And here you can see that which API it is calling and what is the use to display all the Vipela device in the overlay network that are connected to we manage.

So all the Vs devices here you can see the serial numbers as well. This device is not deployed yet. So we can see just a token number because here again you can see this is the boot strap config generated. But it is not centralized, means it is not deployed from the controller. So good amount of information just from the Python program. What we are doing once our program is ready, simply we are using Python and in the program and the device list, once you go click enter, you’ll get the information, within maybe less than 10 seconds you have this information. So very nice, very helpful. To get the information in the Python format.

8. 5.3 vmanage administration api

In section five three we have to learn, understand the we manage administration API and obviously we can construct those. I’ll show that how we can do that. So once you go inside the we manage let me minimize this. You have the administration option, that you have options related to log user, user group, VPN, RBAC groups, et cetera. Once you go inside the log, you can go and check the audit log, aggregation, do count fields, et cetera. Then you can go to the user, whatever the user list, the users you can update, put, post, delete those operations you can do finally same thing can be done with the user groups. And then finally we have the VPN RBI group as well. Now the question here is that all the time we are logging to the Swagger or we are logging to the we manage API and from there we are doing the work. Now oftentimes what will happen that all the APIs, you are not using it, but you have selected certain useful APIs. And then you have the web page.

From there you can go and you can run those things that you want to do. So maybe here you have 200 APIs. Out of that 200 API you list out 50 APIs that you want to use in your day to day activity. For that you can go and create the web page. And now it is creating web page are very easy. You can use any text to HTML editor or there are HTML editor where you can put the tables, image, videos, pictures, etcd. And very easily you can create the web page. Now those web page can again very easily hosted over a Linux machine. We can run these services for example a packet. And then those web pages can be hosted. So here I have created one HTML code in my notepad. Here you can see this is the HTML code. Again I have used the HTML converter tools to create it. And once I run this in my local system, so it is looking like this API construction request for Sqnv manage administration. Now here you can see that I have although I have given very less amount of APIs. But like that we can build the database. So the task is audit log API.

So you can give the task and here we can give the description that is blank. But you can put any name here, any description, anything correct. Now the task and the description, what is the task? So task is audit log API. And the description is get audit log detail like audit log details. And then the description you can give nice description what this API is going to do. Now if you see this API, you can see that there is hyperlink with this. So that means if I go and click the new API page will come like this. Now this API page that we are seeing, this is the raw format of the JSON. It is not in the extracted format of JSON because we are using this Microsoft browser. If I go back to my Mozilla and this is one of the nice browser we have. So here also we have this web page. Let me refresh this. Now, if I click audit log API, you can get the nice display. Likewise, we can go and check the log details. And then here you can see in the data we are getting the locks, all the locks that we have.

Again, for our purpose, we can copy these locks. Whatever important information is there, we can copy and utilize anywhere. But we have complete audit log in this format, correct? These things are even not possible to take these inputs from the CLI command. Even if you take the CLI input command, where you will store this long input, this is so many pages out there you can see at least you have 60 to 70 page output. Correct? But obviously from here you can go and take that. So you have this option to expand all you can copy paste or maybe this input you can put inside any other pro program where you will get some report format. All right. Then other things say administration, user list, all the users. So you can go and list whatever users we have. For example, rahul Rome. Rahul is under basic group. Romi is underneath Admin and the operator. So Romi is a part of these two user groups.

9. 5.4 Implement Python Script to Configure SDWAN with API Part 01

Now we reach to five four. In this section, it is expected that we should use the post method to do some sort of changes in the configuration. Okay. And we should integrate our API with the Python program. Before starting this, I just wanted to show you that Cisco DevNet. Inside Cisco DevNet, we have a great documentation and step by step process plus the lab that you can go utilize practice. So once you log in to the DevNet and inside DevNet, we have SDWAN programming SDWAN section here, using the we manage rest API. Now again, once you go inside that, you will get all the steps, useful links from where you can go learn the skills related to SDWAN. You can go and clone the Git repository from where you can run exclude the programs as well. Again, you can go and check the sandbox. Here you can see all the links are there. Once I click there, I can go and check the sandbox, I can reserve it and then I can utilize this. So you can do the practice. You have the theory, you have the code, each and everything is there. We should go there and use our knowledge skill to utilize all these links.

Correct? So again, nice description. Just follow the link and have a look on these documents that we have at least this lab and the previous one lab that we have checked, they are very important. And you’ll get the description of all the functions library, why we are using it, what’s the use of this, how we are creating the library. How we are creating the library? Not but which type of library we are calling, plus how we are creating the API library. So that is very important. So we have the API library and then once we have the API library, then we can utilize that API library for certain functions. So for example, just to get the device list, template list attached, device list, attach DHS, there are other configuration change things are involved there. So for example, if you want to detach a template, attach a template, those information we can get from the program.

And obviously when we are attaching or detaching, then we are using some sort of put method. If you’re attaching you’re using the post, if you are detaching, you are doing some change in the object. That means the put method delete is one method. When we are using this detached means you are deleting something. So that will be delete methods like that. We can go and utilize all the methods. You should go here and visit the link. And here you can see the example when you run the program, what type of output will come with this particular code, what type of output will come it is explained nicely at this particular link. Okay, again, here you can see that the example, that how we are attaching the template and several test and other stuff as well. So for example, how you’re updating the objects, et cetera. So complete lab set is there with nice explanation, detaching a template and then the final version. Once you complete this again, what type of things you can go and check. So what we have done that we have already cloned this particular program in our automation tool. So here you can see that I have the cloned and if I can clear it, so we have the clone and if you want to check that, what are the operation we have with the main clone program. So let me quickly show you. Here I can go to Python three SDWAN and then I can check the help. Once you check the help button, then it will tell you that what type of programs it has, it should have the visibility. So what happened at this point of time I have set some other SDWAN variable. Let me quickly go and change this to my variable, that this is my pre manage variables and then I can go and check the help. So what functions we have here you can see this attach detach and other rest of we have checked one, that is the device list. This is the actual program device list output.

Correct. Where I have added some other in the previous section you have seen that I have added some other APIs as well and then it was giving the result. Apart from that, if you want to check the device list, you can check the device list. So these are the template, these are the devices, these are the template. ID number of attached devices. You can see right, then let’s go back to the help. And one thing you can see here that the we manage IP username and password is variable. So the program is not only valid for the sandbox that is there, that is given there with that document that I have shown you, but it is valid to any of the SDWAN fabric, either over the cloud or in the production. As long as we have the reachability, as long as we’ll go and set the environment variable, we can use it. Correct. Again attach device, retrieve and return the device associated to that template.

So if you want to see more information, you can go and check it. Now if you get this type of result, that means your we manage is not reachable. If your we manage is not reachable, then you will get such type of output, such type of information. Correct. So again let’s see that still the lab and the reachability should be there. So receivability is there. And I can see that this program having some issue related to some of the functions. So you can see that some places you’ll find that the program is not working properly. You have to go and fix that code. Cisco has given the code or over the GitHub will get the code, but you should know the code if it is not working, correct? Anyways, maybe this is the why because we are not giving the full command. So here you can see that either your we manage is unreachable or if you’re not giving all the commands related to this, it will throw an error. So what you can do, you can go and check the help function what we want with the attached device. So you can see, I was not giving the attached device and the full template.

So that’s why it was throwing an error, correct? So what we can do here that at this point of time we’ll not do that, but we can go to help. Let’s see before doing edit what other option we have here we can see that we have the attach option as well. Attach a template with the SIS attach devices as well. So what we have seen, we have seen the device list, we have seen the template list. So let me show you the template list one more time because I want to detach now if I want to detach and wanted to know that what options I have after the detach so you can use the help correct? It is telling that you can detach and then you can use the target and then you should use the target ID. So for example, I want to detach this and then you can go and use the system IP.

So ten, 10, two SSIP here you can see with this template I have two devices connected. So if I go and use it, if everything is correct, it will work, otherwise it will throw an error. So it is telling that your target ID so you can see we are getting the information is not working here because my target ID was incorrect, correct? Like that we can go and build our script. So you can see that we should give the target and the target ID. So when we are detaching it, detaching the template, we should go and give the target ID. So let’s see the template list and I’ll tell you that the target ID will get with the device list. So once you are very much familiar with the programs that we are working, we can use it. So now I can go and give the target ID because that was the template ID and I have my DC one VH two. This is the device I’m looking for. And okay, so DC one, VH two is this should work. And let me check that. Maybe now it is gone still we can see that we have two devices those are attached. And if we go and check the device list okay, so what I’ll do, I will build new lab in the next recording and then all the delete and the change type of functions I will show you in the next lab. So let’s stop here and in the next lab I’ll show you rest of the functions.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!