Hp StorageWorks 2000 Family Modular Smart Array CLI reference guide (481600-002, May 2008)
Chapter 1 Using the CLI 19
The example shows a Perl script for logging in. cLogin is called at the start of the
script to log a user into the CLI. The script uses the command-line parameters
specified as the IP address, username, and password. Once the user has been logged
in, other commands can be sent to the CLI.
The command below provides better scripting support. The first argument sets the
output format to XML, which allows easier parsing. The second argument disables
the paging mode that pauses for each full screen of command output.
The following code segment shows how to get the entire configuration information
from the CLI and print the output. The output can easily be redirected to a file for
archiving.
Using the XML API
You can set the CLI output to either console or api using the set cli-
parameters
command. When set to api, the output is returned in XML. You can
use an XML parser such
XML::Parser in Perl to process the XML output and
store this information as objects.
An updated Document Type Definition (DTD) is available with each update of the
firmware.
The XML parser should use the DTD version that corresponds to the firmware level
to ensure that the DTD is validated. By obtaining the latest DTD for validation, the
parser will be forward compatible.
$telnet->cmd("set cli-parameters api pager disabled");
@sV = $telnet->cmd("show configuration");
for ($i=0; $i<scalar(@sV); $i++)
{
print (“@sV[ $i ]”);
}