@@ -16,8 +16,6 @@ This repository contains both an advanced multi-threaded asynchronous python - a
1616- [ ] support wiping device to clean state prior to sending config
1717- [ ] sanitize log file strings for cleaner output (\b, \r etc.)
1818
19-
20-
2119## Table of Contents
2220
2321- [ Files] ( #files )
@@ -54,19 +52,34 @@ This repository contains both an advanced multi-threaded asynchronous python - a
5452
5553### Python Script
5654
57- Confirm your device file, default is set to ` /dev/ttyUSB0 ` - edit accordingly if required.
55+ ```
56+ usage: cisco-send.py [-h] [--device-file DEVICE_FILE] [--delay DELAY] input_file
57+
58+ Send a local config to a device over a serial/console connection.
59+
60+ positional arguments:
61+ input_file Path to the config file for the Cisco device (Router/Switch).
62+
63+ options:
64+ -h, --help show this help message and exit
65+ --device-file DEVICE_FILE
66+ Path to device file. Default is --device-file /dev/ttyUSB0
67+ --delay DELAY Delay between sending lines, in seconds. Default is --delay 0.2s
68+ ```
5869
59- Run the Python script using the following commands:
70+ Confirm your device file, default is set to ` /dev/ttyUSB0 `
71+ + ` DEFAULT_DEVICE_FILE ` and ` DEFAULT_DELAY ` variables can be set inside script.
6072
61- Install dependencies;
73+ #### Install dependencies;
6274` pip install -r requirements.txt ` || ` <your-pkg-manager> install pyserial `
6375
64- Run script;
76+ #### Run script;
6577``` bash
66- python3 cisco-send.py < input_file>
78+ python3 cisco-send.py < input_file> --device-file --delay
6779```
6880
69- Replace ` <input_file> ` with the path to the config file for the cisco device (Router/Switch)
81+ Replace ` <input_file> ` with the path to the config file for the cisco device (Router/Switch)
82+ - --device-file and --delay are optional to override the defaults.
7083
7184You'll likely want to add the script to your ` $PATH ` ie. ~ /.local/bin/
7285
@@ -79,7 +92,7 @@ How to use:
7992 Note the line ` Console is on port 5000 and type is telnet `
8093 + Run ./gns3-serial-bridge.sh as a regular user.
8194 + You'll be prompted to provide a virtual device file name (default is ~ /ttyCisco).
82- (Note that if you change the default, you must also update the device_file variable inside cisco-send-gns3.py)
95+ (Note that if you change the default, you must also update the DEFAULT_DEVICE_FILE variable inside cisco-send-gns3.py)
8396 + Provide the GNS3 device telnet port number when prompted (default is 5000).
8497 + The script will then execute socat to map the provided telnet port to your virtual device file.
8598 + Optionally, you'll be asked if you would like to launch screen with 8N1 configuration.
@@ -110,6 +123,7 @@ Replace `<input_file>` with the path to the config file.
110123 + Offers to save running-config to startup-config.
111124 + Provides an option to save syslog buffer to a local log file.
112125- ** Asks to write running-config to memory** : Save the new config to startup-config
126+ - ** Command line switches** : to override default ` --device-file ` and ` --delay `
113127
114128### Bash Version
115129
0 commit comments