You've found a difference in the enums for AvailabilityState and EnabledState.
For the
set_state() method is defined as the following:
enum EnabledState {
STATE_DISABLED = 0, // The object is disabled.
STATE_ENABLED = 1 // The object is enabled.
};
void ITCMLocalLB::Node::set_state(
in IPPortDefinition[] node_defs,
in EnabledState state
);
And for
set_availability():
enum AvailabilityState {
AVAILABILITY_UNCHECKED = 0, // The node has not been checked for availability.
AVAILABILITY_DOWN = 1, // The node is not available.
AVAILABILITY_UP = 2, // The node is available.
AVAILABILITY_CHECKING = 3, // The node is currently being checked for availability.
AVAILABILITY_FORCED_DOWN = 4, // The node has been forced down manually.
AVAILABILITY_ADDR_DOWN = 5, // The node address for a node server is down.
AVAILABILITY_UNKNOWN = 6, // An unknown, undecipherable state has been received for the node.
AVAILABILITY_MAINT = 7, // Maintenance mode.
AVAILABILITY_ENABLED = 8, // The node is enabled.
AVAILABILITY_DISABLED = 9, // The node is disabled.
AVAILABILITY_ADDR_DISABLED = 10, // The node address is disabled.
AVAILABILITY_PORT_DISABLED = 11 // The node service is disabled.
};
// Sets the availability state for the specified nodes.
//Only AVAILABILITY_UP and AVAILABILITY_DOWN should be set.
void ITCMLocalLB::Node::set_availability(
in IPPortDefinition[] node_defs,
in AvailabilityState state
);
You'll notice that the enums are different. For
set_state(), the EnabledState has valid values of
0 (STATE_DISABLED) or
1 (STATE_ENABLED), while the
set_availability() method, as stated in the documentation, only allows the values of
1 (AVAILABILITY_DOWN) or
2 (AVAILABILITY_UP).
You'll need to change your code to the following:
If intSwitch = 1 Then
state = 2 ' AVAILABILITY_UP
Else
state = 1 ' AVAILABILITY_DOWN
End If
objNode.set_availability(node_defs, state)
This was introduced in version 1.0 of the SDK and we haven't been able to change the order of the enum values due to avoiding breaking existing applications.
The error you are receiving of
InvalidArgument is actually correct for when you are passing in a value of
0 because that is an invalid argument per the documentation.
-Joe