×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Complicated data structure having problem to filter fields need urgent help - Thanks

Complicated data structure having problem to filter fields need urgent help - Thanks

Complicated data structure having problem to filter fields need urgent help - Thanks

(OP)
HI,

I have to update one existing pm script with the new api. and had to print the bigip pool members in below format .

'/Common/10.116.38.51', 10.116.38.51:1935, enabled:ENABLED, availability:GREEN
'/Common/10.116.38.52', 10.116.38.52:1935, enabled:ENABLED, availability:GREEN

I have main .pm program code like below
sub locallb_get_member_v2 {
my $ENABLED_STATUS_MAP = { "ENABLED_STATUS_NONE" => "NONE", "ENABLED_STATUS_ENABLED" => "ENABLED", "ENABLED_STATUS_DISABLED" => "DISABLED", "ENABLED_STATUS_DISABLED_BY_PARENT" => "DISABLED_BY_PARENT", };
my $AVAILABILITY_STATUS_MAP = { 'AVAILABILITY_STATUS_NONE' => 'Error scenario', 'AVAILABILITY_STATUS_GREEN' => 'GREEN', 'AVAILABILITY_STATUS_YELLOW' => 'YELLOW', 'AVAILABILITY_STATUS_RED' => 'RED', 'AVAILABILITY_STATUS_BLUE' => 'BLUE', 'AVAILABILITY_STATUS_GRAY' => 'GRAY', };
my @member_lists = @{$soapResponse->result};
my @memberobjectstatus = @{$soapResponse->result};
my @status = @member_lists;
use data:dumper;

push (@status,@memberobjectstatus);
print dumper (@staus);
my %members;
foreach my $member (@status){
$members{ $status->{'address'} = $member->{'port'}};
$members{ $status}->{'enabled'} = $ENABLED_STATUS_MAP->{ $status->{'enabled_status'} } ;
$members{ $status}->{'availability'} = $AVAILABILITY_STATUS_MAP->{ $status->{'availability_status'} } ;
return \%members; }
print Dumper(@status)


Main CGI


my $membershref =
$bigip->locallb_get_member_v2( $bigip_host,
$pool );

if ( !$membershref ){
printError("Failed to find members for $pool");
}


else {

# if ( !$membershref );
print '<UL>'; # Pool Members

foreach my $member ( sort keys %{$membershref} ) {
print li(
"'$member', $membershref->{$member}->{'address'}:$membershref->{$member}->{'port'},
enabled:$membershref->{$member}->{'enabled'}, availability:$memb
ershref->{$member}->{'availability'}"
);
}
print '</UL>'; # End Pool members



IT just returns 'HASH(0xc61b00)', :, enabled:, availability:

I tried to add pint statement in the .pm file and trie dto see the object below is what I got
print dumper (@staus);
OUTPUT $VAR1 = bless( [ bless( { 'address' => '/Common/10.116.38.51', 'port' => '80' }, 'Common::AddressPort' ), bless( { 'address' => '/Common/10.116.38.52', 'port' => '80' }, 'Common::AddressPort' ) ], 'Common::AddressPort[]' ); $VAR2 = bless( [ bless( { 'availability_status' => 'AVAILABILITY_STATUS_GREEN', 'status_description' => 'Pool member is available', 'enabled_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::ObjectStatus' ), bless( { 'availability_status' => 'AVAILABILITY_STATUS_GREEN', 'status_description' => 'Pool member is available', 'enabled_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::ObjectStatus' ) ], 'LocalLB::ObjectStatus[]' );



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close