Forum Discussion

ubermunch_12823's avatar
ubermunch_12823
Icon for Nimbostratus rankNimbostratus
Oct 15, 2004

set_availability

BIG-IP Kernel 4.6.1 Build18

I'm using the method below to set the availability(connections) of a node. It works fine for disabling connections, but when I try to enable connections I get the following exception.

An unhandled exception of type 'System.Web.Services.Protocols.SoapHeaderException' occurred in system.web.services.dll

Additional information: ITCMCommon::InvalidArgument Exception caught on ITCMLocalLB::Node::set_availability()!

I use a similar method for switching state (sessions) and that works for both enable and disable. I can see the value of state being passed into the set_availability soap method and it's coming through as 0, which should work. Anybody have a solution for enabling connections?

 
 Sub setAvailability(ByVal sHost As String, _ 
     ByVal sPwd As String, _ 
     ByVal sUser As String, _ 
     ByVal sNodeAddress As String, _ 
     ByVal sNodePort As String, _ 
     ByVal intSwitch As Integer _ 
 )  
     Dim state As Integer  
     Dim node_defs(0) As Node.ITCMCommonIPPortDefinition  
     objNode.Url = "https://" & sHost & " /iControl/iControlPortal.cgi"  
     objNode.PreAuthenticate = True  
     creds.UserName = sUser  
     creds.Password = sPwd  
     objNode.Credentials = creds  
     node_defs(0) = New Node.ITCMCommonIPPortDefinition  
     node_defs(0).address = sNodeAddress  
     node_defs(0).port = CLng(sNodePort)  
     If intSwitch = 1 Then  
         state = 1  
     Else  
         state = 0  
     End If  
     objNode.set_availability(node_defs, state)  
 End Sub

3 Replies

  • 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
  • No problem! I appreciate you posting your version and sample code on the first post. Usually it takes one or to go-arounds to get the information needed to assess the problems.

     

     

    It's usually these ones that are obvious after you look at it that take you the longest to figure out. Please don't hesitate to post questions on anything that comes up and we'll try to respond as soon as we can. Our goal is to provide 24 hour turnaround but it's usually much much quicker than that. A simple posting could save you hours of debugging...

     

     

    You are speaking directly to the horses mouth by posting on these forums as the moderators are members of our development staff who have writting the large majority of the code (both SDK and server). so we should be able to get you what you need relatively quickly.

     

     

    As an aside, we've revamped the way we use enums in 9.0. Now they are referenced as strings which makes writing code much easier than in 4.x.

     

     

    Cheers and have a great weekend!

     

     

    -Joe