Search in sources :

Example 81 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class DelegateExecutionImplTest method getGeneralBuildingBlock.

@Test
public void getGeneralBuildingBlock() {
    final GeneralBuildingBlock gBB = mock(GeneralBuildingBlock.class);
    final Map<String, Serializable> map = new HashMap<>();
    map.put("gBBInput", gBB);
    final DelegateExecutionImpl impl = create(map);
    assertEquals(gBB, impl.getGeneralBuildingBlock());
}
Also used : Serializable(java.io.Serializable) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 82 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class BuildingBlockTestDataSetup method buildingBlockTestDataSetupBefore.

@Before
public void buildingBlockTestDataSetupBefore() {
    collectionCounter = 0;
    configurationCounter = 0;
    customerCounter = 0;
    genericVnfCounter = 0;
    instanceGroupCounter = 0;
    l3NetworkCounter = 0;
    owningEntityCounter = 0;
    pnfCounter = 0;
    projectCounter = 0;
    serviceInstanceCounter = 0;
    serviceProxyCounter = 0;
    serviceSubscriptionCounter = 0;
    vfModuleCounter = 0;
    volumeGroupCounter = 0;
    vpnBindingCounter = 0;
    vpnBondingLinkCounter = 0;
    execution = new DelegateExecutionImpl(new ExecutionImpl());
    execution.setVariable("testProcessKey", "testProcessKeyValue");
    gBBInput = new GeneralBuildingBlock();
    execution.setVariable("gBBInput", gBBInput);
    lookupKeyMap = new HashMap<ResourceKey, String>();
    execution.setVariable("lookupKeyMap", lookupKeyMap);
    ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class);
    doReturn("test").when(mockExecutionImpl).getProcessInstanceId();
    ExecutionImpl executionImpl = new ExecutionImpl();
    executionImpl.setProcessInstance(mockExecutionImpl);
    delegateExecution = (DelegateExecution) executionImpl;
    delegateExecution.setVariable("testProcessKey", "testProcessKeyValue");
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Before(org.junit.Before)

Example 83 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class CreateVFModule method createInventoryVariable.

public void createInventoryVariable(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        CloudInformation cloudInformation = new CloudInformation();
        cloudInformation.setOwner(gBBInput.getCloudRegion().getCloudOwner());
        cloudInformation.setRegionId(gBBInput.getCloudRegion().getLcpCloudRegionId());
        String tenantId = gBBInput.getTenant().getTenantId();
        if (tenantId == null) {
            tenantId = gBBInput.getCloudRegion().getTenantId();
        }
        cloudInformation.setTenantId(tenantId);
        cloudInformation.setTenantName(gBBInput.getTenant().getTenantName());
        cloudInformation.setTenantContext(gBBInput.getTenant().getTenantContext());
        cloudInformation.setTemplateInstanceId(execution.getVariable("heatStackId"));
        cloudInformation.setNodeType(getNodeType(gBBInput.getCloudRegion()));
        cloudInformation.setVnfName(vnf.getVnfName());
        cloudInformation.setVnfId(vnf.getVnfId());
        cloudInformation.setVfModuleId(vfModule.getVfModuleId());
        execution.setVariable("cloudInformation", cloudInformation);
    } catch (Exception e) {
        logger.error("Error building CloudInformation Object for NC Inventory", e);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
    }
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) CloudInformation(org.onap.so.cloud.resource.beans.CloudInformation) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 84 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock 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)

Example 85 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class SDNCChangeAssignTasks method changeAssignNetwork.

public void changeAssignNetwork(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
        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) SDNCRequest(org.onap.so.client.sdnc.beans.SDNCRequest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation)

Aggregations

GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)117 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)61 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)51 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)40 Test (org.junit.Test)37 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)37 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)35 File (java.io.File)34 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)34 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)29 Service (org.onap.so.db.catalog.beans.Service)27 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)25 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)23 HashMap (java.util.HashMap)22 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)22 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)20 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)19 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)19 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)16 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)16