Forum Discussion

Michel_van_der_'s avatar
Michel_van_der_
Icon for Nimbostratus rankNimbostratus
Apr 13, 2005

Compatibility issue

I'm using some perl SOAP::Lite calls, specifically

 

ITCMLocalLB:Pool:get_member_list which presumably is

 

implemented as a compatibility call. But instead of

 

getting something like:

 

 

ARRAY(0x8e86080)

 

0 ITCMCommon::IPPortDefinition=HASH(0x8eb7028)

 

'address' => '1.2.3.4'

 

'port' => 80

 

 

I get:

 

 

ARRAY(0x9557e74)

 

0 ITCMCommon::IPPortDefinition=HASH(0x9575678)

 

'address' => '-414596721'

 

'port' => 389

 

 

Note the address.

 

 

Thoughts?

3 Replies

  • Loc_Pham_101863's avatar
    Loc_Pham_101863
    Historic F5 Account
    What does your call look like? Here's some sample code that gets the pool members:

     

     

      
      .....  
      ..... set up code, also populate $sPool variable  
      .....  
      ------------------------------------------------------------------------  
       Get Member List  
      ------------------------------------------------------------------------  
      
      (@member_list) = getPoolMemberList($sPool);  
      foreach my $member (@member_list)  
      {  
      print $member->{"address"}, ":", $member->{"port"}, ", ";  
      }  
        
      ----------------------------------------------------------------------------  
       Get the list of pool members  
      ----------------------------------------------------------------------------  
      sub getPoolMemberList()  
      {  
      my ($poolName) = @_;  
      my @members;  
      my $soap_response =  
      $soap->get_member_list  
      (  
      SOAP::Data->name ( pool_name => $poolName )  
      );  
      if ( $soap_response->fault )  
      {  
      print $soap_response->faultcode, "\n";  
      print $soap_response->faultstring, "\n";  
      exit("");  
      }  
      else  
      {  
      @members = @{$soap_response->result};  
      }  
      return @members;  
      }  
        
      
  • Test case below. Call it with:

    script

    My test gear runs 9.0.5. Pointing this at a 4.6 box will dump something like this:

    Pool: GSKiisT2TST 1.2.3.4:80 5.6.7.8:80

    Pool: GSKiisT2TST-s 11.12.13.14:80 15.16.17.18:80

    The test gear:

    Pool: GSKSSOIISTest 1972258726:80 1989035942:80

    Pool: GSKSSOIISTest8080 1972258726:80 1989035942:80

     
     !/usr/bin/perl 
      
     require "dumpvar.pl"; 
     use strict; 
     use SOAP::Lite; 
      
     my ($user, $pwd); 
      
     sub SOAP::Transport::HTTP::Client::get_basic_credentials { 
         return $user => $pwd; 
     } 
      
     sub getF5Pools { 
         my $url = shift; 
         my($soap, $soapResponse, $result); 
          
         $soap = SOAP::Lite 
               ->uri('urn:iControl:ITCMLocalLB/Pool') 
               ->proxy($url) || die "Can't connect\n"; 
         $soapResponse = $soap->get_list(); 
         if ( $soapResponse->fault ) { 
             return [] if $soapResponse->faultstring =~  
               /The requested item does not exist/i; 
             return "Error getting Pools: " . 
               $soapResponse->faultcode . " " . 
               $soapResponse->faultstring; 
         } 
         return $soapResponse->result; 
     } 
      
     sub getF5PoolsMembers { 
         my $url = shift; 
         my $pools = shift; 
         my($p, $soap, $soapResponse, $r); 
         $soap = SOAP::Lite 
               ->uri('urn:iControl:ITCMLocalLB/Pool') 
               ->proxy($url) || die "Can't connect\n"; 
         $r = []; 
         for $p ( @$pools ) { 
             $soapResponse = $soap->get_member_list( 
                 SOAP::Data->name('pool_name' => $p) 
             ); 
             if ( ! $soapResponse->fault ) { 
                 push @$r, [ $p, $soapResponse->result]; 
             } 
         } 
         return $r; 
     } 
      
      
     sub main { 
         my ($ip, $url, $r, $p, $m); 
         $ip = $ARGV[0]; 
         $user = $ARGV[1]; 
         $pwd = $ARGV[2]; 
         $url = "https://$ip/iControl/iControlPortal.cgi";     
          
         $r = getF5Pools($url); 
         $r = getF5PoolsMembers($url, $r); 
         for $p ( @$r ) { 
             print "Pool: " . 
               $p->[0] . " "; 
             for $m ( @{$p->[1]} ) { 
                 print $m->{'address'} . ":" . $m->{'port'} . " ";        
             } 
             print "\n"; 
         } 
     } 
      
     main; 
      
     1; 
     
  • Looks like you found a bug in the compatility methods. In the case of these methods we aren't converting the native long value of an IPAddress into it's string representation. I'll get this logged as a bug to be corrected in the next release. In the mean time, you can work around it with the following code (assuming IPv4 addresses)

     

     

    sub getIPAddress 
     { 
       my ($ipaddr) = @_; 
       my $value = $ipaddr; 
      
        Look for a "." in the value to determine whether 
        we need to convert to a string 
       if ( $ipaddr !~ /\./) { 
         my $a = ($ipaddr >> 24) & 0x000000FF; 
         my $b = ($ipaddr >> 16) & 0x000000FF; 
         my $c = ($ipaddr >> 8 ) & 0x000000FF; 
         my $d = ($ipaddr      ) & 0x000000FF; 
         $value = "$a.$b.$c.$d"; 
       } 
       return $value; 
     }   
        
      sub main {  
          my ($ip, $url, $r, $p, $m);  
          $ip = $ARGV[0];  
          $user = $ARGV[1];  
          $pwd = $ARGV[2];  
          $url = "http://$ip/iControl/iControlPortal.cgi";      
            
          $r = getF5Pools($url);  
          $r = getF5PoolsMembers($url, $r);  
          for $p ( @$r ) {  
              print "Pool: " .  
                $p->[0] . " ";  
              for $m ( @{$p->[1]} ) {  
                  print &getIPAddress($m->{'address'}) . ":" . $m->{'port'} . " ";         
              }  
              print "\n";  
          }  
      } 

     

     

    Sorry for the inconvenence...

     

     

    -Joe