Forum Discussion

Greg_Denton_338's avatar
Greg_Denton_338
Icon for Nimbostratus rankNimbostratus
Sep 23, 2011

Virtual server create fails silently

iControl newbie programming in java just trying to create a virtual server. Have code that creates a pool with members just fine but next step of creating vs with the pool does not throw an exception but does not work. Looking at the UI the pool is there but not the vs.

 

 

My code looks similar to this blog post (which I found later):

 

 

 

I have tried different wildmasks, too, no luck.

 

 

iControl.CommonVirtualServerDefinition[] defs = { new iControl.CommonVirtualServerDefinition(

 

name, address, port, iControl.CommonProtocolType.PROTOCOL_TCP) };

 

String[] wildmasks = {};

 

iControl.LocalLBVirtualServerVirtualServerResource[] rscs = { new iControl.LocalLBVirtualServerVirtualServerResource(

 

iControl.LocalLBVirtualServerVirtualServerType.RESOURCE_TYPE_POOL,

 

poolname) };

 

iControl.LocalLBVirtualServerVirtualServerProfile[][] profiles = { { new iControl.LocalLBVirtualServerVirtualServerProfile(

 

iControl.LocalLBProfileContextType.PROFILE_CONTEXT_TYPE_ALL,

 

profile) } };

 

interfaces.getLocalLBVirtualServer().create(defs, wildmasks, rscs,

 

profiles);

 

 

BIG-IP: 10.1.0 Build 3402.56 Engineering Hotfix HF2

 

iControl java client: 10.2.0

 

 

Any help appreciated. Thanks.

 

  • John_Gruber_432's avatar
    John_Gruber_432
    Historic F5 Account
    Assuming you are using the axis generated jar file and that you can create a connection correctly... Here is a working example of creating a standard virtual server with no default pool and 3 profiles attached.

     
    
    iControl.LocalLBVirtualServerLocator locator = new iControl.LocalLBVirtualServerLocator();
    iControl.LocalLBVirtualServerBindingStub stub = (iControl.LocalLBVirtualServerBindingStub) locator.getLocalLBVirtualServerPort(url);
    iControl.CommonVirtualServerDefinition[] defs = new iControl.CommonVirtualServerDefinition[1];
    iControl.CommonVirtualServerDefinition def = new iControl.CommonVirtualServerDefinition();
    def.setName("testvirtualservice");
    def.setAddress("10.0.0.99");
    def.setPort(80L);
    def.setProtocol(iControl.CommonProtocolType.PROTOCOL_TCP);
    defs[0] = def;
    String[] masks = new String[1];
    masks[0] = "255.255.255.255";
    iControl.LocalLBVirtualServerVirtualServerResource[] resources = new iControl.LocalLBVirtualServerVirtualServerResource[1];
    iControl.LocalLBVirtualServerVirtualServerResource resource = new iControl.LocalLBVirtualServerVirtualServerResource();
    resource.setType(iControl.LocalLBVirtualServerVirtualServerType.RESOURCE_TYPE_POOL);
    resource.setDefault_pool_name("");
    resources[0] = resource;
    iControl.LocalLBVirtualServerVirtualServerProfile[][] profiles = new iControl.LocalLBVirtualServerVirtualServerProfile[1][3];
    
    iControl.LocalLBVirtualServerVirtualServerProfile client_l4 = new iControl.LocalLBVirtualServerVirtualServerProfile();
    client_l4.setProfile_context(iControl.LocalLBProfileContextType.PROFILE_CONTEXT_TYPE_CLIENT);
    client_l4.setProfile_name("tcp-wan-optimized");
    
    iControl.LocalLBVirtualServerVirtualServerProfile server_l4 = new iControl.LocalLBVirtualServerVirtualServerProfile();
    server_l4.setProfile_context(iControl.LocalLBProfileContextType.PROFILE_CONTEXT_TYPE_SERVER);
    server_l4.setProfile_name("tcp-lan-optimized");
    
    iControl.LocalLBVirtualServerVirtualServerProfile l7_profile = new iControl.LocalLBVirtualServerVirtualServerProfile();
    l7_profile.setProfile_context(iControl.LocalLBProfileContextType.PROFILE_CONTEXT_TYPE_ALL);
    l7_profile.setProfile_name("http");
    
    profiles[0][0] = client_l4;
    profiles[0][1] = server_l4;
    profiles[0][2] = l7_profile;
    
    stub.create(defs, masks, resources, profiles);
    
    
  • Yes, looks the same as my code. I finally got it to work, probably the wildmask and/or profile name. I had been trying different combinations, and finally hit it. Would have been nice to get an exception message :-S. Thanks.