In the last two video, we learn how to doing network automation on cisco and mikrotik router. 2
In this video we are going to combine that two topics, so in the end of this video, you 3
will able to doing network automation on cisco and mikrotik router at once. 4
This is the script that we will use in this video. Here we have a list of dictionary that 5
save the router information like ip address, vendor, username, and password. 6
The first dictionary save the information about cisco router, the ip address is 192.168.1.2 7
the vendor is cisco, the username and password is also cisco. I am sorry, the IP Address 8
of cisco router is 192.168.1.3 9
The second dictionary save the information about mikrotik routers, the ip address is 10
192.168.1.2, the vendor is mikrotik, the username is admin, and the password is blank 11
We call SSH Client function from paramiko , and Here we doing a loop to devices 12
which is the list that we have defined before. Here we connect to the device [“ip_address”] 13
this is will be 192.168.1.3 and 192.168.1.2, using the username and password from dictionary. 14
Here we just print that we have successfully login to the router. 15
We have a condition in here, if the vendor is cisco, the script will invoke the shell 16
and send cisco command, also will print the output to the console. But if the vendor is 17
not cisco, which means that the vendor is mikrotik, the script will not invoke the shell, 18
instead send the mikrotik command directly, you can see that we don’t need to sleep 19
the script if the device is mikrotik. Last don’t forget to close the ssh connection. 20
Save the file, open a command prompt and make sure that we are in the right directory 21
Here we can see that we have script3.py. Let’s run the code 22
First, the code will connect to cisco and configure loopback 2 interface with ip 23
address 10.1.1.3, and then connect to mikrotik router and configure loopback1, with ip address 10.2.2.2 24
Okay our script executed successfully, let’s check on the cisco router 25
Here we can see that now we have loopback2 interface with ip address 10.1.1.3. 26
Let’s also check on mikrotik router. Here we can see that we also have a new ip address, 27
which is 10.2.2.2 on loopback1. 28
Cool ! We are successfully doing Network Automation on cisco & mikrotik routers at once 29
Thankyou for watching and see you on the next video.