Introduction to Python

This topic is to discuss the following lesson:

Hi Rene,

Will like to bring to your attention. When we use search box for “Python” lessons it shows “no results” found. But however under CCNP and CCIE course, if we manually search its available.

On other Note in CCIE Introduction page their is an typo in certification spelling .

Regards,
Abrar

Hello Abrar

I tried searching for “python” and I did get some results:


Can you try again and replicate the error and let us know under what circumstances it happens? As for the typo, thanks for pointing it out, I will let Rene know to make the appropriate changes.

Laz

Hello @syedabrar_8055,

Thanks for pointing out that typo, I fixed it. About the search function, if you are still having issues, could you share a screenshot? I’m getting the same result as @lagapidis

Rene

Hi Rene,

What I notice is we have to use complete word “python”. If I use “pytho” (Even I single letter less) the search fails.

Attach is the screenshot

Regards,
Abrar

Hi Abrar,

Thanks for letting me know, that is interesting. We are replacing the search engine soon, I’ll make sure it will also work for partial matches.

Rene

Hi,
Can you explain me what is Jinja and how it works?

Here I saw that it is a template designer tool, but I’m not sure to understand what it is meaning and how we can use it for our network automation scripts.

Thanks

Hello Giovanni

Jinja is a web template engine for the Python programming language. A web template engine or system is used for web publishing, and lets designers work with web templates to automatically generate custom web pages. An example would be the unique web page that is automatically created when you do a web search, showing you the results of your search. So Jinja is used to automatically create python templates for dynamically created web pages. So Jinja was initially designed for this purpose.

Now after doing some research, I have found that “templating” is not only useful for web pages, but also for network automation. Practically speaking, if you use Jinja for templating for network automation, then you would create a file that looks just like the configuration you are trying to make, except that there will be placeholders, or variables in the positions of key pieces of data.

Creating templates will make the implementation of network automation more streamlined allowing you to reuse these templates for multiple devices.

If you do a search for “using jinja for network automation” you will find both videos and tutorials that further discuss the details involved in such an implementation.

I hope this has been helpful!

Laz

I have EVE NG installed and also did install python shell client on my laptop. But not sure how to simulate the cisco router ssh access in EVE NG using python shell which is installed on my laptop outside the workstation. Please help.

Hello Naveen

Whenever you want to communicate with a particular entity, it’s always a good idea to check the related API documentation. For EVE-NG, you can take a look at the following link:

Here you should find all you need to interface with the virtual devices in the emulator. In the examples, you will find that they use CURL, a simple Linux CLI tool to communicate through HTTP. You can also find some examples for what you need to use the EVE-NG API at the following lesson, but for this you will need to do some coding yourself:

Finally, you can find some information that people have included on Github about creating Python scripts to communicate with the EVE-NG API at the following link:

These should give you enough information to get started.

I hope this has been helpful!

Laz

Hi
Do you know know how make a RESTFUL API Server on python?

Thanks

Hello Giovanni

There is currently no lesson about building a RESTful API server using python, however, there are quite a few resources online that you can research using your favourite search engine. Some information about connecting with a REST API using python can be found at the following lesson:

I hope this has been helpful!

Laz

Hi,

I want start to make practise with python with Cisco Devices.
What tool you suggest ? example GNS3 EVE-NG
And i want know if there are easy example how start to configure network devices with python
thanks

Hello Ugo

It’s great to see that you want to jump right in and start configuring network devices using Python. First of all, it’s a good idea to become very familiar with Python before beginning to apply it to network devices. Having said that, I believe that the following post and subsequent thread will be very helpful in putting you on the right track. Take a look and if you have any more questions, feel free to ask…

I hope this has been helpful!

Laz

Hello Rene,
I know python scripting and want to apply that in network automation. Basically looking to learn PyATS, RestAPIs on the virtual Lab. Can you suggest how I can setup virtual lab in order to learn Network Automation using PyATS Framework.

Thanks and Regards
Vijaya Chitturi

Hello Vijaya

To start off with, you can take a look at Cisco’s DEVNET site specifically for pyATS, which includes some useful learning labs and tutorials with step-by-step instructions. Once you cover that, Cisco offers a no-cost sandbox that allows you to run code. These sandbox platforms include anything that can run in Cisco VIRL.

Finally, CML provides an API where you can download a ready-to-go pyATS testbed file. This is detailed in the following Cisco Developer blog:

If you want to run pyATS with GNS3 or EVE-NG, you can do a lookup on their sites, as they have many detailed tutorials on how to set up such scenarios.

I hope this has been helpful!

Laz

While using Brave and Edge when I go to the python lessons the browser with scroll down a bunch automatically. It is what it is, but I thought I would let you know. Firefox takes a while to load the trinket apps, but it doesn’t automatically scroll.

Hello Justin

Thanks for letting us know about this behavior, I’ll relay it to Rene to see what we can do.

We appreciate your feedback, making the site even better…

Laz