Skip to content

Commit

Permalink
added single mode operations
Browse files Browse the repository at this point in the history
hellt committed Jun 7, 2021
1 parent 827ccd2 commit 1259b18
Showing 6 changed files with 178 additions and 28 deletions.
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p align=center><img src=cmdo.svg?sanitize=true/></p>
<p align=center><img src=cmdo_2.svg?sanitize=true/></p>

[![Go Report](https://img.shields.io/badge/go%20report-A%2B-blue?style=flat-square&color=00c9ff&labelColor=bec8d2)](https://goreportcard.com/report/github.com/hellt/cmdo)
[![Github all releases](https://img.shields.io/github/downloads/hellt/cmdo/total.svg?style=flat-square&color=00c9ff&labelColor=bec8d2)](https://github.com/hellt/cmdo/releases/)
[![Go Report](https://img.shields.io/badge/go%20report-A%2B-blue?style=flat-square&color=424f35&labelColor=bec8d2)](https://goreportcard.com/report/github.com/hellt/cmdo)
[![Github all releases](https://img.shields.io/github/downloads/hellt/cmdo/total.svg?style=flat-square&color=424f35&labelColor=bec8d2)](https://github.com/hellt/cmdo/releases/)
---

Commando is a tiny tool that enables users to collect command outputs from a range of networking devices defined in an inventory file.
Commando is a tiny tool that enables users to collect command outputs from a single or a multiple networking devices defined in an inventory file.

[![asciicast](https://asciinema.org/a/417792.svg)](https://asciinema.org/a/417792)

@@ -26,12 +26,27 @@ bash -c "$(curl -sL https://raw.githubusercontent.com/hellt/cmdo/master/get.sh)"
```

## Quickstart
1. Create an `inventory.yml` file with the devices information. An example [inventory.yml](inventory.yml) file lists three different platforms.
**If you want to run commands against multiple devices at once:**

1. Create an inventory file with the devices information. An example [inventory.yml](inventory.yml) file lists three different platforms.
2. Run `./cmdo -i <path to inventory>`; the tool will read the inventory file and output the results of the commands in the `./
output` directory.

## Inventory file
The inventory file schema is simple, the network devices are defined under `.devices` element with each device identified by `<device-name>`:
**If you want to run commands against a single device:**

1. Use the CLI flags to define the device and commands to send:
`-a <address>` - IP/DNS name of the device
`-k <platform>` - one of the [supported](#supported-platforms) platforms
`-u <username> -p <password>` - SSH credentials
`-c <command1 :: command2 :: commandN>` - a single or a list of `::`-delimited commands
an example command could be:
`cmdo -o stdout -a clab-scrapli-srlinux -u admin -p admin -k nokia_srlinux -c "show version :: show system aaa"`


### Running commands in bulk
As indicated in the quickstart, `commando` can run commands against many devices as opposed to the _singe-device_ operation.

For the _bulk_ mode the devices are expressed in the sort-of inventory. The inventory file schema is simple, the network devices are defined under `.devices` element with each device identified by `<device-name>`:

```yaml
devices:
@@ -57,7 +72,7 @@ devices:
- cmdN
```
`send-commands` list holds a list of commands which will be send towards a device.
`send-commands` list holds a list of commands which will be send towards a device. Check out the attached [example inventory](inventory.yml) file to a reference.

## Configuration options

@@ -66,6 +81,13 @@ devices:
* `--output | -o value` - sets the output destination. Defaults to `file` which writes the results of the commands to the per-command files. If set to `stdout`, will print the commands to the terminal.
* `--filter | -f 'pattern'` - a filter to apply to device name to select the devices to which the commands will be sent. Can be a Go regular expression.

For the single-device operation mode the following flags must be used to define a device:
* `--address | -a <ip/dns>` - address of the device
* `--platform | -k <platform>` - one of the [supported](#supported-platforms) platform names
* `--username | -u <string>` - username
* `--password | -p <string>` - password
* `--command | -c <command1 :: commandN>` - list of commands to send, can be delimited with `::` to provide a list of commands

## Supported platforms
Commando leverages [scrapligo](https://github.com/scrapli/scrapligo) project to support the major network platforms:
| Network OS | Platform name |
@@ -79,3 +101,6 @@ In addition to that list, commando has the ability to add community provided scr
| Network OS | Platform name |
| -------------- | -------------------------------------------------------------- |
| Nokia SR Linux | [`nokia_srlinux`](https://github.com/srl-labs/srlinux-scrapli) |

## Attributions
* Bullet icon is made by <a href="https://smashicons.com/" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
7 changes: 0 additions & 7 deletions cmdo.svg

This file was deleted.

Loading

0 comments on commit 1259b18

Please sign in to comment.