Forum Discussion
Greg_Denton_338
Sep 23, 2011Nimbostratus
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 ...
John_Gruber_432
Sep 23, 2011Historic 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);
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects