CLI Guide

Table Of Contents
Using CLI interactively
The CLI is an interactive application. When you are logged into the CLI, the CLI waits for a command and then responds to the
command.
NOTE: In the interactive mode, confirmation is required for commands that can cause data unavailability or data loss.
The following example shows interactively starting an SSH session, logging into the CLI, running a command, and exiting the
CLI:
$: ssh manage@IP-address
Password:
Product name
System Name: Name
System Location: Location
Version: firmware version
# show controller-date
Controller Date: 2019-09-30 11:05:12
Time Zone Offset: -07:00
Success: Command completed successfully. (2019-09-30 11:05:12)
# exit
Using a script to access the CLI
Basic command-line semantics provide prompts for user input, and response time is indeterminate. Scripts need to use an
expect-type mechanism to scan output for prompts. It is recommended and more efficient to use the HTTP interface to
access the API.
Two login methods are supported:
HTTPS authentication using an SHA256 hash to return a session key that is sent for each request. The session key is valid
has a 30-minute inactivity timeout. Use of SHA256 is now recommended instead of MD5, which is deprecated.
To log in to the HTTPS API, the username and password must be joined with an underscore as a separator
(username_password). The username and password is then sent through an SHA256 hash. The SHA256 hash is
represented in lower case hexadecimal format. This string is appended to the login function for the API, https://IP-
address/api/login/hash. For example:
https://10.0.0.2/api/login/539e12f63b693a9970a97b885e857f8b
HTTPS basic authentication using the Authorization header. If this login method is used, the username and password
must be joined with a : (username:password) and then encoded in Base64. For example:
Authorization: Basic base64-string
Use the following URL for basic authentication:
https://IP-address/api/login
For both methods, the response that is returned is in XML and the content contains an OBJECT element. Within the OBJECT
element, a PROPERTY element with the name attribute of response contains the session key. These XML API elements are
described in XML API elements on page 14.
The following example shows how to construct a Perl script to communicate with the XML API using HTTPS:
NOTE:
The API provides default self-signed certificates for an HTTPS connection. To validate the certificate, download it
through a browser and then set the following environment variable to point to the certificate:
# export HTTPS_CA_FILE=path-to-certificate
# Include required libraries
use LWP::UserAgent;
use Digest::SHA qw(sha256_hex);
use XML::LibXML;
12
Using the CLI