For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Anthony_Gerace_'s avatar
Anthony_Gerace_
Historic F5 Account
Feb 22, 2006

Unable to find string

Hi,

I'm trying to create a script that will search a class for a given string. No matter what I try I get the string cannot be found. Any suggestions?

Thanks.

Anthony

Here is the basic script and class

class cookieclass {

"172.25.254.220:80-101 test-pool2"

"192.168.254.220:80-101 test-pool"

"192.168.255.220:80-101 test-pool"

}

!c:/perl/bin
 Perl Modules used
 use SOAP::Lite + trace => qw(method debug);
 use SOAP::Lite;
 use locale;
-----------------------------------------------------------------------------
 Validate Arguments
----------------------------------------------------------------------------
$user   = "admin";
$pass   = $ARGV[0];
$cName  = "cookieclass";
$sHost  = "192.168.255.251";
$cRecord = "192.168.255.220:80-101 test-pool";
-----------------------------------------------------------------------------
 Main
-----------------------------------------------------------------------------
  $soap = SOAP::Lite
        -> uri('urn:iControl:LocalLB/Class' )
        -> proxy("https://$sHost/iControl/iControlPortal.cgi");
  push @entry, $cRecord;
  $stringClass->{name} = $cName;
  $stringClass->{members} = @entry;
  $soap_response = $soap->find_string_class_member(SOAP::Data->name(class_members => [$stringClass]) );
    if ( $soap_response->fault) {
      print "\n Error: ", $soap_response->faultcode, ", ", $soap_response->faultstring, "\n";
    }
    else {
      @cr = @{$soap_response->result};
      @c = $cr[$cName];
      $v = $c[$cRecord];
      if ($v) {
        print "Found!\n";
      }
      else {
        print "Not Found \n";
      }
    }