Forum Discussion

lizhuh_55036's avatar
lizhuh_55036
Icon for Nimbostratus rankNimbostratus
Jun 25, 2009

virtual server set_protocol doesn't work

Hi,

 

 

From GUI, when protocol changes, the client profile changes accordingly.

 

 

However, if I do it through pyControl, no mattrer how I change the profiles first, set_protocol always fails. Does anyone know how I can change virtual server's protocol via pyControl?

 

 

Thanks.
  • From the SDK you'll see that we've got two arguments to this call:

    1) 'virtual_servers' - this tips you off that you'll be passing a list of virtual server names. Anything plural in iControl is generally wrapped in a list. So far so good...

    2) 'protocols' - another plural, so another list. But the SDK says that we need to pass in type "ProtocolType", which in this case is simply a specific string value.

    Putting it together, this works:

     
     In [5]: b.LocalLB_VirtualServer.set_protocol(virtual_servers = ['virtual_forward_test'], protocols = ['PROTOCOL_UDP']) 
     

    I successfully changed a virtual server of *All Protocols to a UDP-only VS (confirmed via the GUI). To set it back, I just passed it 'PROTOCOL_ANY' as defined in the SDK, and it worked.

    I hope this helps!

    -Matt
  • Matt,

     

     

    I know that I need to use lists. I created a virtual server with name tcpvserver. Then changed protocol to 'UDP' from GUI.

     

     

    Then I tried to do the following in a row. If I set the protocol to the current value ('udp'), it works. Which proves the synmtax I used was correct. As soon as I change it to other protocol, it fails. I ran into same issue last week. I was not able to change the protocol.

     

     

    vs.set_protocol(virtual_servers=['tcpvserver'], protocols=['PROTOCOL_UDP']) passes

     

    vs.set_protocol(virtual_servers=['tcpvserver'], protocols=['PROTOCOL_TCP']) crashes.

     

     

    vs.set_protocol(virtual_servers=['tcpvserver'], protocols=['PROTOCOL_SCTP'])

     

     

    Linda

     

  • I try to write responses in a way that may help others out as well, sorry if this was redundant information for you. Pasting code helps.

     

     

    I would turn on debugging so you can see if an error is thrown on the BigIP side - I can't replicate this (what version are you running?). Here is some info on enabling debugging on the system. Do this on a non-prod system if at all possible, as it's verbose.

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=1&postid=2695&view=topic

     

     

    -Matt