GNS3 Talks: Python for Network Engineers with GNS3 (Part 5) - Multiple switches, multiple VLANs
David Bombal
Udemy: Get the course for $10 here: https://goo.gl/QYC988 GNS3 Academy: Get the course for $10 here: https://goo.gl/vnZJhg More free Python videos here: https://www.youtube.com/playlist?list=PLhfrWIlLOoKPn7T9FtvbOWX8GxgsFFNwn
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. In this video we program a Cisco IOSvL2 switch with VLANs by using Python on an Ubuntu Docker container.
Script on GitHub: https://github.com/davidbombal/pythonvideos/commit/98ab87bbbe3594e0105fca15060b5c9060d7c9cf
Transcription: This is one of multiple videos teaching you network programmability using Python and GNS3.
Now that we've been able to automate the configuration of both a Cisco IOSv router and an IOSv Layer 2 switch, we'll now configure multiple switches at the same time.
So I'll drag 4 additional switches to the topology and we'll connect them to the first IOSv switch.
So this is acting as a management network for let's say a core and access layer. So these core switches will be connected to one another and they will be connected to the access switches.
So perhaps something like this. Now what you're going to remember is, these links between switch1 and the rest of the switches in the topology is an out-of-band management network, these links between the switches would be the network used for user traffic.
Now we could delete these links to the access layer, for now I'm going to leave them there but in a subsequent video we'll use an in-band management VLAN rather than a dedicated link…….
So I'll start up these switches. One of the parts that's going to take the longest is configuring the IP addresses and other information on the switches. I'll open up a console to the devices in the topology.
So the switches are currently booting up. While we're waiting for all the switches to boot up, let's have a look at our Python script. The first thing I'm going to do is copy script2.py to scripty3.py and then we'll use nano to edit script3.
So this is what the script currently looks like.
In the previous video I showed you how to use a range to configure VLANs on a single switch.Now what's great about using Python directly is you can test things. So if I say range 10 notice it gives me a range from 0 to 9 there are 10 values in the range.
If I say range 74 notice it gives me a range from 0 to 73.
So if I say range 10 again it's in the range 0 to 9. But if I specify 2, 10 that's in the range from 2 to 9. So if I specify 5, 10 that's 5 to 9. If I actually want to use numbers like 5, 6, 7, 8, 9, 10, then I need to specify 11.
So that's something to remember when you create a loops using the range.
In the previous video we wanted to create a VLANs 2 to 100. S ... https://www.youtube.com/watch?v=LiShXliOSvI
102845934 Bytes