CLI Guide

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 Table 1. 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;
# Generate the login hash used to authenticate the user. The username
# and password are hard coded here to illustrate the requirements for the string.
# The user name and password must be joined with an underscore.
my $auth_data = "username_password";
my $sha256_hash = sha256_hex( $auth_data );
# Create a user agent for sending https requests and generate a request object.
$user_agent = LWP::UserAgent->new( );
$url = 'https://IP-address/api/login/' . $sha256_hash;
$request = HTTP::Request->new( GET => $url );
# Send the request object to the system. The response will be returned.
$response = $user_agent->request($request);
12
Using the CLI