use of com.sequenceiq.freeipa.entity.InstanceGroupNetwork in project cloudbreak by hortonworks.
the class MultiAzValidatorTest method testSupportedForInstanceMetadataGenerationWhenPlatformSupportedShouldReturnTrue.
@Test
public void testSupportedForInstanceMetadataGenerationWhenPlatformSupportedShouldReturnTrue() {
InstanceGroup instanceGroup = new InstanceGroup();
InstanceGroupNetwork instanceGroupNetwork = new InstanceGroupNetwork();
instanceGroupNetwork.setCloudPlatform(CloudPlatform.AWS.name());
instanceGroup.setInstanceGroupNetwork(instanceGroupNetwork);
boolean supported = underTest.supportedForInstanceMetadataGeneration(instanceGroup);
assertEquals(true, supported);
}
use of com.sequenceiq.freeipa.entity.InstanceGroupNetwork in project cloudbreak by hortonworks.
the class MultiAzValidatorTest method testNotSupportedForInstanceMetadataGenerationWhenPlatformSupportedShouldReturnFalse.
@Test
public void testNotSupportedForInstanceMetadataGenerationWhenPlatformSupportedShouldReturnFalse() {
InstanceGroup instanceGroup = new InstanceGroup();
InstanceGroupNetwork instanceGroupNetwork = new InstanceGroupNetwork();
instanceGroupNetwork.setCloudPlatform(CloudPlatform.AZURE.name());
instanceGroup.setInstanceGroupNetwork(instanceGroupNetwork);
boolean supported = underTest.supportedForInstanceMetadataGeneration(instanceGroup);
assertEquals(false, supported);
}
use of com.sequenceiq.freeipa.entity.InstanceGroupNetwork in project cloudbreak by hortonworks.
the class MultiAzValidatorTest method instanceGroupNetwork.
private InstanceGroupNetwork instanceGroupNetwork(Set<String> subnetIds) {
InstanceGroupNetwork instanceGroupNetwork = new InstanceGroupNetwork();
Map<String, Object> map = new HashMap<>();
map.put(NetworkConstants.SUBNET_IDS, subnetIds);
instanceGroupNetwork.setAttributes(new Json(map));
return instanceGroupNetwork;
}
use of com.sequenceiq.freeipa.entity.InstanceGroupNetwork in project cloudbreak by hortonworks.
the class NetworkService method collectSubnetIdsFromStack.
private Set<String> collectSubnetIdsFromStack(Stack stack) {
Set<String> subnetIds = new HashSet<>();
for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
InstanceGroupNetwork instanceGroupNetwork = instanceGroup.getInstanceGroupNetwork();
if (instanceGroupNetwork != null && instanceGroupNetwork.getAttributes() != null) {
Map<String, Object> map = instanceGroupNetwork.getAttributes().getMap();
subnetIds.addAll((List<String>) map.getOrDefault(NetworkConstants.SUBNET_IDS, new ArrayList<>()));
}
}
return subnetIds;
}
Aggregations