Search in sources :

Example 1 with AwsNetworkParameters

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters in project cloudbreak by hortonworks.

the class DefaultInstanceGroupProviderTest method createDefaultNetworkWithAwsAttributesShouldReturnWithNetworkAttributes.

@Test
void createDefaultNetworkWithAwsAttributesShouldReturnWithNetworkAttributes() {
    Json json = new Json(Map.of(NetworkConstants.SUBNET_IDS, Set.of("id")));
    NetworkRequest network = new NetworkRequest();
    AwsNetworkParameters awsNetworkParameters = new AwsNetworkParameters();
    awsNetworkParameters.setSubnetId("id");
    network.setAws(awsNetworkParameters);
    InstanceGroupNetwork defaultNetwork = underTest.createDefaultNetwork(CloudPlatform.AWS, network);
    assertThat(defaultNetwork.getAttributes()).isEqualTo(json);
}
Also used : NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) AwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters) Json(com.sequenceiq.cloudbreak.common.json.Json) InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork) Test(org.junit.jupiter.api.Test)

Example 2 with AwsNetworkParameters

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters in project cloudbreak by hortonworks.

the class FreeIpaAwsNetworkProvider method network.

@Override
public NetworkRequest network(EnvironmentDto environment, boolean multiAzRequired) {
    NetworkDto network = environment.getNetwork();
    NetworkRequest networkRequest = new NetworkRequest();
    AwsParams awsParams = network.getAws();
    AwsNetworkParameters awsNetworkParameters = new AwsNetworkParameters();
    networkRequest.setNetworkCidrs(collectNetworkCidrs(network));
    networkRequest.setOutboundInternetTraffic(network.getOutboundInternetTraffic());
    awsNetworkParameters.setVpcId(awsParams.getVpcId());
    if (!multiAzRequired) {
        ProvidedSubnetIds providedSubnetIds = subnetIdProvider.subnets(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), CloudPlatform.AWS, multiAzRequired);
        awsNetworkParameters.setSubnetId(providedSubnetIds.getSubnetId());
    }
    networkRequest.setAws(awsNetworkParameters);
    return networkRequest;
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) ProvidedSubnetIds(com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds) InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) AwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters) AwsParams(com.sequenceiq.environment.network.dto.AwsParams)

Example 3 with AwsNetworkParameters

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters in project cloudbreak by hortonworks.

the class FreeIpaTestDto method withNetwork.

private FreeIpaTestDto withNetwork(NetworkV4TestDto network) {
    NetworkV4Request request = network.getRequest();
    NetworkRequest networkRequest = new NetworkRequest();
    if (request.getAws() != null) {
        AwsNetworkParameters params = new AwsNetworkParameters();
        if (!getCloudProvider().isMultiAZ()) {
            params.setSubnetId(request.getAws().getSubnetId());
        }
        params.setVpcId(request.getAws().getVpcId());
        networkRequest.setAws(params);
    } else if (request.getMock() != null) {
        MockNetworkParameters parameters = new MockNetworkParameters();
        parameters.setSubnetId(request.getMock().getSubnetId());
        parameters.setVpcId(request.getMock().getVpcId());
        parameters.setInternetGatewayId(request.getMock().getInternetGatewayId());
        networkRequest.setMock(parameters);
    } else if (request.getGcp() != null) {
        GcpNetworkParameters gcp = new GcpNetworkParameters();
        gcp.setNetworkId(request.getGcp().getNetworkId());
        if (!getCloudProvider().isMultiAZ()) {
            gcp.setSubnetId(request.getGcp().getSubnetId());
        }
        gcp.setNoFirewallRules(request.getGcp().getNoFirewallRules());
        gcp.setNoPublicIp(request.getGcp().getNoPublicIp());
        gcp.setSharedProjectId(request.getGcp().getSharedProjectId());
        networkRequest.setGcp(gcp);
    } else if (request.getAzure() != null) {
        AzureNetworkParameters azure = new AzureNetworkParameters();
        azure.setNetworkId(request.getAzure().getNetworkId());
        azure.setNoPublicIp(request.getAzure().getNoPublicIp());
        azure.setSubnetId(request.getAzure().getSubnetId());
        azure.setResourceGroupName(request.getAzure().getResourceGroupName());
        networkRequest.setAzure(azure);
    }
    getRequest().setNetwork(networkRequest);
    return this;
}
Also used : AzureNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AzureNetworkParameters) MockNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.MockNetworkParameters) InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) AwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters) GcpNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.GcpNetworkParameters) NetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request) InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)

Example 4 with AwsNetworkParameters

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters in project cloudbreak by hortonworks.

the class AwsCloudProvider method networkRequest.

@Override
public NetworkRequest networkRequest(FreeIpaTestDto dto) {
    NetworkRequest networkRequest = new NetworkRequest();
    AwsNetworkParameters networkParameters = new AwsNetworkParameters();
    networkParameters.setSubnetId(getSubnetId());
    networkParameters.setVpcId(getVpcId());
    networkRequest.setAws(networkParameters);
    return networkRequest;
}
Also used : NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) AwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters)

Aggregations

AwsNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters)4 NetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest)4 InstanceGroupNetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest)2 InstanceGroupAwsNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters)2 InstanceGroupNetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)1 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 AwsParams (com.sequenceiq.environment.network.dto.AwsParams)1 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)1 ProvidedSubnetIds (com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds)1 AzureNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AzureNetworkParameters)1 GcpNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.GcpNetworkParameters)1 MockNetworkParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.MockNetworkParameters)1 InstanceGroupNetwork (com.sequenceiq.freeipa.entity.InstanceGroupNetwork)1 Test (org.junit.jupiter.api.Test)1