Copying files to a device using netmiko
Transferring files to and from a network device is a common use case. Be it the transfer of a new firmware from your computer to a network device, or the download of log files from the network device back to your computer for further analysis, it is always useful to be able to sync files with a device.
In this recipe we'll see how netmiko has integrated the secure copy (or scp
) protocol that works on top of SSH to allow us to easily transfer files to and from a device.
Getting ready
Open your code editor and start by creating a file called transfer_files.py
. Next, navigate your terminal to the same directory that you just created the transfer_files.py
file in.
You'll also need a file, for example a new firmware or just a text file, that you want to transfer to your device. If you don't have a file ready that you could transfer, feel free to just create an empty text file called test_upload.txt
. You'll also have...