Search in sources :

Example 11 with InstanceGroupNetwork

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);
}
Also used : InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) Test(org.junit.jupiter.api.Test)

Example 12 with InstanceGroupNetwork

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);
}
Also used : InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) Test(org.junit.jupiter.api.Test)

Example 13 with InstanceGroupNetwork

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;
}
Also used : HashMap(java.util.HashMap) Json(com.sequenceiq.cloudbreak.common.json.Json) InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork)

Example 14 with 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;
}
Also used : InstanceGroupNetwork(com.sequenceiq.freeipa.entity.InstanceGroupNetwork) HashSet(java.util.HashSet) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup)

Aggregations

InstanceGroupNetwork (com.sequenceiq.freeipa.entity.InstanceGroupNetwork)14 Json (com.sequenceiq.cloudbreak.common.json.Json)8 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)8 Test (org.junit.jupiter.api.Test)7 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 List (java.util.List)4 NetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest)2 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)2 Stack (com.sequenceiq.freeipa.entity.Stack)2 GroupNetwork (com.sequenceiq.cloudbreak.cloud.model.GroupNetwork)1 GroupSubnet (com.sequenceiq.cloudbreak.cloud.model.GroupSubnet)1 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)1 BackupRequest (com.sequenceiq.common.api.backup.request.BackupRequest)1 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)1 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)1 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)1 CloudwatchParams (com.sequenceiq.common.api.telemetry.model.CloudwatchParams)1 Features (com.sequenceiq.common.api.telemetry.model.Features)1