For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Delete Device (Perl code sample)

Problem this snippet solves:

This Perl client code sample uses Enterprise Manager's device inventory to delete a list of devices managed by the referenced Enterprise Manager.

Code :

#!/usr/bin/perl

use strict;
use SOAP::Lite;

use constant MIN_ARGS => 3;
use constant USAGE => "Management_EM_delete_devices    [] ...";

#
# Parse command line arguments.
#

my $num_args = $#ARGV + 1;

if ($num_args < 3) {
    print "Usage: ", USAGE, "\n";
    exit();
}

my $em_host = $ARGV[0];
my $em_username = $ARGV[1];
my $em_password = $ARGV[2];

my @device_address_list;

for (my $count = 3; $count < $num_args; $count++) {
    push (@device_address_list, $ARGV[$count]);
}

#
# Create SOAP proxy.
#

my $soap = SOAP::Lite
    -> uri('urn:iControl:Management/EM')
-> proxy("https://$em_username:$em_password\@$em_host/iControl/iControlPortal.cgi");

#
# Delete devices.
#

my $soap_response = $soap->delete_devices
    (
        SOAP::Data->name(devices => [@device_address_list])
    );

if ( $soap_response->fault )
{
    print $soap_response->faultcode, " ", $soap_response->faultstring, "\n";
    exit();
}

print "Device(s) deleted\n";
Published Mar 08, 2015
Version 1.0
No CommentsBe the first to comment