Forum Discussion

Mark_Saunders_1's avatar
Mark_Saunders_1
Icon for Altostratus rankAltostratus
Jun 24, 2016

How to alter the create_pool function to set PriorityGroup value on pool members

I am unclear on the syntax of adding "membersstate" values to the add pool function. Assistance is greatly appreciated.

 

Assume that nodes have already been created, their name is their respective IP address, and minActiveMembers=1 for the group. Assume that Member IP, Port, and PriorityGroup are passed to the create_pool function. How do I alter the create_pool function to set priorityGroup value for each pool member?

 

Code:

 

$POOL_MEMBER_STRING = "$PoolMember1:$PoolPort:$PriorityGroup1,$PoolMember2:$PoolPort:PriorityGroup2"; @POOL_MEMBERS = split(',',$POOL_MEMBER_STRING);

 

&create_node($bigip, $User, [@NODE_MEMBERS], $Ticket);

 

sub create_pool { my ($bigip, $name, $members, $lb_method, $User, $Ticket) = @_;

 

foreach $member(@$members) {
    $member = {
    ($IP,$Port,$PriorityGroup) = split(':',$member);
    $MemberPair .= "$IP:$Port,";
              };
Remove trailing comma from $MemberPair
$MemberPair =~ s/,+$//;           

$now = localtime();
 define pool properties
my %payload;
$payload{'kind'} = 'tm:ltm:pool:poolstate';
$payload{'name'} = $name;
$payload{'description'} = 'Created by: ' . $User . ' via web page on ' . $now . ' as per ' . $Ticket;
$payload{'loadBalancingMode'} = $lb_method;
$payload{'monitor'} = 'http';
$payload{'members'} = $MemberPair;
$payload{'minActiveMembers'} = '1';
my $json = encode_json \%payload;
$bigip->POST('ltm/pool', $json);
           }  End create_pool
  • I found a work-around to this with curl. I'll just call curl to make the change after the pool and nodes have been created.

     

  • I found a work-around to this with curl. I'll just call curl to make the change after the pool and nodes have been created.