Forum Discussion
GavinW_29074
Feb 15, 2012Nimbostratus
iApp management using iControl and Perl...
Hi there,
I'm trying to write a Perl iControl client to manage the creation/amendment of iApp application services on our v11 F5's...
Currently, I've got the following script:
!/usr/bin/perl
use Getopt::Long;
use Switch;
use SOAP::Lite;
use MIME::Base64;
use Math::BigInt;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/../lib";
use iControlTypeCast;
Disable SSL Certificate Verification
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
----------------------------------------------------------------------------
Validate Arguments
----------------------------------------------------------------------------
Define varaibles
my ($sHost, $sPort, $sUID, $sPWD, $sMode, $action, $filename );
Pickup Run-Time Options
GetOptions (
"sHost=s" => \$sHost,
"sPort:i" => \$sPort,
"sUID=s" => \$sUID,
"sPWD=s" => \$sPWD,
"$sMode:s" => \$sMode,
"action:s" => \$action,
"filename:s" => \$filename
);
Assume always HTTPS
my $sProtocol = "https";
if ( ("80" eq $sPort) or ("8080" eq $sPort) )
{
$sProtocol = "http";
}
if ( ($sHost eq "") or ($sPort eq "") or ($sUID eq "") or ($sPWD eq "") )
{
&usage();
}
sub usage()
{
my ($sCmd) = @_;
print "Usage: CertInfo.pl --sHost host --sPort port --sUID username --sPWD password --action [script action] \n";
exit();
}
----------------------------------------------------------------------------
Transport Information
----------------------------------------------------------------------------
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
return "$sUID" => "$sPWD";
}
$AppServiceHandler = SOAP::Lite
-> uri('urn:iControl:Management/ApplicationService')
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval { $Pool->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
); };
Action Code
switch ($action) {
case 'ci' { &GetCertInfo($sMode) }
case 'im' { &ImportCert($mode, $filename) }
case 'ial' { &GetiAppList }
else { print "Specified check not found ($action) \n" }
}
;
sub GetiAppList()
{
$soapResponse = $AppServiceHandler->get_list ();
&checkResponse($soapResponse);
@AppListA = @{$soapResponse->result};
print "Received Application Services list";
print Dumper(@AppListA);
foreach $AppList (@AppListA)
{
print "Application Service...";
}
}
----------------------------------------------------------------------------
checkResponse
----------------------------------------------------------------------------
sub checkResponse()
{
my ($soapResponse) = (@_);
if ( $soapResponse->fault )
{
print $soapResponse->faultcode, " ", $soapResponse->faultstring, "\n";
exit();
}
}
However all i'm getting printed out is:
D:\Workspace\F5_iControl>perl bin/f5_icontrol.pl --sHost f501 --sPort 443 --sUID xxx --sPWD xxx --a
ction ial
Received Application Services list
Any ideas where I'm going wrong?
Cheers
Gavin
- Is your question why you aren't seeing any iApp Services returned from the get_list() method? If so, it could be for a couple of reasons.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects