GNS3 Talks: Python for Network Engineers with GNS3 (Part 10) - Jupyter Python Clients (3.0 and 2.7)

preview_player
Показать описание

Learn Python programming with GNS3. In this series of videos I will show you how you can quickly and easily program Cisco networks using Python.

Script on GitHub:

Transcription:

GNS3 now supports Jupyter. In this video, I'm going to show you how to import the GNS3 appliances from the GNS3 marketplace for both Python 3 as well as Python 2.7.

This is one of multiple videos teaching you network programmability using Python and GNS3. Jupyter makes it very easy for you to develop code and share code and not only supports Python but also supports other languages such as R and Scala.

It allows you to share notebooks with others and is currently used by many companies and universities around the world. So to get started, go to the GNS3 website, click on Marketplace, Appliances and search for Jupyter. The Jupyter appliance supports Python 3.0, whereas the Jupyter 2.7 appliance supports Python 2.7. I've downloaded both to my local hard drive.

I'm going to integrate both with GNS3 and I'll demonstrate using the Jupyter to configure a Cisco IOS V router using Python.

Please note that in this video, I'm using GNS3 2.0 release candidates 3. I'm also using the GNS3 VM as recommended by GNS3.

So if these appliances don't work in your release of GNS3, you may need to upgrade to GNS3 2.0 release candidate 3. To import the appliances, go to file, Import Appliance and select Jupyter, click Open, a brief overview of the appliance as shown. We’re told that the Jupyter notebook is an open source web application that allows you to create and share documents that contain live code, equations, visualizations and text.

Basically we're going to use the Jupyter appliance for running Python code. I'm going to click Next. It's recommended that the appliance run on the GNS3 VM and that's what I'm going to do. So I'm going to click Next. This appliance uses HTTP the port number used by Jupyter is 8888 but GNS3 will select a port number for this connection. I'm going to click Next. We're told that the appliance will be available in the guest category. I'm going to click finish and we're told that the Jupyter appliance is installed.

I'm now going to import the 2.7 appliance. The process is very similar so click Next run it on the GNS3 VM, click Next. It also uses HTTP. Console port is shown here, click Next. We’re told that it's also going to be available in the guest category, click Finish. So both of those appliances are now installed and notice what happens when I drag them to the workspace. As this is a docker container, the appliance is automatically downloaded and installed in GNS3.

So you simply need to wait for the docker pool to complete and the amount of time that this takes depends really on your internet speed.

Okay, so GNS3 has successfully pulled the Jupyter image. I'll drag version 2.7 to the workspace and what you'll notice is, it also does a pull and downloads the image. Okay that image has also successfully been pulled so both my Jupyter devices are now available. Now before I connect these Jupyter containers to any device, notice I can boot them up and connect to the console using HTTP. Our web browser is launched and connects to the device. it's connecting via a port selected by GNS3.

And what I can do here is example, you select a new python notebook and I can run a live code here. So notice it gives me help and I can create some simple code and then run it and that's the code that's now run. I can edit my code, create some more code. To actively run the code, there are a lot of options available through this interface and I'll cover more about the interface in subsequent videos. For now, I simply want to get you started and we want to configure network device using Jupyter.

In this example, I'll configure this Cisco router using Python 2.0. But this is a nice way to learn the differences between 2.0 and version 3 of Python. So in this example, what I'm going to do is power down the Jupyter 2.7 appliance. I'm going to right click and click Edit config and I'm simply going to remove the comments for the static interface configuration. The appliance will be configured with this IP address 192.168. 02 I'm going to click Save and start up the appliance.

What I'll do now is connect to the cisco router and here it is. I'll bypass the initial configuration dialog and let's configure GigabitEthernet0/1 with IP address 192.168.01,subnet mask of /24 and let's see if we can ping the Jupyter 2.7 PC. And as you can see there, I'm able to do that....

Рекомендации по теме
Комментарии
Автор

As I understand Jupiter is a simple IDE that integrated in GNS3.
But for more complex projects\study tasks I recommend to use PyCharm or Atom.

oo
Автор

hi david, what is the script to take back up config of switches via ssh, not telnet.

vishalkanojia
Автор

Good intro into Jupyter, just a question what about the Python IDLE tool that comes with installing python on windows or Linux host directly? That has a shell, interactive debugger etc. Is Jupyter a complement to the python IDLE tool?

jeffsicuranza
Автор

great video sir David. quick question, I am using ubuntu I am still recommended to use GNS3 VM or not? thank you very much in advance

ProjectRK
Автор

No matter how many times I tried, I edit the config of the Jupyter2.7 node and save it and it goes back to the original config. It's frustrating!

komalthecoolk
Автор

Sir David, I have problem with my Jupyter Client Docker in GNS3. I can't access it but it manage to pull the docker image. But when I click console it won't let me access the jupyter web gui. Please help thank you very much

ProjectRK