Skip to content

Commit 1a5942e

Browse files
author
Jérome Tissières
committed
Merge branch 'master' of github.com:jerome-t/nxos-scp-upload
2 parents ce490cb + 5eba6cb commit 1a5942e

File tree

1 file changed

+40
-41
lines changed

1 file changed

+40
-41
lines changed

README.md

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,107 @@
1-
# NX-OS-SCP-Bulk-Transfer
1+
# netmiko-scp-multi-thread-upload
22

3-
A Simple Python script to upload and verify (checksum) files to multiple network devices in parallel, supported by Netmiko
3+
This script leverages Netmiko's features to secure copy (SCP) a single file to multiple remote network devices in parallel.
4+
It checks if the file already exists on the remote devices and compares the checksums. If the files are identical, it does not upload it.
45

5-
6-
## Use Case Description
7-
8-
If you have a large number of NX-OS devices and need to upload a file, for example a new version of NX-OS, to all these devices without the help of an external tool like Cisco DCNM or similar, it can be very time-consuming. This script takes care of everything.
96

10-
This script uses the strength and functionality of Netmiko to copy, in parallel, a single file to multiple network devices.
7+
## Use Case Description
118

12-
Supported devices are:
9+
If you have a large number of network devices and need to upload a big file, like a new OS or similar, to all these devices, it can be very time-consuming. This script takes care of everything.
1310

14-
Cisco Cisco IOS/IOS-XE/IOS-XR/NX-OS, Arista EOS, Juniper JunOS
11+
Supported devices are: Cisco IOS/IOS-XE/IOS-XR/NX-OS, Arista EOS, and Juniper JunOS.
1512

1613

1714
## Installation
1815

19-
Requirements: All you need is Python and pip.
16+
Requirements: All you need is Python and pip.
2017
Then, with pip we will install Netmiko and dependencies.
2118

2219
Installation:
2320

24-
$ git clone https://github.com/jerome-t/nxos-scp-upload.git
21+
$ git clone https://github.com/jerome-t/netmiko-scp-multi-thread-upload
2522
$ sudo pip install -r requirements.txt
2623

2724
## Configuration
2825

29-
Update the file hosts.csv with the list of your network hosts, one host per line, including the vendor type..
26+
Update the **hosts.csv** file with the list of your network hosts and vendor type.
3027

31-
Vendor types are:
28+
Vendor types are: cisco_ios, arista_eos, juniper_junos, cisco_nxos
3229

33-
cisco_ios
34-
arista_eos
35-
juniper_junos
36-
cisco_nxos
37-
38-
Example:
30+
Example of hosts.csv:
3931

4032
host01.example.com,cisco_ios
4133
host02.example.com,cisco_nxos
4234

43-
The file system is the default defined into Netmiko. Please refer to the Netmiko documentation here[https://pynet.twb-tech.com/blog/automation/netmiko-scp.html]
35+
36+
The file system used for each OS type is the one defined by default in Netmiko. Please refer to the Netmiko documentation here: https://pynet.twb-tech.com/blog/automation/netmiko-scp.html
37+
4438

4539
## Usage
4640

47-
Add the file name as an argument to the script.
48-
Then, the script will check if the file exists, read the list of hosts and ask you for your NX-OS credentials in order to upload the file.
41+
Add the filename as an argument to the script.
42+
43+
The script will also check if the file exists, then read the list of hosts, vendor type and ask you for your credentials.
44+
4945
It will ask you for a confirmation before starting the upload.
46+
5047
To save time and bandwidth, if the file already exists it will be not overwritten.
5148

52-
usage: nxos-scp-upload.py filename
49+
**Usage: nxos-scp-upload.py filename**
5350

5451
positional arguments:
5552
filename The file to upload
5653

5754
Example where the file does not exists on the first host, but exists on the second:
5855

59-
$ ./nxos-scp-upload.py testfile.txt
6056
================================================================================
61-
Please, confirm the upload of: testfile.txt on:
62-
n9300-labc.example.com
63-
n9300-labd.example.ch
64-
n9300-labe.example.ch
65-
n9300-labf.example.ch
57+
Please, confirm the upload of testfile.txt on:
58+
c.example.com
59+
d.example.com
60+
e.example.com
61+
f.example.com
6662
Proceed? [n]|y: y
6763
--------------------------------------------------------------------------------
68-
Please insert your NX-OS username: admin
64+
Please insert your username: admin
6965
And your password
7066
Password:
7167
--------------------------------------------------------------------------------
72-
Upload on: n9300-labc.example.ch
73-
Upload on: n9300-labd.example.ch
74-
Upload on: n9300-labe.example.ch
75-
Upload on: n9300-labf.example.ch
76-
Results for: n9300-labf.example.ch
68+
Upload on: c.example.com
69+
Upload on: d.example.com
70+
Upload on: e.example.com
71+
Upload on: f.example.com
72+
================================================================================
73+
Results for c.example.com:
7774
File exists already: True
7875
File transferred: True
7976
MD5 verified : True
8077
================================================================================
81-
Results for: n9300-labd.example.ch
78+
Results for f.example.com:
8279
File exists already: True
8380
File transferred: True
8481
MD5 verified : True
8582
================================================================================
86-
Results for: n9300-labe.example.ch
83+
Results for e.example.com:
8784
File exists already: True
8885
File transferred: True
8986
MD5 verified : True
9087
================================================================================
91-
Results for: n9300-labc.example.ch
88+
Results for d.example.com:
9289
File exists already: True
9390
File transferred: True
9491
MD5 verified : True
9592
================================================================================
96-
Uploads completed in 3.500903606414795 seconds.
93+
Uploads completed in 3.351285219192505 seconds.
9794
================================================================================
9895

9996

97+
10098
## DevNet Sandbox
10199

102100
--- To be completed ---
103101

104102
A great way to make your repo easy for others to use is to provide a link to a [DevNet Sandbox](https://developer.cisco.com/site/sandbox/) that provides a network or other resources required to use this code. In addition to identifying an appropriate sandbox, be sure to provide instructions and any configuration necessary to run your code with the sandbox.
105103

104+
106105
## How to test the software
107106

108107
--- To be completed ---
@@ -114,9 +113,9 @@ If the repo is instrumented with a continuous testing framework, that is even be
114113

115114
## Known issues
116115

117-
The MD5 check part need to be completed, it's not working yet.
116+
The 'file exists already' value is always True, even if it does not exists in reality. The upload is done anyway, this is only an output error, but the script is working at 100%
118117

119-
This script uses multi-threads and may be improved by using multi-processing.
118+
This script uses multi-threads, it may be improved by using multi-processing.
120119
The defined threads are 4 for now, I have to test what is the optimal number of threads depending on the devices, computer, network bandwidth and latency, etc.
121120

122121

0 commit comments

Comments
 (0)