use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration in project photon-model by vmware.
the class LoadBalancerDescriptionServiceTest method buildValidStartState.
public static LoadBalancerDescription buildValidStartState() {
LoadBalancerDescription state = new LoadBalancerDescription();
state.id = UUID.randomUUID().toString();
state.name = "lbName";
state.endpointLink = EndpointService.FACTORY_LINK + "/my-endpoint";
state.computeDescriptionLinks = Arrays.asList(ComputeDescriptionService.FACTORY_LINK + "/a-compute-desc");
state.networkName = "lb-net";
state.regionId = "regionId";
state.tenantLinks = new ArrayList<>();
state.tenantLinks.add("tenant-linkA");
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";
RouteConfiguration route2 = new RouteConfiguration();
route2.protocol = Protocol.HTTPS.name();
route2.port = "443";
route2.instanceProtocol = Protocol.HTTP.name();
route2.instancePort = "443";
state.routes = Arrays.asList(route1, route2);
return state;
}
use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration in project photon-model by vmware.
the class LoadBalancerService method getDocumentTemplate.
@Override
public ServiceDocument getDocumentTemplate() {
ServiceDocument td = super.getDocumentTemplate();
// enable metadata indexing
td.documentDescription.documentIndexingOptions = EnumSet.of(DocumentIndexingOption.INDEX_METADATA);
ServiceUtils.setRetentionLimit(td);
LoadBalancerState template = (LoadBalancerState) td;
template.id = UUID.randomUUID().toString();
template.descriptionLink = "lb-description-link";
template.name = "load-balancer";
template.endpointLink = UriUtils.buildUriPath(EndpointService.FACTORY_LINK, "my-endpoint");
template.internetFacing = Boolean.TRUE;
template.address = "my-address";
RouteConfiguration routeConfiguration = new RouteConfiguration();
routeConfiguration.protocol = Protocol.HTTP.name();
routeConfiguration.port = "80";
routeConfiguration.instanceProtocol = Protocol.HTTP.name();
routeConfiguration.instancePort = "80";
routeConfiguration.healthCheckConfiguration = new HealthCheckConfiguration();
routeConfiguration.healthCheckConfiguration.protocol = Protocol.HTTP.name();
routeConfiguration.healthCheckConfiguration.port = "80";
template.routes = Arrays.asList(routeConfiguration);
return template;
}
use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration in project photon-model by vmware.
the class AzureLoadBalancerServiceTest method createRouteConfiguration.
private RouteConfiguration createRouteConfiguration() {
RouteConfiguration route = new RouteConfiguration();
route.protocol = "tcp";
route.port = "80";
route.instanceProtocol = "tcp";
route.instancePort = "80";
HealthCheckConfiguration healthChkConfig = new HealthCheckConfiguration();
healthChkConfig.port = "8080";
healthChkConfig.protocol = "tcp";
healthChkConfig.intervalSeconds = 10;
healthChkConfig.urlPath = "dummyPath";
healthChkConfig.healthyThreshold = 1;
healthChkConfig.unhealthyThreshold = 2;
route.healthCheckConfiguration = healthChkConfig;
return route;
}
use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration in project photon-model by vmware.
the class AWSLoadBalancerServiceTest method verifyHealthCheckConfiguration.
private void verifyHealthCheckConfiguration(RouteConfiguration routeConfiguration, HealthCheck healthCheck) {
HealthCheckConfiguration healthCheckConfiguration = routeConfiguration.healthCheckConfiguration;
assertEquals(healthCheckConfiguration.timeoutSeconds, healthCheck.getTimeout());
assertEquals(healthCheckConfiguration.healthyThreshold, healthCheck.getHealthyThreshold());
assertEquals(healthCheckConfiguration.intervalSeconds, healthCheck.getInterval());
assertEquals(healthCheckConfiguration.unhealthyThreshold, healthCheck.getUnhealthyThreshold());
String target = healthCheckConfiguration.protocol + ":" + healthCheckConfiguration.port + healthCheckConfiguration.urlPath;
assertEquals(target, healthCheck.getTarget());
}
use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration 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);
}
Aggregations