Forum Discussion

royster_128009's avatar
royster_128009
Icon for Nimbostratus rankNimbostratus
Dec 03, 2004

Previous SDKs

Hello.

 

 

I have some old code from a previous script which queries a 3DNS unit running v4.2ptf9

 

 

[...]

 

 

my $soap = SOAP::Lite

 

-> uri('urn:iControl:ITCMGlobalLB/Wideip')

 

-> readable(1)

 

-> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");

 

 

[...]

 

 

my $soap_response = $soap->get_pool_list

 

(

 

SOAP::Data->name ( wideip_name => $wip )

 

);

 

if ( $soap_response->fault ) {

 

print $soap_response->faultcode, "(faultstring) ", $soap_response->faultstring, "\n";

 

print $soap_response->faultcode, "(faultdetail) ", $soap_response->faultdetail, "\n"; }

 

 

else

 

{

 

my @pool_def_list = @{$soap_response->result};

 

foreach my $pool_def (@pool_def_list) {

 

my $poolName = $pool_def->{"name"};

 

my $poolState = $pool_def->{"state"};

 

my $stateofpool = $StateCodes->{$poolState};

 

 

[...]

 

 

which uses :

 

 

my $StateCodes =

 

{

 

0 => "UNKNOWN",

 

1 => "UP",

 

2 => "UNAVAILABLE",

 

3 => "DOWN",

 

};

 

 

which I'm sure is wrong and should be using

 

 

my $StatusCodes =

 

{

 

0 => "ENABLED",

 

1 => "DISABLED",

 

2 => "DISABLE_PARENT",

 

};

 

 

or similar

 

 

but looking at the new SDK PoolAttribute returned looks different:

 

 

====

 

 

A struct that gives a limited description of pool attributes.

 

 

name String

 

number_virtual_servers short

 

type LoadBalanceResultType

 

status EnableStatus

 

state StatColor

 

====

 

 

and similarly for get_pool_virtual_server_list

 

 

I'm sure it wasn't like this before but this was a while ago and it could just be me going mad. I don't have the SDK I used to check the return values - is there a previous one available? Can you confirm that this has changed?

 

 

many thanks

 

 

-r

 

 

 

 

  • Ahh, the beauty of perl and it's dynamic runtime really keeps you guessing doesn't it. Here's how that method works (as it has since BIG-IP v4.2 - SDK version 2.1).

     

     

     enum LoadBalanceResultType { 
       LB_RES_A = 0, 
       LB_RES_CNAME = 1 
     }; 
      
     enum EnableStatus { 
       STAT_BLUE = 0, 
       STAT_GREEN = 1, 
       STAT_YELLOW = 2, 
       STAT_RED = 3, 
       STAT_GRAY = 4, 
       STAT_PURPLE = 5, 
       STAT_ORANGE = 6, 
       STAT_WHITE = 7 
     }; 
      
     enum EnableStatus { 
       ENABLE = 0, 
       DISABLE = 1, 
       DISABLE_PARENT = 2 
     }; 
      
     struct PoolAttribute { 
       String name; 
       short number_virtual_servers; 
       LoadBalanceResultType type; 
       EnableStatus status; 
       StatColor state; 
     }; 
      
     PoolAttribute[] get_pool_list( 
         in String wideip_name 
     );

     

     

    In your code you are looking at the state member which is a StatColor enumeration. The status member is a EnableStatus enum.

     

     

    The status member will tell you whether routing to the pool is enabled or not while the state value will tell you it's current state. The color scheme is tied into the GUI's representation. Green meaning "up"; Red meaning "server not responding"; Blue meaning "Server not able to be reached"; and Yellow meaning "Server Limits Exceeded". I believe the other colors are historic and not currently supported.

     

     

    -Joe
  • thanks for the clarification. I'm upgrading the units to v4.5.11 shortly so am updating the code.

     

     

    Looking at the examples in the new SDK - particularly ~sdk/support/SOAP/perl/GlobalLB/GlobalLBWideip.pl

     

     

    which looks a lot like mine - but I'm getting the following error

     

     

    r@mutt ~/iControl => ./new.pl 10.0.1.2 443 user passwd www.test.com

     

    Pool : test_pool

     

    VS's: 1

     

    Type: 0

     

    Status: 0

     

    State: 1

     

    r@mutt ~/iControl => ./new.pl 10.0.1.2 443 user passwd www.test.com test_pool

     

    VS : 192.168.1.3:80

     

    trans : 0.0.0.0:0

     

    ratio : 1

     

    status: 0

     

    state : 0

     

    SOAP-ENV:Server SOAPException : 'CORBA Exception caught on ITCMGlobalLB::Wideip::get_pool_virtual_server_availability()!

     

    Exception Details:

     

    User exception `ITCMGlobalLB::NotExist''

     

    avail2: 0

     

     

    I think it might be related to the check_vs_dependencies => 1 since there are no dependencies for this VS?

     

     

    thanks

     

     

    -

     

    r

     

  • Does the SDK sample work and yours not? If so, please post the code that you are having problems with and I'll take a look. Usually that error message means you are passing a value in that doesn't exist on the system.

     

     

    -Joe
  • No its your code on ~sdk/support/SOAP/perl/GlobalLB/GlobalLBWideip.pl

     

     

    thanks

     

     

    -

     

    ryan

     

  • Sorry this has taken a few days to get to, My 4.x dev machine has not been behaving itself lately.

     

     

    Anyway, you found a bug in the sample code. Here's the old code

     

     

     
       ... 
       print "VS        : $source->{'addr'}:$source->{'port'}\n"; 
       print "    trans : $translated->{'addr'}:$translated->{'port'}\n"; 
       print "    ratio : $ratio\n"; 
       print "    status: $status\n"; 
       print "    state : $state\n"; 
       $soapResponse2 = $Wideip->get_pool_virtual_server_availability 
       ( 
         SOAP::Data->name(wideip_name => sWideip), 
         SOAP::Data->name(pool_name => $sPool), 
         SOAP::Data->name(vs => $source), 
         SOAP::Data->name(check_vs_dependencies => 1) 
       );

     

     

    Spot the bug? Hint, it's in the wideip_name parameter.

     

     

    Here's the corrected code.

     

     

     
       ... 
       print "VS        : $source->{'addr'}:$source->{'port'}\n"; 
       print "    trans : $translated->{'addr'}:$translated->{'port'}\n"; 
       print "    ratio : $ratio\n"; 
       print "    status: $status\n"; 
       print "    state : $state\n"; 
       $soapResponse2 = $Wideip->get_pool_virtual_server_availability 
       ( 
         SOAP::Data->name(wideip_name => $sWideip), 
         SOAP::Data->name(pool_name => $sPool), 
         SOAP::Data->name(vs => $source), 
         SOAP::Data->name(check_vs_dependencies => 1) 
       );

     

     

    Sorry for the confusion...

     

     

    -Joe