Search in sources :

Example 1 with InputParameter

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);
    }
}
Also used : InputParameter(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter) NullInputParameter(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 2 with InputParameter

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);
    }
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) CreateVnfRequest(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest) InputParameter(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter) NullInputParameter(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter)

Example 3 with InputParameter

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());
}
Also used : Tenant(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant) CreateVnfRequest(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest) InputParameter(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

InputParameter (org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter)3 CreateVnfRequest (org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest)2 NullInputParameter (org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter)2 Test (org.junit.Test)1 Tenant (org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant)1 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)1 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)1 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)1 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)1 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)1 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)1