Search in sources :

Example 1 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class BpmnRequestBuilder method buildVolumeGroupDeleteRequest.

public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
    GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
    if (vnf == null) {
        throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
    }
    VolumeGroup volumeGroup = aaiDataRet.getVolumeGroup(vnfId, volumeGroupId);
    if (volumeGroup == null) {
        throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
    }
    return createServiceInstancesRequest(vnf, volumeGroup);
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) AAIEntityNotFound(org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound)

Example 2 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class BpmnRequestBuilderTest method test_buildVolumeGroupDeleteRequest.

@Test
public void test_buildVolumeGroupDeleteRequest() throws Exception {
    GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
    doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
    VolumeGroup volumeGroup = provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
    AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
    doReturn(wrapper).when(aaiResourcesClient).get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUP.getFragment("volumeGroupId")));
    ServiceInstancesRequest expectedRequest = mapper.readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
    ServiceInstancesRequest actualRequest = reqBuilder.buildVolumeGroupDeleteRequest("vnfId", "volumeGroupId");
    assertThat(actualRequest, sameBeanAs(expectedRequest));
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) File(java.io.File) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) Test(org.junit.Test)

Example 3 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class AAIDataRetrievalTest method getVolumeGroupsOfVnfTest.

@Test
public void getVolumeGroupsOfVnfTest() throws Exception {
    VolumeGroups volumeGroups = getVolumeGroups();
    AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).relatedTo(Types.VOLUME_GROUPS.getFragment());
    doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
    List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
    assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
    Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
    assertEquals(Optional.of("vg1,vg2"), volumeGroupIds);
}
Also used : AAIPluralResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) VolumeGroups(org.onap.aai.domain.yang.VolumeGroups) Test(org.junit.Test)

Example 4 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class BBInputSetupUtilsTest method getRelatedVolumeGroupFromVfModuleNotFoundTest.

@Test
public void getRelatedVolumeGroupFromVfModuleNotFoundTest() throws Exception {
    final String vnfId = "vnfId";
    final String volumeGroupId = "volumeGroupId";
    doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class), any(AAIPluralResourceUri.class));
    Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
    assertEquals(Optional.empty(), actualVolumeGroup);
}
Also used : AAIPluralResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) VolumeGroups(org.onap.aai.domain.yang.VolumeGroups) Test(org.junit.Test)

Example 5 with VolumeGroup

use of org.onap.aai.domain.yang.VolumeGroup in project so by onap.

the class BBInputSetupUtilsTest method getAAIVolumeGroupNullTest.

@Test
public void getAAIVolumeGroupNullTest() {
    VolumeGroup actualAaiVnf = bbInputSetupUtils.getAAIVolumeGroup("cloudOwnerId", "cloudRegionId", "volumeGroupId");
    assertNull(actualAaiVnf);
}
Also used : VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) Test(org.junit.Test)

Aggregations

VolumeGroup (org.onap.aai.domain.yang.VolumeGroup)30 Test (org.junit.Test)25 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)16 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 ArrayList (java.util.ArrayList)11 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)11 List (java.util.List)10 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)10 RelationshipList (org.onap.aai.domain.yang.RelationshipList)10 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)10 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)10 VfModule (org.onap.aai.domain.yang.VfModule)8 VolumeGroups (org.onap.aai.domain.yang.VolumeGroups)8 GenericVnf (org.onap.aai.domain.yang.GenericVnf)6 AAIPluralResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri)6 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)6 HeatEnvironment (org.onap.so.db.catalog.beans.HeatEnvironment)5 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)5 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)4 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)3