Search in sources :

Example 1 with GenericResourceApiNetworkOperationInformation

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

the class SDNCDeactivateTasks method deactivateNetwork.

/**
 * BPMN access method to invoke deactivate on a L3Network object
 *
 * @param execution
 */
public void deactivateNetwork(BuildingBlockExecution execution) {
    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.deactivateNetwork(l3Network, serviceInstance, customer, requestContext, cloudRegion);
        SDNCRequest sdncRequest = new SDNCRequest();
        sdncRequest.setSDNCPayload(req);
        sdncRequest.setTopology(SDNCTopology.NETWORK);
        execution.setVariable(SDNC_REQUEST, sdncRequest);
    } catch (Exception ex) {
        logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", 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)

Example 2 with GenericResourceApiNetworkOperationInformation

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

the class SDNCNetworkResourcesTest method unassignNetwork_Test.

@Test
public void unassignNetwork_Test() throws Exception {
    doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
    sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
}
Also used : GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) Test(org.junit.Test)

Example 3 with GenericResourceApiNetworkOperationInformation

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

the class SDNCNetworkResourcesTest method changeAssignNetworkTest.

@Test
public void changeAssignNetworkTest() throws MapperException, BadResponseException {
    doReturn(new GenericResourceApiNetworkOperationInformation()).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
    sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion);
}
Also used : GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) Test(org.junit.Test)

Example 4 with GenericResourceApiNetworkOperationInformation

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

the class SDNCUnassignTasksTest method unassignNetworkTest.

@Test
public void unassignNetworkTest() throws Exception {
    String cloudRegionSdnc = "AAIAIC25";
    cloudRegion.setCloudRegionVersion("2.5");
    execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
    doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    assertNotEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
    sdncUnassignTasks.unassignNetwork(execution);
    verify(sdncNetworkResources, times(1)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    assertEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId());
    SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
    assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 5 with GenericResourceApiNetworkOperationInformation

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

the class SDNCAssignTasksTest method assignNetworkTest.

@Test
public void assignNetworkTest() throws Exception {
    doReturn(new GenericResourceApiNetworkOperationInformation()).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    sdncAssignTasks.assignNetwork(execution);
    verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
    SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
    assertEquals(SDNCTopology.NETWORK, sdncRequest.getTopology());
}
Also used : SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

GenericResourceApiNetworkOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation)23 Test (org.junit.Test)17 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)9 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)6 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)6 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)6 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)5 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)5 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)5 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 GeneralTopologyObjectMapper (org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper)3 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)2 Map (java.util.Map)1 GenericResourceApiNetworkinformationNetworkInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation)1 GenericResourceApiNetworkrequestinputNetworkRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput)1 GenericResourceApiParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParam)1 GenericResourceApiParamParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)1 GenericResourceApiRequestinformationRequestInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation)1 GenericResourceApiSdncrequestheaderSdncRequestHeader (org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)1