Search in sources :

Example 21 with EnvironmentNetworkResponse

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.

the class LoadBalancerConfigServiceTest method createEnvironment.

private DetailedEnvironmentResponse createEnvironment(CloudSubnet subnet, boolean enableEndpointGateway, String cloudPlatform) {
    EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
    network.setSubnetMetas(Map.of("key", subnet));
    if (enableEndpointGateway) {
        network.setPublicEndpointAccessGateway(PublicEndpointAccessGateway.ENABLED);
    }
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setNetwork(network);
    environment.setCloudPlatform(cloudPlatform);
    return environment;
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)

Example 22 with EnvironmentNetworkResponse

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.

the class MultiAzCalculatorServiceTest method testPrepareSubnetAzMap.

@Test
public void testPrepareSubnetAzMap() {
    DetailedEnvironmentResponse detailedEnvironmentResponse = new DetailedEnvironmentResponse();
    EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
    environmentNetworkResponse.setSubnetMetas(Map.of(cloudSubnetName(1), cloudSubnet(1), cloudSubnetName(2), cloudSubnet(2)));
    detailedEnvironmentResponse.setNetwork(environmentNetworkResponse);
    Map<String, String> result = underTest.prepareSubnetAzMap(detailedEnvironmentResponse);
    Assertions.assertEquals(result.size(), 4);
    Assertions.assertEquals(result.get(cloudSubnetName(1)), cloudSubnetAz(1));
    Assertions.assertEquals(result.get(cloudSubnetName(2)), cloudSubnetAz(2));
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 23 with EnvironmentNetworkResponse

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.

the class MultiAzCalculatorServiceTest method testPrepareMultiAzMapWhenAvailabilityZoneNotNull.

@Test
public void testPrepareMultiAzMapWhenAvailabilityZoneNotNull() {
    DetailedEnvironmentResponse detailedEnvironmentResponse = new DetailedEnvironmentResponse();
    EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
    environmentNetworkResponse.setSubnetMetas(Map.of(cloudSubnetName(1), cloudSubnet(1), cloudSubnetName(2), cloudSubnet(2)));
    detailedEnvironmentResponse.setNetwork(environmentNetworkResponse);
    Map<String, String> actual = underTest.prepareSubnetAzMap(detailedEnvironmentResponse, "az-1");
    Assertions.assertEquals(2, actual.size());
    Assertions.assertEquals("az-1", actual.get("name-1"));
    Assertions.assertEquals("az-1", actual.get("1"));
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 24 with EnvironmentNetworkResponse

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.

the class DistroXV1RequestToStackV4RequestConverterTest method createAwsNetwork.

private EnvironmentNetworkResponse createAwsNetwork() {
    EnvironmentNetworkResponse network = new EnvironmentNetworkResponse();
    network.setAws(createAwsNetworkParams());
    network.setSubnetIds(Set.of("mysubnetid"));
    return network;
}
Also used : EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)

Example 25 with EnvironmentNetworkResponse

use of com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse in project cloudbreak by hortonworks.

the class InstanceGroupV1ToInstanceGroupV4ConverterTest method prepareEnvironment.

private DetailedEnvironmentResponse prepareEnvironment(boolean securityAccessSet, String cidr, String defaultSecurityGroupId, String securityGroupIdKnox) {
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
    environmentNetworkResponse.setSubnetIds(Set.of("aws-123"));
    environment.setNetwork(environmentNetworkResponse);
    environment.setCloudPlatform(CloudPlatform.AWS.name());
    environment.setSecurityAccess(securityAccessSet ? createSecurityAccessResponse(cidr, defaultSecurityGroupId, securityGroupIdKnox) : null);
    return environment;
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)

Aggregations

EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)70 Test (org.junit.jupiter.api.Test)40 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)27 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)24 SubnetTest (com.sequenceiq.cloudbreak.core.network.SubnetTest)22 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)8 NetworkV1Request (com.sequenceiq.distrox.api.v1.distrox.model.network.NetworkV1Request)8 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)7 Test (org.junit.Test)7 EnvironmentNetworkGcpParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkGcpParams)6 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)5 Network (com.sequenceiq.cloudbreak.domain.Network)5 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)5 ProvidedSubnetIds (com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)3 SubnetType (com.sequenceiq.cloudbreak.cloud.model.network.SubnetType)3 InstanceGroupType (com.sequenceiq.common.api.type.InstanceGroupType)3 Tunnel (com.sequenceiq.common.api.type.Tunnel)3 EnvironmentNetworkAwsParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAwsParams)3