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 @lagapides

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