Search in sources :

Example 1 with GenericResourceApiVfModuleOperationInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.

the class SDNCActivateTasks method activateVfModule.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for activate the activateVfModule.
 *
 * @param execution
 */
public void activateVfModule(BuildingBlockExecution execution) {
    GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
    RequestContext requestContext = gBBInput.getRequestContext();
    ServiceInstance serviceInstance = null;
    GenericVnf vnf = null;
    VfModule vfModule = null;
    try {
        serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        Customer customer = gBBInput.getCustomer();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Example 2 with GenericResourceApiVfModuleOperationInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.

the class SDNCChangeAssignTasks method changeAssignModelVfModule.

public void changeAssignModelVfModule(BuildingBlockExecution execution) throws Exception {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        RequestContext requestContext = gBBInput.getRequestContext();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        Customer customer = gBBInput.getCustomer();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Example 3 with GenericResourceApiVfModuleOperationInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.

the class SDNCUnassignTasks method unassignVfModule.

/**
 * This method is used to prepare a SDNC request and set it to the execution Object.
 *
 * Which is used for unassign the VfModule.
 *
 * @param execution
 */
public void unassignVfModule(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        RequestContext requestContext = gBBInput.getRequestContext();
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, buildCallbackURI(sdncRequest));
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.VFMODULE);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Example 4 with GenericResourceApiVfModuleOperationInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.

the class SDNCAssignTasksTest method assignVfModuleTest.

@Test
public void assignVfModuleTest() throws Exception {
    doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).assignVfModule(eq(vfModule), eq(volumeGroup), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
    sdncAssignTasks.assignVfModule(execution);
    verify(sdncVfModuleResources, times(1)).assignVfModule(eq(vfModule), eq(volumeGroup), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
    SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
    assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) URI(java.net.URI) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 5 with GenericResourceApiVfModuleOperationInformation

use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.

the class VfModuleTopologyOperationRequestMapperTest method unassignGenericResourceApiVfModuleInformationNullMsoReqIdTest.

@Test
public void unassignGenericResourceApiVfModuleInformationNullMsoReqIdTest() throws Exception {
    // prepare and set service instance
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    // prepare and set vnf instance
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("testVnfId");
    vnf.setVnfType("testVnfType");
    // prepare and set vf module instance
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("testVfModuleId");
    vfModule.setVfModuleName("testVfModuleName");
    RequestContext requestContext = new RequestContext();
    GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null, new URI("http://localhost:8080"));
    assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId());
}
Also used : ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) URI(java.net.URI) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation) Test(org.junit.Test)

Aggregations

GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)17 URI (java.net.URI)11 Test (org.junit.Test)10 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)10 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)10 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)10 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)10 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)10 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)7 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)7 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)5 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)5 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)5 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)5 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)5 HashMap (java.util.HashMap)3 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)3 RequestParameters (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayList (java.util.ArrayList)2