Brocade Virtual ADX XML API Programmer’s Guide (Supporting ADX v03.1.00) User Manual

Page 860

Advertising
background image

850

Brocade Virtual ADX XML API Programmer’s Guide

53-1003248-01

Example: Unbinding a real server from a VIP

B

print LOG "SOAP Response\n-------------\n" . $http_object->content . "\n";

}

}];

# Function to record the time at the start of a SOAP Request.

# Do Not Change

sub start_timer

{

#Get the Seconds and Microseconds

my ($st_sec,$st_usec) = gettimeofday();

return "$st_sec:$st_usec";

}

# Function to return the elapsed time after a SOAP Response is recieved

# Do Not Change

sub get_elapsed_time

{

my ($end_sec,$end_usec) = gettimeofday();

my $start_time = shift;

my $exec_time = "";

my ($st_sec,$st_usec) = split(/:/,$start_time);

my $total_seconds = $end_sec - $st_sec;

my $total_useconds = $end_usec - $st_usec;

my $total_mseconds = $total_useconds / 1000;

$total_mseconds =~ /(\d+)\.(\d+)/;

if ($total_seconds < 60)

{

$exec_time = "0m $total_seconds" ."s " . "$1ms";

}

else

{

my $mins = int($total_seconds / 60);

my $secs = $total_seconds % 60;

$exec_time = "$mins" . "m $secs" ."s " . "$1ms";

}

return $exec_time;

}

# Initialize the parameters that will be used in GetOptions

# Do Not Change

my $dut = ""; # When passed through command line options, overrides the DUT IP

used in the script

my $username = ""; # When passed through command line options, overrides the DUT

Username used in the script

my $password = ""; # When passed through command line options, overrides the DUT

Password used in the script

my $transport = ""; # When passed through command line options, overrides the

Transport Type (HTTP/HTTPS) used in the script

my $context = ""; # When passed through command line options, overrides the

context used in the script

# Get the command arguments and check if any of the parameters must be overridden

by user specified values

# Command Line Usage:

# perl Usecase1.pl [--dut=ADX IP] [--username=ADX Login Username]

[--password=password] [--context=Context Name] [--transport=http/https]

GetOptions (

"dut:s" => \$dut,

"username:s" => \$username,

"password:s" => \$password,

"context:s" => \$context,

"transport:s" => \$transport

);

Advertising