A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central.
Project description
Aruba Central API CLI
A CLI app for interacting with Aruba Central Cloud Management Platform. With cross-platform / shell support. i.e. Bash, zsh, PowerShell, etc.
TODO [demo](docs/media/demo.gif)
Features
- Cross Platform Support
- Auto Completion
- Specify device, site, etc. by fuzzy match of multiple fields (i.e. name, mac, serial#, ip address)
- multiple output formats
- output to file
- multiple account support (easily switch between different central accounts)
- Batch Operation based on data from input file. i.e. Add sites in batch based on data from a csv.
Installation
Requires python3 and pip
pip3 install centralcli
You can also install in a virtual environment (venv), but you'll lose auto-completion, unless you activate the venv.
Configuration
Refer to config.yaml.example to guide in the creation of config.yaml and place in the config directory.
CentralCli will look in <Users home dir>/.config/centralcli, and <Users home dir>/.centralcli.
i.e. on Windows c:\Users\wade\.centralcli
or on Linux /home/wade/.config/centralcli
Once config.yaml
is populated per config.yaml.example, run some test commands to validate the config.
Example test command cencli show all
wade@wellswa6:~ $ cli show all
✔ Collecting Data [monitoring/v1/switches]
✔ Collecting Data [monitoring/v2/aps]
✔ Collecting Data [monitoring/v1/gateways]
name ip mac model group site serial type labels version status
----------------- --------------- ------------- -------------------- ------------- ------- ---------- ------- ----------- --------------------- --------
BR1_315_0c:88 10.101.6.200/24 --redacted-- 315 Branch1 Antigua -redacted- ap Branch View 8.7.1.1_78245 Up
IAP305 10.2.30.102 --redacted-- 305 TemplateGroup -redacted- ap 6.5.1.0-4.3.1.2_58595 Down
LABAP4 10.0.30.233/24 --redacted-- 345 WadeLab -redacted- ap 8.7.1.0_77203 Down
sw-zippity --redacted-- J9773A WadeLab -redacted- SW 16.10.000x Down
sw-ConsolePi-dev 10.0.10.154 --redacted-- Aruba2930F-(JL258A) WadeLab WadeLab -redacted- SW 16.10.0011 Down
2930F-Branch1 10.101.5.4 --redacted-- Aruba2930F-(JL258A) Branch1 Antigua -redacted- SW Branch View 16.10.0007 Up
6200F-Bot 10.0.40.16 --redacted-- 6200F 48G-(JL728A) WadeLab WadeLab -redacted- CX 10.06.0010 Up
SDBranch1:7008 192.168.240.101 --redacted-- A7008 Branch1 Antigua -redacted- gateway Branch View 8.5.0.0-2.0.0.6_76205 Up
VPNC1 192.168.30.201 --redacted-- A7005 WadeLab WadeLab -redacted- gateway Branch View 8.6.0.4-2.2.0.3_77966 Up
VPNC2 192.168.30.202 --redacted-- A7005 WadeLab WadeLab -redacted- gateway Branch View 8.6.0.4-2.2.0.3_77966 Up
...
Use cencli --help to become familiar with the command options.
NOTE: Aruba Central API CLI is still evolving. Structure and the format of outputs are likely to change over time.
Auto Completion
The CLI supports auto-completion. To configure auto-completion run cencli --install-completion
. This will auto-detect the type of shell you are running in, and install the necessary completion into your profile. You'll need to exit the shell and start a new session for it to take effect.
Usage Notes:
Caching & Friendly identifiers
-
Caching: The CLI caches information on all devices, sites, groups, and templates in Central. It's a minimal amount per device, and is done to allow human friendly identifiers. The API typically accepts serial #, site id, etc. This function allows you to specify a dev for example by name, IP, mac (any format), and serial. The lookup sequence for a device:
- Exact Match of any of the identifier fields (name, ip, mac, serial)
- case insensitive match
- case insensitive match disregarding all hyphens and underscores (in case you type 6200f_bot and the device name is 6200F-Bot)
- Case insensitive Fuzzy match with implied wild-card, otherwise match any devices that start with the identifier provided.
cencli show switches 6200F
will result in a match of6200F-Bot
.
If there is no match found, a cache update is triggered in most scenarios, and the match rules are re-tried. The cache is also updated every 3 hours (if you run a command and it's older than 3 hours, it will update the cache first). This update 3 hour update will be removed in a future release once auto-update/retry is implemented for all identifier types (groups, and templates currently lack the update/retry bit)
-
Caching works in a similar manner for groups, templates, and sites. Sites can match on name and nearly any address field. So if you only had one site in San Antonio you could specify that site with
show sites 'San Antonio'
<-- Note the use of quotes because there is a space in the name. -
Multiple Matches: It's possible to specify an identifier that returns multiple matches (if drops all the way down to the Fuzzy match/implied trailing wild-card). If that occurs you are prompted to select the intended device from a list of the matches.
Output Formats
There are a number of output formats available. Most commands default to what is likely the easiest to view given the number of fields. Otherwise longer outputs are typically displayed vertically by default. If the output can reasonably fit, it's displayed in tabular format horizontally.
You can specify the output format with command line flags --json
, --yaml
, --csv
, --rich
rich is tabular format with folding (multi line within the same row) and truncating.
Most outputs will evolve to support an output with the most commonly desired fields by default and expanded vertical output via the
-v
option (not implemented yet.)
File Output
Just use --out <filename> (or <path\filename>), and specify the desired format.
CLI Tree
Use --help
, which you can do at any level. cli --help
, cli do --help
etc. A Tree will be documented here once it's built out more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file centralcli-0.4a19.tar.gz
.
File metadata
- Download URL: centralcli-0.4a19.tar.gz
- Upload date:
- Size: 120.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f81d1f8485c19517d39f54b8fc4d01ac6922050c608aed5235cd7296d038885 |
|
MD5 | 08b3f907016687196bcc15bb308e964e |
|
BLAKE2b-256 | ba31eb3b1367164f7a162ef89a2c3fbb7d1174b3ae058ffc09f773601413254f |
File details
Details for the file centralcli-0.4a19-py3-none-any.whl
.
File metadata
- Download URL: centralcli-0.4a19-py3-none-any.whl
- Upload date:
- Size: 131.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.72-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 141f461712078d0b39627d0d903e33e3b3003cd4608b8466799d20d919baedcc |
|
MD5 | 09cd6a1f786919c92a842e3614f258b5 |
|
BLAKE2b-256 | d9f5f19c57cc19f71f959d2e19ea99d2c3d7bd7a20b7cab8108bddb277d16c60 |