Cisco-UCS
view release on metacpan or search on metacpan
DESCRIPTION
This package provides an abstracted interface to the Cisco UCS Manager
XML API and Cisco UCS Management Information Model.
The Cisco UCS Manager (UCSM) is an embedded software agent providing
access to the hardware and configuration management features of attached
Cisco UCS hardware. The Management Information Model for the UCSM is
organised into a structured heirachy of both physical and virtual
objects. Accessing objects within the heirachy is done through a number
of high level calls to heirachy search and traversal methods.
The primary aim of this package is to provide a simplified and abstract
interface to this management heirachy.
METHODS
new ( CLUSTER, PORT, PROTO, USERNAME, PASSWORD )
my $ucs = Cisco::UCS->new (
cluster => $cluster,
port => $port,
proto => $proto,
username => $username,
passwd => $passwd
);
Constructor method. Creates a new Cisco::UCS object representing a
connection to the Cisco UCSM XML API.
Parameters are:
cluster
The common name of the target cluster. This name should be resolvable
on the host from which the script is run.
username
The username to use for the connection. This username needs to have
the correct RBAC role for the operations that one intends to perform.
passwd
The plaintext password of the username specified for the username
attribute for the connection.
port
The port on which to connect to the UCSM XML API on the target
cluster. This parameter is optional and will default to 443 if not
provided.
proto
The protocol with which to connect to the UCSM XML API on the target
cluster. This value is optional hould be one of 'http' or 'https' and
will default to 'https' if not provided.
login ()
$ucs->login;
print "Authentication token is $ucs->cookie\n";
Creates a connection to the XML API interface of a USCM management
instance. If sucessful, the attributes of the UCSM management instance
are inherited by the object. Most important of these parameters is
'cookie' representing the authetication token that uniquely identifies
the connection and which is subsequently passed transparently on all
further communications.
The default time-out value for a token is 10 minutes, therefore if you
intend to create a long-running session you should periodically call
refresh.
refresh ()
$ucs->refresh;
Resets the expiry time limit of the existing authentication token to the
default timeout period of 10m. Usually not necessary for short-lived
connections.
logout ()
$ucs->logout;
Expires the current authentication token. This method should always be
called on completion of a script to expire the authentication token and
free the current session for use by others. The UCS XML API has a
maximum number of available connections, and a maximum number of
sessions per user. In order to ensure that the session remain available
(especially if using common credentials), you should always call this
method on completion of a script, as an argument to die, or in any eval
where a script may fail and exit before logging out;
cookie ()
print $ucs->cookie;
Returns the value of the authentication token.
cluster ()
print $ucs->cluster;
Returns the value of cluster as given in the constructor.
dn ()
print $ucs->dn;
Returns the distinguished name that specifies the base scope of the
Cisco::UCS object.
get_error_id ( $ID )
my %error = $ucs->get_error_id($id);
while (my($key,$value) = each %error) {
print "$key:\t$value\n";
}
This method is deprecated, please use the equivalent get_error method.
Returns a hash containing the UCSM event detail for the given error id.
This method takes a single argument; the UCSM error_id of the desired
error.
error ( $id )
my $error = $ucs->get_error($id);
print $error->id . ":" . $error->desc . "\n";
Returns a Cisco::UCS::Fault object representing the specified error.
Note that this is a caching method and will return a cached object that
( run in 1.367 second using v1.01-cache-2.11-cpan-39bf76dae61 )