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());
}
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");
}
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);
}
}
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);
}
}
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);
}
}
Aggregations