Problem changing Partitions in Perl
I'm trying to list all the virtual servers in Test1. I'm trying a couple of different calls to try to get the partition (folder) to change to /Test1, but it doesn't seem to work.
The portion that retrieves the list of virtual servers does work, but only retrives the virtual servers in /Common.
Any ideas/suggestions would be greatly appreciated.
!/usr/bin/perl
use strict;
use SOAP::Lite;
use MIME::Base64;
use Data::Dumper;
my $sHost = "1.0.0.21";
my $sUID = "admin";
my $sPWD = "f5rules";
my $sProtocol = "https";
my $sPort = 443;
my $debug = 1;
SOAP Transport
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return "$sUID" => "$sPWD";
}
Subroutins
BEGIN - Sub to extract System Info
sub iSystemInfo
{
my ($SoapRequest,$soapResponse,$version);
my($iURI,$iCREQ,$iCREQVAR) = @_;
print "\n\n10-VAR Systest: $iURI - $iCREQ - $iCREQVAR\n";
$SoapRequest = SOAP::Lite
-> uri($iURI)
-> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");
$soapResponse = $SoapRequest->$iCREQ($iCREQVAR);
$SysInfo = $soapResponse->result;
print "soapResp: $soapResponse\n";
print "SYSINFO: $SysInfo\n";
return $SysInfo;
}
END - System Info Sub
BEGIN - Sub to extract System Info for Array Values
System::Session::set_active_folder
sub iSystemInfo_Array
{
my ($SoapRequest,$soapResponse,$version);
my($iURI,$iCREQ) = @_;
print "\n\n1-Array Systest: $iURI - $iCREQ\n";
$SoapRequest = SOAP::Lite
-> uri($iURI)
-> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");
$soapResponse = $SoapRequest->$iCREQ();
@SysInfo = @{$soapResponse->result};
return @SysInfo;
}
END - System Info Sub
$sHost = "1.0.0.13";
Gets partition list
$GetActPart = iSystemInfo('urn:iControl:Management/Partition',"get_active_partition", "");
$SetActPart = iSystemInfo('urn:iControl:Management/Partition',"set_active_partition", "Test1");
$GetActPartx = iSystemInfo('urn:iControl:Management/Partition',"get_active_partition", "");
$GetActPart1 = iSystemInfo('urn:iControl:System/Session',"get_active_folder", "");
$SetActPart1 = iSystemInfo('urn:iControl:System/Session',"set_active_folder", "/Test1");
$GetActPartx1 = iSystemInfo('urn:iControl:System/Session',"get_active_folder", "");
@VirtualList = iSystemInfo_Array('urn:iControl:LocalLB/VirtualServer',"get_list");
foreach (@VirtualList) { print "Virtual: $_\n"; }
print "Partition: SET:$SetActPart GET: $GetActPart GET1: $GetActPartx\n";
print "Partition1: SET:$SetActPart1 GET: $GetActPart1 GET1: $GetActPartx1\n";
*******************************
output of script:
1-Array Systest: urn:iControl:LocalLB/VirtualServer - get_list
Virtual: /Common/V_TEST_35_443
Virtual: /Common/V_TEST_30_80
Virtual: /Common/vs_1_0_0_30_53_gtm
Virtual: /Common/FWD_virtual
Virtual: /Common/V_TEST_32_80
Virtual: /Common/V_TEST_31_80
Virtual: /Common/TLS_TEST
Partition: SET: GET: Common GET1: Common
Partition1: SET: GET: /Common GET1: /Common