Search in sources :

Example 1 with EnvironmentNetworkAzureParams

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

the class AzureEnvironmentNetworkConverterTest method testGetAttributesForLegacyNetwork.

@Test
void testGetAttributesForLegacyNetwork() {
    EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
    EnvironmentNetworkAzureParams azure = mock(EnvironmentNetworkAzureParams.class);
    when(environmentNetworkResponse.getAzure()).thenReturn(azure);
    when(azure.getNetworkId()).thenReturn("my_network_id");
    when(azure.getResourceGroupName()).thenReturn("my_resource_group");
    when(azure.getNoPublicIp()).thenReturn(true);
    Map<String, Object> result = converter.getAttributesForLegacyNetwork(environmentNetworkResponse);
    assertEquals("my_network_id", result.get("networkId"));
    assertEquals("my_resource_group", result.get("resourceGroupName"));
    assertEquals(true, result.get("noPublicIp"));
}
Also used : EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) EnvironmentNetworkAzureParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams) Test(org.junit.jupiter.api.Test)

Example 2 with EnvironmentNetworkAzureParams

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

the class NetworkRequestToDtoConverterTest method createAzureParams.

private EnvironmentNetworkAzureParams createAzureParams() {
    EnvironmentNetworkAzureParams azureParams = new EnvironmentNetworkAzureParams();
    azureParams.setNetworkId(NETWORK_ID);
    azureParams.setResourceGroupName("resource-group");
    azureParams.setNoPublicIp(true);
    return azureParams;
}
Also used : EnvironmentNetworkAzureParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams)

Example 3 with EnvironmentNetworkAzureParams

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

the class AzureEnvironmentNetworkConverterTest method testConvertToLegacyNetworkWithPublicEndpointAccessGatewayEnabled.

@Test
void testConvertToLegacyNetworkWithPublicEndpointAccessGatewayEnabled() {
    EnvironmentNetworkResponse environmentNetworkResponse = mock(EnvironmentNetworkResponse.class);
    EnvironmentNetworkAzureParams azure = mock(EnvironmentNetworkAzureParams.class);
    CloudSubnet cloudSubnet = mock(CloudSubnet.class);
    when(environmentNetworkResponse.getPublicEndpointAccessGateway()).thenReturn(PublicEndpointAccessGateway.ENABLED);
    when(subnetSelector.chooseSubnet(any(), any(), any(), any())).thenReturn(Optional.of(cloudSubnet));
    when(cloudSubnet.getId()).thenReturn("my_cloud_subnet");
    when(environmentNetworkResponse.getAzure()).thenReturn(azure);
    when(azure.getNetworkId()).thenReturn("my_network_id");
    when(azure.getResourceGroupName()).thenReturn("my_resource_group");
    when(azure.getNoPublicIp()).thenReturn(true);
    Network result = converter.convertToLegacyNetwork(environmentNetworkResponse, "my-az");
    assertEquals(CloudPlatform.AZURE.toString(), result.getAttributes().getMap().get(CLOUD_PLATFORM).toString());
    assertFalse(result.getAttributes().getMap().containsKey(ENDPOINT_GATEWAY_SUBNET_ID));
}
Also used : Network(com.sequenceiq.cloudbreak.domain.Network) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) EnvironmentNetworkAzureParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams) CloudSubnet(com.sequenceiq.cloudbreak.cloud.model.CloudSubnet) Test(org.junit.jupiter.api.Test)

Example 4 with EnvironmentNetworkAzureParams

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

the class NetworkV1ToNetworkV4ConverterTest method azureEnvironmentNetwork.

private DetailedEnvironmentResponse azureEnvironmentNetwork() {
    DetailedEnvironmentResponse der = new DetailedEnvironmentResponse();
    der.setCloudPlatform("AZURE");
    EnvironmentNetworkResponse environmentNetworkResponse = new EnvironmentNetworkResponse();
    environmentNetworkResponse.setSubnetIds(SUBNET_IDS);
    environmentNetworkResponse.setPreferedSubnetId(SUBNET_ID);
    EnvironmentNetworkAzureParams environmentNetworkAzureParams = new EnvironmentNetworkAzureParams();
    environmentNetworkAzureParams.setNetworkId(VPC_ID);
    environmentNetworkAzureParams.setResourceGroupName(GROUP_NAME);
    environmentNetworkResponse.setAzure(environmentNetworkAzureParams);
    der.setNetwork(environmentNetworkResponse);
    return der;
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) EnvironmentNetworkAzureParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams)

Example 5 with EnvironmentNetworkAzureParams

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

the class AzureCloudProvider method environmentNetworkParameters.

private EnvironmentNetworkAzureParams environmentNetworkParameters() {
    EnvironmentNetworkAzureParams environmentNetworkAzureParams = new EnvironmentNetworkAzureParams();
    AzureProperties.Network network = azureProperties.getNetwork();
    environmentNetworkAzureParams.setNetworkId(network.getNetworkId());
    environmentNetworkAzureParams.setNoPublicIp(network.getNoPublicIp());
    environmentNetworkAzureParams.setResourceGroupName(network.getResourceGroupName());
    environmentNetworkAzureParams.setDatabasePrivateDnsZoneId(network.getDatabasePrivateDnsZoneId());
    return environmentNetworkAzureParams;
}
Also used : EnvironmentNetworkAzureParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams)

Aggregations

EnvironmentNetworkAzureParams (com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkAzureParams)5 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)3 Test (org.junit.jupiter.api.Test)2 CloudSubnet (com.sequenceiq.cloudbreak.cloud.model.CloudSubnet)1 Network (com.sequenceiq.cloudbreak.domain.Network)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1