Skip to main content

Run commands against multiple Juniper Junos OS devices

Project description

junos-multi-command
===================
junos-multi-command enables you to run a console command simultaneously on many network devices
running the Juniper Junos operating system. The ability to group network devices in the config.yaml file
gives the operator the ability to pick and choose the type of device or logical grouping for the
selected command.

What is really nifty is that it is involked at the command prompt giving the operator the ability to execute
commands on many routers in seconds from a terminal window.

Functions
=========
* Run a single command on a few or even hundreds of network devices with results returned.
* Uses a config.yaml file to define your hosts in zones allowing you to group like network devices.
* Very rapid execution of commands on multiple routers.
* Secure transfer of commands and results via Netconf (SSH)

Installation
============
Download from github and install dependencies, or type "easy_install junos-multi-command" and have
the dependencies and python script installed automatically.

Platform
========
Should work on any platform, UNIX, Windows, etc

Dependencies
============
* ncclient - Netconf interface to Juniper devices.
* PyYaml - YAML parsers for python.
* getpass - used to obsecure password prompt.


Configuration
=============
Ensure you have a proper config.yaml file in your current directory as the script looks for it
realitive to your current directory.

Configuration file is in YAML format and is divided into zones, below is an example.

Sample config.yaml
[root@localhost junos-multi-command]# more config.yaml
firewalls:
- 172.16.50.200
- 172.16.50.201

routers:
- 172.16.50.200

Usage
=====
[root@localhost junos-multi-command]# ./junos-multi-command.py -h
usage: junos-multi-command.py [-h] -z ZONE -c COMMAND [-o OUTPUT]

Run a command on many Juniper Junos OS devices via Netconf.

optional arguments:
-h, --help show this help message and exit
-z ZONE, --zone ZONE category of network devices to run command against.
-c COMMAND, --command COMMAND
command in quotes.
-o OUTPUT, --output OUTPUT
file to output results.

i.e. junos-multi-command.py --zone firewalls --command "show chassis hardware"

Example of Command
==================
[root@localhost junos-multi-command]# ./junos-multi-command.py -z firewalls -c "show chassis hardware"

Using YAML Key: firewalls
Executing Command: show chassis hardware

Enter your network username: root
Password:



>>>>>>>>>> 172.16.50.200 Start <<<<<<<<<
Hardware inventory:
Item Version Part number Serial number Description
Chassis 9c28b76d076d JUNOSV-FIREFLY
Midplane
System IO
Routing Engine JUNOSV-FIREFLY RE
FPC 0 Virtual FPC
PIC 0 Virtual GE
Power Supply 0
>>>>>>>>>> 172.16.50.200 End <<<<<<<<<

>>>>>>>>>> 172.16.50.201 Start <<<<<<<<<
Hardware inventory:
Item Version Part number Serial number Description
Chassis 2bdc25efad71 JUNOSV-FIREFLY
Midplane
System IO
Routing Engine JUNOSV-FIREFLY RE
FPC 0 Virtual FPC
PIC 0 Virtual GE
Power Supply 0
>>>>>>>>>> 172.16.50.201 End <<<<<<<<<

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

junos-multi-command-1.0.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file junos-multi-command-1.0.tar.gz.

File metadata

File hashes

Hashes for junos-multi-command-1.0.tar.gz
Algorithm Hash digest
SHA256 31fa609edf48bfc195a476d3511a1af9b2b035aa7978a8cbf8cbe42a5b9757a6
MD5 c8d7e3e5b04a5731ed5b1b1c4c4df547
BLAKE2b-256 bf05f43150b2d8c6289047649cd2cf1c07bf216c4012f4b9c30122d7de194a53

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page