Search in sources :

Example 6 with DeleteVolumeGroupRequest

use of org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest in project so by onap.

the class StackService method deleteVolumeGroup.

private void deleteVolumeGroup(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException {
    backout.setFalse();
    DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
    vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVolumeGroupStackId(), null, req.getMsoRequest(), new Holder<>());
    success.setTrue();
    canonicalStackId.value = req.getVolumeGroupStackId();
}
Also used : DeleteVolumeGroupRequest(org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest) StringReader(java.io.StringReader)

Example 7 with DeleteVolumeGroupRequest

use of org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest in project so by onap.

the class VnfAdapterDeleteTasks method deleteVolumeGroup.

public void deleteVolumeGroup(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
        DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
        execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
        execution.setVariable("deleteVolumeGroupRequest", "true");
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) DeleteVolumeGroupRequest(org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 8 with DeleteVolumeGroupRequest

use of org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest in project so by onap.

the class VnfAdapterDeleteTasksTest method test_deleteVolumeGroup.

@Test
public void test_deleteVolumeGroup() throws Exception {
    DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
    deleteVolumeGroupRequest.setVolumeGroupId("volumeGroupId");
    doReturn(deleteVolumeGroupRequest).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
    vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
    verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroupRequest(ArgumentMatchers.eq(requestContext), ArgumentMatchers.eq(cloudRegion), ArgumentMatchers.eq(serviceInstance), ArgumentMatchers.eq(volumeGroup));
    assertEquals(execution.getVariable("VNFREST_Request"), deleteVolumeGroupRequest.toXmlString());
}
Also used : DeleteVolumeGroupRequest(org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest) Test(org.junit.Test)

Example 9 with DeleteVolumeGroupRequest

use of org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest in project so by onap.

the class VnfAdapterObjectMapper method deleteVolumeGroupRequestMapper.

public DeleteVolumeGroupRequest deleteVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException {
    DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
    deleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    deleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
    deleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
    if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())) {
        deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
    } else {
        deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
    }
    deleteVolumeGroupRequest.setSkipAAI(true);
    deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
    String messageId = getRandomUuid();
    deleteVolumeGroupRequest.setMessageId(messageId);
    deleteVolumeGroupRequest.setNotificationUrl(createCallbackUrl("VNFAResponse", messageId));
    return deleteVolumeGroupRequest;
}
Also used : DeleteVolumeGroupRequest(org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest)

Aggregations

DeleteVolumeGroupRequest (org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest)9 Test (org.junit.Test)4 DeleteVolumeGroupResponse (org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse)3 StringReader (java.io.StringReader)2 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)2 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)2 AdapterRestClient (org.onap.so.client.adapter.rest.AdapterRestClient)2 HashMap (java.util.HashMap)1 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1 CreateNetworkRequest (org.onap.so.adapters.nwrest.CreateNetworkRequest)1 DeleteNetworkRequest (org.onap.so.adapters.nwrest.DeleteNetworkRequest)1 DeleteNetworkResponse (org.onap.so.adapters.nwrest.DeleteNetworkResponse)1 RollbackNetworkRequest (org.onap.so.adapters.nwrest.RollbackNetworkRequest)1 UpdateNetworkRequest (org.onap.so.adapters.nwrest.UpdateNetworkRequest)1 UpdateNetworkResponse (org.onap.so.adapters.nwrest.UpdateNetworkResponse)1 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)1 CreateVolumeGroupRequest (org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest)1 DeleteVfModuleRequest (org.onap.so.adapters.vnfrest.DeleteVfModuleRequest)1