Skip to main content

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:

    1. Exact Match of any of the identifier fields (name, ip, mac, serial)
    2. case insensitive match
    3. case insensitive match disregarding all hyphens and underscores (in case you type 6200f_bot and the device name is 6200F-Bot)
    4. 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 of 6200F-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

centralcli-0.4a19.tar.gz (120.3 kB view hashes)

Uploaded Source

Built Distribution

centralcli-0.4a19-py3-none-any.whl (131.7 kB view hashes)

Uploaded Python 3

Supported by

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