04-Jun-2003
14:52
- last edited on
05-Jun-2023
05:54
by
JimmyPackets
such as
ITCMLocalLB.LBMethod
? Looking through the wsdl file, it would appear this is only defined
with documentation, not in anyway by which I could translate e.g.
'predictive_member' to '7'. stubmaker.pl was no help.
Thoughts?
04-Jun-2003 14:52
code would break. It would be nice if I could pick up the numbers by name (and if the code
could actually be generated from the wsdl file and by extension get that done).
I saw the code, but it seems a little hokey to have it defined in the wsdl file, on the F5 device,
etc.
Random thoughts, as usual.
04-Jun-2003
14:52
- last edited on
22-Nov-2022
16:35
by
JimmyPackets
In sdk/support/SOAP/LocalLB/LocalLBPool.pl we used a hash map to convert values to names
my $LBMethodMap =
{
0 => "Round Robin",
1 => "Ratio",
2 => "Fastest",
3 => "Least Connections",
4 => "Ratio Member",
5 => "Least Connections Member",
6 => "Observed Member",
7 => "Predictive Member",
8 => "Observed Node Address",
9 => "Predictive Node Address",
10 => "Dynamic Ratio",
};
And reference it in the code as like list
----------------------------------------------------------------------------
Get the load balancing method for the given pool
----------------------------------------------------------------------------
sub getPoolLBMethod()
{
my ($poolName) = @_;
my $lbMethod;
my $soap_response =
$soap->get_lb_method
(
SOAP::Data->name ( pool_name => $poolName )
);
if ( $soap_response->fault )
{
print $soap_response->faultcode, "\n";
print $soap_response->faultstring, "\n";
exit("");
}
else
{
$lbMethod = $soap_response->result;
}
return $LBMethodMap->{$lbMethod};
}
You could also create global variables and reference them accordingly.
my $LB_METHOD_ROUND_ROBIN = 0;
my $LB_METHOD_RATIO = 1;
my $LB_METHOD_FASTEST = 2;
my $LB_METHOD_LEAST_CONN = 3;
my $LB_METHOD_RATIO_MEMBER = 4;
my $LB_METHOD_LEAST_CONN_MEMBER = 5;
my $LB_METHOD_OBSERVED_MEMBER = 6;
my $LB_METHOD_PREDICTIVE_MEMBER = 7;
my $LB_METHOD_OBSERVED_NODE_ADDR = 8;
my $LB_METHOD_PREDICTIVE_NODE_ADDR = 9;
my $LB_METHOD_DYNAMIC_RATIO = 10;
my $soap_response =
soap->set_lb_method
(
SOAP::Data->name ( pool_name => $poolName ),
SOAP::Data->name ( lb_method => $LB_METHOD_ROUND_ROBIN)
);
-Joe
04-Jun-2003 14:52
back-forth mapping is easy to accomplish.
Thanks.