Retrieve platform version using iControl Proxy (Perl code sample)

Problem this snippet solves:

This Perl client code sample uses the iControl Proxy to retrieve the platform version for each device managed by the referenced Enterprise Manager.

Code :

# Query devices from EM.
$resp = $soap->uri('urn:iControl:Management/EM')->get_devices();

# Get the device list.
my $device_list = $resp->result;

# Get a context ID.
$resp = $soap->uri("urn:iControl:Management/EM")->get_context_id();
my $context_id = $resp->result;

# Append context ID to SOAP URI.
$proxy_uri = sprintf("%s?context_id=%s", $proxy_uri, $context_id);
$soap = SOAP::Lite->proxy($proxy_uri);

# Iterate through the device list.
foreach (@{$device_list}) {

    # Get current device address.
    my $device = $_;

    # Set device context.
    $resp = $soap->uri("urn:iControl:Management/EM")->
        set_device_context(SOAP::Data->name("ip_address" => $device));

    # Get platform version from device.
    $resp = $soap->uri("urn:iControl:System/SystemInfo")->get_version();
}
Published Mar 08, 2015
Version 1.0
No CommentsBe the first to comment