Forum Discussion
Brian_Herr_1028
Nimbostratus
Dec 07, 2004Perl: How to get the values of enumerated types
It seems that any enumerated value queried using SOAP::Lite and iControlTypeCast.pm (from the SDK) returns the value of 1.
I'm not able to get any value other than 1 from LocalLB/PoolMember functions like object_status->enabled_status or object_status->availability_status.
Here is a snippet:
$soap = SOAP::Lite
->uri('urn:iControl:LocalLB/PoolMember')
->proxy(url);
$soapResponse = $soap->get_object_status (
SOAP::Data->name(pool_names => [@pool])
);
&checkResponse($soapResponse);
my $member_object_status = $soapResponse->result;
for (my $index = 0; $index < @{$member_object_status}; $index++) {
my $member_top = $member_object_status->[$index];
print $pool[$index] . ":\n";
foreach my $member_bottom (@{$member_top}) {
print "\t" . $member_bottom->{member}->{address} . ":" .
$member_bottom->{member}->{port} . "\t" .
$member_bottom->{object_status}->{enabled_status} . "\n";
}
}
This expression always equals 1 regardless of the actual status:
$member_bottom->{object_status}->{enabled_status}
Any ideas?
- Loc_Pham_101863Historic F5 AccountIf the object is actually enabled, then the "enabled_status" will be 1. You should do a cross check via other iControl call or CLI/GUI to see if the object is really enabled or not.
- Here's the prototype for the LocalLB::PoolMember::get_object_status
struct IPPortDefinition { String address; long port }; struct ObjectStatus { AvailabilityStatus availability_status; EnabledStatus enabled_status; String status_description; }; struct MemberObjectStatus { IPPortDefinition member; ObjectStatus object_status; }; MemberObjectStatus[][] get_object_status( in String[] pool_names );
---------------------------------------------------------------- getMemberStatus ---------------------------------------------------------------- sub getMemberStatus() { my @pool_list = @_; $soapResponse = $PoolMember->get_object_status ( SOAP::Data->name(pool_names => [@pool_list]) ); &checkResponse($soapResponse); @MemberObjectStatusAofA = @{$soapResponse->result}; Loop over pools for $i ( 0 .. $MemberObjectStatusAofA ) { print "Member status for pool @pool_list[$i]\n"; Loop over pool members within the pool $MemberObjectStatusArray = $MemberObjectStatusAofA[$i]; for $j ( 0 .. ${$MemberObjectStatusArray} ) { $MemberObjectStatus = $MemberObjectStatusAofA[$i][$j]; $member = $MemberObjectStatus->{"member"}; $address = $member->{"address"}; $port = $member->{"port"}; $object_status = $MemberObjectStatus->{"object_status"}; $availability_status = $object_status->{"availability_status"}; $enabled_status = $object_status->{"enabled_status"}; $status_description = $object_status->{"status_description"}; print "\tMember: $address:$port\n"; print "\t\tavailability: $availability_status\n"; print "\t\tenabled: $enabled_status\n"; print "\t\tdescription: $status_description\n"; } } }
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