Forum Discussion

Mike_MacLynn_61's avatar
Mike_MacLynn_61
Icon for Nimbostratus rankNimbostratus
Feb 15, 2012

Parameters for LocalLB.VirtualServer.create

Hi,

 

 

I'm using Java and Apache Axis to invoke LocalLBVirtualServer.create(). The method description states

 

 

"Takes additional, optional parameters, that enable you to override the default optional values."

 

 

Is it possible to tell from the API documentation which parameters are optional and which are mandatory?

 

 

Also, for the 3rd parameter VirtualServerResource[] resources, I find that if I don't specify this (pass a null in the 3rd position) then the API call succeeds but no virtual server is shown when I run "list ltm virtual" on the command line interface. When I do specify parameter "resources" the API succeeds and I can see the new virtual server is created.

 

 

If resources is mandator I'd expect the API to fail with an error if it is omitted.

 

 

thanks,

 

 

Mike.

 

 

3 Replies

  • Mike. sorry for the confusion. On most of our methods that take arrays, we expect you to pass equal size arrays for all the parameters. For the VirtualServer's create method, it looks like this:

     

     

     LocalLB::VirtualServer::create(
        in Common::VirtualServerDefinition [] definitions,
        in String [] wildmasks,
        in LocalLB::VirtualServer::VirtualServerResource [] resources,
        in LocalLB::VirtualServer::VirtualServerProfile [] [] profiles
    );

     

     

    Each of the parameters take an array of values, the first dimension for each virtual server. In the case of the the "profiles" parameter, it is a 2-D array. The first dimension for the virtual, and the second for a list of profiles for that given virtual.

     

     

    The server code loops through the parameters but assumes that you are passing in an equal array size for each of them. For instance, if you passed in more wildmasks than you did definitions, it would ignore the extra wildmasks. The code essentially takes the value of the lowest size of the parameters and ignores the rest. When you pass in a null value (array size 0) for the resources value, the server code is treating this like a no-op procedure.

     

     

    To get this to work, you must supply the four parameters. I believe the "optional" section in the documentation is referring to the profiles parameter where you can choose to supply, or not, additional profiles for the virtual you are creating.

     

     

    Here's an example I wrote a while back that uses PowerShell to create a virtual server.

     

     

    http://devcentral.f5.com/wiki/iControl.PsProvisionVEForLocalDev.ashx

     

     

    Hope this helps...

     

     

    -Joe

     

  • HI Joe,

     

     

    Thanks for your response and the supplied examples. It makes sense that the server side methods expect the arrays passed to be balanced. I can add code to make sure this is correct on the client side.

     

     

    Mike