use of org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter in project so by onap.
the class InputParameterRetrieverTask method getInputParameters.
public void getInputParameters(final BuildingBlockExecution execution) {
try {
LOGGER.debug("Executing getInputParameters ...");
final InputParameter inputParameter = new InputParameter();
final InputParameter userParamsInputParameter = getUserParamsInputParameter(execution);
final InputParameter sdncInputParameter = getSdncInputParameter(execution);
inputParameter.putAdditionalParams(sdncInputParameter.getAdditionalParams());
inputParameter.addExtVirtualLinks(sdncInputParameter.getExtVirtualLinks());
inputParameter.putAdditionalParams(userParamsInputParameter.getAdditionalParams());
inputParameter.addExtVirtualLinks(userParamsInputParameter.getExtVirtualLinks());
LOGGER.debug("inputParameter: {}", inputParameter);
execution.setVariable(INPUT_PARAMETER, inputParameter);
LOGGER.debug("Finished executing getInputParameters ...");
} catch (final Exception exception) {
LOGGER.error("Unable to get input parameters", exception);
execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE);
}
}
use of org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter in project so by onap.
the class VnfmAdapterCreateVnfTask method buildCreateVnfRequest.
/**
* Create {@link CreateVnfRequest} object with required fields and store it in
* {@link org.camunda.bpm.engine.delegate.DelegateExecution}
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
*/
public void buildCreateVnfRequest(final BuildingBlockExecution execution) {
try {
LOGGER.debug("Executing buildCreateVnfRequest ...");
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
final CloudRegion cloudRegion = buildingBlock.getCloudRegion();
final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
final ModelInfoGenericVnf modelInfoGenericVnf = vnf.getModelInfoGenericVnf();
final InputParameter inputParameter = getInputParameter(execution);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
createVnfRequest.setName(getName(vnf.getVnfName(), modelInfoGenericVnf.getModelInstanceName()));
createVnfRequest.setTenant(getTenant(cloudRegion));
createVnfRequest.setAdditionalParams(inputParameter.getAdditionalParams());
createVnfRequest.setExternalVirtualLinks(inputParameter.getExtVirtualLinks());
LOGGER.info("CreateVnfRequest : {}", createVnfRequest);
execution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, createVnfRequest);
LOGGER.debug("Finished executing buildCreateVnfRequest ...");
} catch (final Exception exception) {
LOGGER.error("Unable to execute buildCreateVnfRequest", exception);
exceptionUtil.buildAndThrowWorkflowException(execution, 1200, exception);
}
}
use of org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter in project so by onap.
the class VnfmAdapterCreateVnfTaskTest method testBuildCreateVnfRequest_withValidValues_storesRequestInExecution.
@Test
public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
stubbedxecution.setVariable(INPUT_PARAMETER, new InputParameter(Collections.emptyMap(), Collections.emptyList()));
when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
objUnderTest.buildCreateVnfRequest(stubbedxecution);
final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
assertNotNull(actual);
assertEquals(VNF_NAME + "." + MODEL_INSTANCE_NAME, actual.getName());
final Tenant actualTenant = actual.getTenant();
assertEquals(CLOUD_OWNER, actualTenant.getCloudOwner());
assertEquals(LCP_CLOUD_REGIONID, actualTenant.getRegionName());
assertEquals(StubbedBuildingBlockExecution.getTenantId(), actualTenant.getTenantId());
}
Aggregations