In this video, we will still learning about paramiko. Now we will modify the input script. 2
Here I will add or parameter, so let’s say or and then 10.10.10.1. 3
In the user, let’s add or cisco, in the getpass, we also able to add or parameter, 4
so here or cisco. 5
this or parameter is used to define the default value. 6
When we run the script, we need to input the ip address right? 7
But because now we have or parameter, we can just enter, and the value will be 10.10.10.1 8
Let’s try it, go to python interpreter. 9
Here, ip_address input ip address, 10
let’s just enter here, 11
Now let’s print ip_address, 12
Here we can see that the ip_address is empty. 13
Now let’s try to use or, so here ip_address input, ip address or 10.10.10.1, 14
Let’s just enter here, 15
Print the ip address, here we can see that the value is 10.10.10.1. 16
Okay, so remember that or parameter in input like this is used to define the default value. 17
But if we type the ip address in the input, the default value will not used. Let’s try, 18
ip_address input ip address or 10.10.10.1, enter, let’s input 10.10.10.2, 19
print the ip address, 20
okay here we can see that the value is 10.10.10.2, so the default value is not used. 21
Let’s save the script, let’s also change the loopback, 22
let’s say here we will create loopback2, the ip address is 10.1.1.3, save. 23
Let’s run the script again, python3 paramiko_basic.py, 24
Just enter enter here. 25
Here we can see that we are success login to router 1, and create loopback2, 26
Let’s check on router 1, do show ip interface brief and then here I add argument exclude unassign, 27
this is means that we see the interface, 28
but if there is a word unassign, so that is will not shown. 29
Here we can see that we get a lot of interface, 30
but we don’t need an interface that unassign, so we can exclude it. 31
Here the result is only interface that have an ip address. And here we can see loopback2, 32
Okay I think enough for this video, I hope you understand the function of or in input. 33
Thank you for watching and see you on the next video.