Search in sources :

Example 1 with RouteConfiguration

use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration 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 RouteConfiguration

use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration 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 RouteConfiguration

use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration 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 RouteConfiguration

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

Example 5 with RouteConfiguration

use of com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration 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

RouteConfiguration (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.RouteConfiguration)10 HealthCheckConfiguration (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription.HealthCheckConfiguration)7 LoadBalancerState (com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState)4 ProbeInner (com.microsoft.azure.management.network.implementation.ProbeInner)2 ServiceDocument (com.vmware.xenon.common.ServiceDocument)2 SubResource (com.microsoft.azure.SubResource)1 ProbeProtocol (com.microsoft.azure.management.network.ProbeProtocol)1 TransportProtocol (com.microsoft.azure.management.network.TransportProtocol)1 LoadBalancingRuleInner (com.microsoft.azure.management.network.implementation.LoadBalancingRuleInner)1 LoadBalancerDescription (com.vmware.photon.controller.model.resources.LoadBalancerDescriptionService.LoadBalancerDescription)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1