Search in sources :

Example 1 with HealthCheckConfiguration

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;
}
Also used : HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) RouteConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration) LoadBalancerDescription(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription)

Example 2 with HealthCheckConfiguration

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;
}
Also used : HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) RouteConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration) ServiceDocument(com.vmware.xenon.common.ServiceDocument)

Example 3 with HealthCheckConfiguration

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;
}
Also used : HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) RouteConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration)

Example 4 with HealthCheckConfiguration

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());
}
Also used : HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration)

Example 5 with HealthCheckConfiguration

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);
}
Also used : HealthCheckConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration) RouteConfiguration(com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration) LoadBalancerState(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState)

Aggregations

HealthCheckConfiguration (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration)9 RouteConfiguration (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration)7 LoadBalancerState (com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState)3 LoadBalancerDescription (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription)2 AmazonElasticLoadBalancingAsyncClient (com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingAsyncClient)1 ConfigureHealthCheckRequest (com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest)1 ConfigureHealthCheckResult (com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckResult)1 CreateLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest)1 CreateLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerResult)1 DeleteLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest)1 DeleteLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerResult)1 DeregisterInstancesFromLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest)1 DeregisterInstancesFromLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerResult)1 DescribeLoadBalancersRequest (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersRequest)1 DescribeLoadBalancersResult (com.amazonaws.services.elasticloadbalancing.model.DescribeLoadBalancersResult)1 HealthCheck (com.amazonaws.services.elasticloadbalancing.model.HealthCheck)1 Instance (com.amazonaws.services.elasticloadbalancing.model.Instance)1 Listener (com.amazonaws.services.elasticloadbalancing.model.Listener)1 RegisterInstancesWithLoadBalancerRequest (com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest)1 RegisterInstancesWithLoadBalancerResult (com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult)1