umbelivable! I'm dev in migration to InfraSctucture area. That's amazing! using Python to automatize a bunch of dailly tasks really makes me smile at this side of the screen. Thanks for this!
Wow! This is awesome! What is a real-world example of when something like this would be used instead of just logging in directly and performing the commands on the network device? Also, could you make a video showing how to write a script that will ssh into multiple devices (more than 20) in one action?
Running a script for multiple devices. Of course if you only have 1 device to check it's easier to just log into it. But if you're checking something, or making changes on 30 devices, you can do it all at once by altering a few lines of code.
There aren’t many, if your not using dhcp it’s hard to get around addressing so maybe a python loop to connect to each device and entering addresses that way, you could use a good config as a template and transfer that onto the devices first to simplify all of the default configurations you need to make. You can also write config commands in a text editor and drag and drop them into the cli this is fast and easy as long as you don’t have a shit ton of devices.
I’d say configure a switch and router as far as you can, save the configuration files in a .txt and as the running-config on the devices then just transfer them and use dhcp.
Hello, In order to get the user that is currently logged to the device you would need to connect to it first. I agree adding the username and password to the script is not at all secure. This example was just to show that is possible to automate the process. A more secure way would be coding it in VS code and use the python library "getpass" and make users to type username and password before every session. Hope it helps Thanks for the comment!
HI, I tried the the script however its returning "ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler". I am trying to use radius account configured in my switch and the account is actually not high privilege level. So how do I bypass this enable mode? Thanks for the script provided.