sdwan-bulk-show

This repo provides a wrapper to run bulk-show.py on vManage and collect logs from multiple SD-WAN devices.

English: README.md
Japanese: README.ja.md

run_on_vmanage.py (recommended)

The wrapper uploads bulk-show.py + input files to vManage, runs the script remotely, and optionally downloads output logs.

Execution flow (overview):

  1. From your local PC, the wrapper connects to vManage over SSH.
  2. A timestamped working directory is created under --remote-dir.
  3. bulk-show.py, hosts file, and commands file are uploaded into that directory.
  4. The wrapper enters vshell and runs bulk-show.py on vManage.
  5. bulk-show.py logs into each SD-WAN device listed in hosts, runs each command, and writes output logs.
  6. The wrapper downloads the generated output_*.txt files to ./logs//.

Flow diagram:

Local PC -> SSH -> vManage -> vshell -> bulk-show.py -> SD-WAN devices
                                     -> <remote-dir>/<timestamp>/logs
                                     -> download -> ./logs/<timestamp>/

Log output:

  • Remote logs are created at: //logs/output__<YYYYmmdd_HHMMSS>.txt
  • Downloaded logs are stored at: ./logs/<YYYYmmdd_HHMMSS>/output__<YYYYmmdd_HHMMSS>.txt

Usage:

python3 run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> [--password <password> | --key <key_path>] \
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs [--verbose] [--quiet]

Example (password):

python3 run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> \
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs --verbose

Example (SSH key):

python3 run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --key ~/.ssh/id_rsa \
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs --verbose

Notes:
The script creates a timestamped subdirectory under --remote-dir for each run, uploads files there,
and writes logs to //logs.
Use --verbose for detailed remote output, or --quiet for minimal logs.

bulk-show.py (direct)

Put the hosts file and command file in the same directory.

The hosts file contains: IP address (system-ip), username, password.

$ more hosts.txt
2.1.1.1,admin,admin
3.1.1.1,admin,admin
4.1.1.1,admin,admin

The command file contains the show commands you want to run.

Example commands file:

show version
show ip int bri
show ip route
show sdwan control connections

Example:

python3 bulk-show.py hosts.txt commands.txt

Output logs

Logs are saved under ./logs with timestamps in the file name.
You can override the log directory with --logs-dir.

Setup on a clean PC (no Python/venv)

  1. Install Python 3 (3.10+ recommended).
  2. Create a virtual environment:
python3 -m venv .venv
  1. Activate the venv and install dependencies:
    macOS/Linux:
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Windows (PowerShell):

.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Windows (cmd):

.\.venv\Scripts\activate.bat
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
  1. Run the scripts from the activated venv:
python bulk-show.py hosts.txt commands.txt
python run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> --remote-dir /home/<username> --download-outputs

Full command samples

vManage wrapper (run_on_vmanage.py)

Password auth:

python3 run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> \
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs

Windows (PowerShell):

python run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> `
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs

Windows (PowerShell, single line):

python run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs

Windows (cmd):

python run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --password <password> --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs

SSH key auth:

python3 run_on_vmanage.py <vManage FQDN/IPaddress> --user <username> --key ~/.ssh/id_rsa \
  --remote-dir /home/<username> --hosts host.txt --commands command.txt --download-outputs

Local bulk-show.py

Prepare hosts/commands:

cat > host.txt <<'EOF'
2.1.1.1,admin,admin
2.1.1.4,admin,admin
2.1.1.5,admin,admin
EOF

cat > command.txt <<'EOF'
show ip route
show omp route
show ip int bri
EOF

Run:

python3 bulk-show.py host.txt command.txt

Windows (PowerShell):

python bulk-show.py host.txt command.txt

Windows (cmd):

python bulk-show.py host.txt command.txt

Output:

./logs/output_<ip>_<YYYYmmdd_HHMMSS>.txt
View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.