In the previous video, we have created a simple python script for network automation on cisco router 2
If you not sure that you understand what we have covered in the previous video, 3
I recommend you to back to that video and play it again. But if you sure that you understand 4
that topic, you can continue to this video. In this video, we are going to learn how to 5
doing network automation on mikrotik router. 6
This is the code that we will use in this video. I will also show you the code from the previous video 7
Here we can see that we don’t have many different. 8
In the cisco code, we need to import time, I already explained about time in the previous video 9
But now, for mikrotik code, we don’t need to import time 10
Here we define the ip address, username, and password of the mikrotik router. We call SSH 11
Client function from paramiko and then we connect to the mikrotik router using the ip 12
address, username, and password that we have defined before. 13
The different between this two script is, that we need to invoke shell in the cisco router 14
but we don’t in the mikrotik router. Also the keyword to send the command to the 15
cisco router is send, but in mikrotik we use exec_command. And we don’t need to delay 16
the program in mikrotik, but in cisco, we must sleep the program or the command will 17
not send to the router successfully. 18
Don’t forget to always close the ssh session. 19
Save the code, open a command prompt, see that we are in the right directory 20
Here we can see that we have script2.py. Let’s run the code. 21
Okay, we have successfully run the code, In this example code, we will create a bridge interface in mikrotik 22
and configure the ip address 10.2.2.1 to that bridge interface. 23
Let’s go to mikrotik terminal and see if the script is work. 24
You can see that now we have bridge interface and new ip address in the mikrotik 25
Okay, now we are able to doing Network Automation on Cisco & Mikrotik routers, In the next video, 26
we will learn how to doing Network Automation on Cisco & Mikrotik routers in one code. 27
Thankyou for watching, and see you on the next video!