use of com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState in project photon-model by vmware.
the class AzureLoadBalancerServiceTest method testCreateLoadBalancerWithInvalidNICTarget.
@Test
public void testCreateLoadBalancerWithInvalidNICTarget() throws Throwable {
if (!this.isMock) {
LoadBalancerState loadBalancerState = createLoadBalancerState(this.loadBalancerName, LoadBalancerTargetType.INVALID);
ProvisionLoadBalancerTaskState provisionLoadBalancerTaskState = startLoadBalancerProvisioning(LoadBalancerInstanceRequest.InstanceRequestType.CREATE, loadBalancerState, TaskStage.FAILED);
assertTrue(provisionLoadBalancerTaskState.taskInfo.stage == TaskStage.FAILED);
assertEquals("java.lang.IllegalArgumentException: Invalid target type specified", provisionLoadBalancerTaskState.taskInfo.failure.message);
}
}
use of com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState in project photon-model by vmware.
the class AzureLoadBalancerServiceTest method provisionLoadBalancer.
private LoadBalancerState provisionLoadBalancer(TaskStage stage, LoadBalancerTargetType loadBalancerTargetType) throws Throwable {
LoadBalancerState loadBalancerState = createLoadBalancerState(this.loadBalancerName, loadBalancerTargetType);
startLoadBalancerProvisioning(LoadBalancerInstanceRequest.InstanceRequestType.CREATE, loadBalancerState, stage);
return getHost().getServiceState(null, LoadBalancerState.class, UriUtils.buildUri(getHost(), loadBalancerState.documentSelfLink));
}
use of com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState in project photon-model by vmware.
the class TestAWSEnumerationTask method validateLoadBalancerState.
private void validateLoadBalancerState(String lbName, String computeLink) throws Throwable {
LoadBalancerState loadBalancerState = getLoadBalancerByAWSId(this.host, lbName);
assertEquals(count1, loadBalancerState.computeLinks.size());
assertEquals(count1, loadBalancerState.securityGroupLinks.size());
assertEquals(count1, loadBalancerState.subnetLinks.size());
assertEquals(computeLink, loadBalancerState.computeLinks.iterator().next());
assertNotNull(loadBalancerState.routes);
assertEquals(count1, loadBalancerState.routes.size());
RouteConfiguration route = loadBalancerState.routes.iterator().next();
assertNotNull(route.healthCheckConfiguration);
assertEquals("80", route.port);
assertEquals("80", route.instancePort);
assertEquals("HTTP", route.instanceProtocol);
assertEquals("HTTP", route.protocol);
}
use of com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState in project photon-model by vmware.
the class AWSLoadBalancerServiceTest method createLoadBalancerState.
private LoadBalancerState createLoadBalancerState(String name) throws Throwable {
LoadBalancerState state = new LoadBalancerState();
state.name = name;
state.endpointLink = this.endpointState.documentSelfLink;
state.endpointLinks = new HashSet<String>();
state.endpointLinks.add(this.endpointState.documentSelfLink);
state.regionId = this.regionId;
state.computeLinks = Collections.singleton(this.cs1.documentSelfLink);
state.subnetLinks = new HashSet<>();
state.subnetLinks.add(createSubnetState(this.subnetId, createNetworkState(this.vpcId).documentSelfLink).documentSelfLink);
RouteConfiguration route1 = new RouteConfiguration();
route1.protocol = Protocol.HTTP.name();
route1.port = "80";
route1.instanceProtocol = Protocol.HTTP.name();
route1.instancePort = "80";
route1.healthCheckConfiguration = new HealthCheckConfiguration();
route1.healthCheckConfiguration.protocol = Protocol.HTTP.name();
route1.healthCheckConfiguration.port = "80";
route1.healthCheckConfiguration.urlPath = "/test.html";
route1.healthCheckConfiguration.intervalSeconds = 60;
route1.healthCheckConfiguration.healthyThreshold = 2;
route1.healthCheckConfiguration.unhealthyThreshold = 5;
route1.healthCheckConfiguration.timeoutSeconds = 5;
RouteConfiguration route2 = new RouteConfiguration();
route2.protocol = Protocol.HTTPS.name();
route2.port = "443";
route2.instanceProtocol = Protocol.HTTPS.name();
route2.instancePort = "443";
state.routes = Arrays.asList(route1, route2);
state.internetFacing = Boolean.TRUE;
state.instanceAdapterReference = UriUtils.buildUri(this.host, AWSLoadBalancerService.SELF_LINK);
return postServiceSynchronously(LoadBalancerService.FACTORY_LINK, state, LoadBalancerState.class);
}
use of com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState in project photon-model by vmware.
the class AzureLoadBalancerServiceTest method testCreateLoadBalancerWithComputeTarget.
@Test
public void testCreateLoadBalancerWithComputeTarget() throws Throwable {
securityGroupState = createSecurityGroupState(this.host, endpointState, this.securityGroupName, Lists.newArrayList(), Lists.newArrayList());
kickOffSecurityGroupProvision(SecurityGroupInstanceRequest.InstanceRequestType.CREATE, TaskStage.FINISHED);
LoadBalancerState loadBalancerState = provisionLoadBalancer(TaskStage.FINISHED, LoadBalancerTargetType.COMPUTE);
assertNotNull(loadBalancerState.id);
assertNotEquals(loadBalancerState.id, this.loadBalancerName);
if (!this.isMock) {
// Verify that the load balancer was created.
LoadBalancerInner lbResponse = this.loadBalancerClient.getByResourceGroup(this.rgName, this.loadBalancerName);
assertEquals(this.loadBalancerName, lbResponse.name());
assertEquals(loadBalancerState.id, lbResponse.id());
assertNotNull(loadBalancerState.address);
// delete the load balancer
startLoadBalancerProvisioning(LoadBalancerInstanceRequest.InstanceRequestType.DELETE, loadBalancerState, TaskStage.FINISHED);
}
}
Aggregations