Search in sources :

Example 26 with SDNCRequest

use of org.onap.so.client.sdnc.beans.SDNCRequest in project so by onap.

the class SDNCAssignTasksTest method assignServiceInstanceTest.

@Test
public void assignServiceInstanceTest() throws Exception {
    doReturn(new GenericResourceApiServiceOperationInformation()).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext);
    sdncAssignTasks.assignServiceInstance(execution);
    verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext);
    SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
    assertEquals(SDNCTopology.SERVICE, sdncRequest.getTopology());
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 27 with SDNCRequest

use of org.onap.so.client.sdnc.beans.SDNCRequest in project so by onap.

the class SDNCRequestTasksTest method createSDNCRequest.

public SDNCRequest createSDNCRequest() {
    SDNCRequest request = new SDNCRequest();
    request.setCorrelationName("correlationName");
    request.setCorrelationValue("correlationValue");
    request.setTopology(SDNCTopology.CONFIGURATION);
    ObjectMapper mapper = new ObjectMapper();
    try {
        GenericResourceApiServiceOperationInformation sdncReq = mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNC_Client_Request.json")), GenericResourceApiServiceOperationInformation.class);
        request.setSDNCPayload(sdncReq);
    } catch (JsonParseException e) {
    } catch (JsonMappingException e) {
    } catch (IOException e) {
    }
    return request;
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 28 with SDNCRequest

use of org.onap.so.client.sdnc.beans.SDNCRequest 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 29 with SDNCRequest

use of org.onap.so.client.sdnc.beans.SDNCRequest in project so by onap.

the class SDNCHandlerTest method createSDNCRequest.

public SDNCRequest createSDNCRequest() {
    SDNCRequest request = new SDNCRequest();
    request.setCorrelationName("correlationName");
    request.setCorrelationValue("correlationValue");
    request.setTopology(SDNCTopology.CONFIGURATION);
    ObjectMapper mapper = new ObjectMapper();
    try {
        GenericResourceApiServiceOperationInformation sdncReq = mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/SDNC_Client_Request.json")), GenericResourceApiServiceOperationInformation.class);
        request.setSDNCPayload(sdncReq);
    } catch (JsonParseException e) {
    } catch (JsonMappingException e) {
    } catch (IOException e) {
    }
    return request;
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 30 with SDNCRequest

use of org.onap.so.client.sdnc.beans.SDNCRequest in project so by onap.

the class SDNCActivateTasks method activateNetwork.

/**
 * BPMN access method to perform Assign action on SDNC for L3Network
 *
 * @param execution
 * @throws BBObjectNotFoundException
 */
public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        Customer customer = gBBInput.getCustomer();
        RequestContext requestContext = gBBInput.getRequestContext();
        CloudRegion cloudRegion = gBBInput.getCloudRegion();
        GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
        SDNCRequest sdncRequest = new SDNCRequest();
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.NETWORK);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Aggregations

SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)41 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)20 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)19 Test (org.junit.Test)17 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)17 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)17 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)16 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)13 URI (java.net.URI)10 GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)10 GenericResourceApiVnfOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)10 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)10 GenericResourceApiNetworkOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation)9 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)9 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)7 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)6 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)5 JsonParseException (com.fasterxml.jackson.core.JsonParseException)2 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2