use of com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds in project cloudbreak by hortonworks.
the class NetworkDtoToResponseConverterTest method testConvertWithAwsParams.
@Test
void testConvertWithAwsParams() {
NetworkDto network = createNetworkDto().withAws(createAwsParams()).build();
ProvidedSubnetIds providedSubnetIds = new ProvidedSubnetIds(PREFERRED_SUBNET_ID, Set.of(PREFERRED_SUBNET_ID));
when(subnetIdProvider.subnets(network, TUNNEL, network.getCloudPlatform(), true)).thenReturn(providedSubnetIds);
EnvironmentNetworkResponse actual = underTest.convert(network, TUNNEL, true);
assertCommonFields(network, actual);
assertEquals(network.getAws().getVpcId(), actual.getAws().getVpcId());
assertNull(actual.getAzure());
assertNull(actual.getYarn());
assertNull(actual.getMock());
}
use of com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds in project cloudbreak by hortonworks.
the class NetworkDtoToResponseConverterTest method testConvertWithYarnParams.
@Test
void testConvertWithYarnParams() {
NetworkDto network = createNetworkDto().withYarn(createYarnParams()).build();
ProvidedSubnetIds providedSubnetIds = new ProvidedSubnetIds(PREFERRED_SUBNET_ID, Set.of(PREFERRED_SUBNET_ID));
when(subnetIdProvider.subnets(network, TUNNEL, network.getCloudPlatform(), true)).thenReturn(providedSubnetIds);
EnvironmentNetworkResponse actual = underTest.convert(network, TUNNEL, true);
assertCommonFields(network, actual);
assertEquals(network.getYarn().getQueue(), actual.getYarn().getQueue());
assertEquals(network.getYarn().getLifetime(), actual.getYarn().getLifetime());
assertNull(actual.getAws());
assertNull(actual.getMock());
assertNull(actual.getAzure());
}
use of com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds in project cloudbreak by hortonworks.
the class NetworkDtoToResponseConverterTest method testConvertWithLoadBalancerEnabled.
@Test
void testConvertWithLoadBalancerEnabled() {
NetworkDto network = createNetworkDto().withAws(createAwsParams()).withLoadBalancerCreation(LoadBalancerCreation.ENABLED).build();
ProvidedSubnetIds providedSubnetIds = new ProvidedSubnetIds(PREFERRED_SUBNET_ID, Set.of(PREFERRED_SUBNET_ID));
when(subnetIdProvider.subnets(network, TUNNEL, network.getCloudPlatform(), true)).thenReturn(providedSubnetIds);
EnvironmentNetworkResponse actual = underTest.convert(network, TUNNEL, true);
assertEquals(network.getAws().getVpcId(), actual.getAws().getVpcId());
assertEquals(LoadBalancerCreation.ENABLED, actual.getLoadBalancerCreation());
assertNull(actual.getAzure());
assertNull(actual.getYarn());
assertNull(actual.getMock());
}
use of com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds 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;
}
use of com.sequenceiq.environment.network.service.domain.ProvidedSubnetIds in project cloudbreak by hortonworks.
the class FreeIpaAwsNetworkProvider method networkByGroup.
@Override
public InstanceGroupNetworkRequest networkByGroup(EnvironmentDto environment) {
InstanceGroupNetworkRequest instanceGroupNetworkRequest = new InstanceGroupNetworkRequest();
ProvidedSubnetIds providedSubnetIds = subnetIdProvider.subnets(environment.getNetwork(), environment.getExperimentalFeatures().getTunnel(), CloudPlatform.AWS, true);
InstanceGroupAwsNetworkParameters instanceGroupAwsNetworkParameters = new InstanceGroupAwsNetworkParameters();
instanceGroupAwsNetworkParameters.setSubnetIds(new ArrayList<>(providedSubnetIds.getSubnetIds()));
instanceGroupNetworkRequest.setAws(instanceGroupAwsNetworkParameters);
return instanceGroupNetworkRequest;
}
Aggregations