Search in sources :

Example 11 with GenericResourceApiVfModuleOperationInformation

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

the class SDNCChangeAssignTasksTest method changeAssignModelVfModuleTest.

@Test
public void changeAssignModelVfModuleTest() throws Exception {
    doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).changeAssignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
    sdncChangeAssignTasks.changeAssignModelVfModule(execution);
    verify(sdncVfModuleResources, times(1)).changeAssignVfModule(eq(vfModule), 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 12 with GenericResourceApiVfModuleOperationInformation

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

the class SDNCDeactivateTaskTest method deactivateVfModuleTest.

@Test
public void deactivateVfModuleTest() throws Exception {
    doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).deactivateVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
    sdncDeactivateTasks.deactivateVfModule(execution);
    verify(sdncVfModuleResources, times(1)).deactivateVfModule(eq(vfModule), 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 13 with GenericResourceApiVfModuleOperationInformation

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

the class SDNCUnassignTasksTest method unassignVfModuleTest.

@Test
public void unassignVfModuleTest() throws Exception {
    doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(requestContext), any(URI.class));
    sdncUnassignTasks.unassignVfModule(execution);
    verify(sdncVfModuleResources, times(1)).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), 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 14 with GenericResourceApiVfModuleOperationInformation

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

the class SDNCVfModuleResourcesTest method before.

@Before
public void before() {
    vfModule = buildVfModule();
    vnf = buildGenericVnf();
    serviceInstance = buildServiceInstance();
    volumeGroup = buildVolumeGroup();
    customer = buildCustomer();
    cloudRegion = buildCloudRegion();
    requestContext = buildRequestContext();
    sdncReq = new GenericResourceApiVfModuleOperationInformation();
    try {
        testURI = new URI("http://localhost:9800");
    } catch (URISyntaxException e) {
    }
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation) Before(org.junit.Before)

Example 15 with GenericResourceApiVfModuleOperationInformation

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

the class SDNCAssignTasks method assignVfModule.

/**
 * BPMN access method to assigning the vfModule in SDNC.
 *
 * It will assign the VfModule by the service instance id ,Vnf id and module id.
 *
 * @param execution
 */
public void assignVfModule(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        RequestContext requestContext = gBBInput.getRequestContext();
        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);
        VolumeGroup volumeGroup = null;
        try {
            volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
        } catch (BBObjectNotFoundException e) {
            logger.info("No volume group was found.");
        }
        Customer customer = gBBInput.getCustomer();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        SDNCRequest sdncRequest = new SDNCRequest();
        GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, 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", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) 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) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) 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)

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