[SO] CNF Updates bpm updates 21/129521/1
authorSagarS <sagar.shetty@est.tech>
Wed, 8 Jun 2022 11:52:36 +0000 (12:52 +0100)
committerSagarS <sagar.shetty@est.tech>
Wed, 8 Jun 2022 11:52:45 +0000 (12:52 +0100)
Change-Id: I3ae0e4b96ce45ebdc7daf13d6666f570e05d95c5
Signed-off-by: SagarS <sagar.shetty@est.tech>
Issue-ID: SO-3905

adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/CnfInstantiateTask.java

index 1f2e49b..dbc9deb 100644 (file)
@@ -862,7 +862,8 @@ VALUES
 ('CONFIGURATION', 'PENDING DELETE', 'DEACTIVATE', 'FAIL'),
 ('CONFIGURATION', 'PENDING ACTIVATION', 'DEACTIVATE', 'FAIL'),
 ('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL'),
-('VNF','CONFIGDEPLOYED','ACTIVATE','CONTINUE');
+('VNF','CONFIGDEPLOYED','ACTIVATE','CONTINUE'),
+('CNF','PRECREATED','ACTIVATE','CONTINUE');
 
 
 INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, ORCHESTRATION_URI, RECIPE_TIMEOUT)
index b6be771..0b24f26 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
 
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.serviceinstancebeans.RequestDetails;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+
 /**
  * This class performs CNF Instantiation
  * 
@@ -43,48 +37,22 @@ import org.springframework.stereotype.Component;
 @Component
 public class CnfInstantiateTask {
     private static final Logger LOGGER = LoggerFactory.getLogger(CnfInstantiateTask.class);
-    private final InputParametersProvider<GenericVnf> sdncInputParametersProvider;
     private final ExtractPojosForBB extractPojosForBB;
-    private final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider;
 
     @Autowired
-    public CnfInstantiateTask(final InputParametersProvider<GenericVnf> inputParametersProvider,
-            final InputParametersProvider<Map<String, Object>> userParamInputParametersProvider,
-            final ExtractPojosForBB extractPojosForBB) {
-        this.sdncInputParametersProvider = inputParametersProvider;
-        this.userParamInputParametersProvider = userParamInputParametersProvider;
+    public CnfInstantiateTask(final ExtractPojosForBB extractPojosForBB) {
         this.extractPojosForBB = extractPojosForBB;
     }
 
     public void handleCnfInstatiate(final BuildingBlockExecution execution) {
         try {
             LOGGER.debug("Executing handleCnfInstatiate  ...");
-            final InputParameter userParamsInputParameter = getUserParamsInputParameter(execution);
+            ExecuteBuildingBlock executeBuildingBlock = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+            RequestDetails requestDetails = executeBuildingBlock.getRequestDetails();
+            LOGGER.debug("RequestDetails: {}", requestDetails);
             LOGGER.debug("Finished executing handleCnfInstatiate ...");
         } catch (final Exception exception) {
-            LOGGER.error("Unable to get input parameters", exception);
-            execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE);
-        }
-    }
-
-    private InputParameter getUserParamsInputParameter(final BuildingBlockExecution execution) {
-        final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock();
-        if (generalBuildingBlock != null && generalBuildingBlock.getRequestContext() != null
-                && generalBuildingBlock.getRequestContext().getRequestParameters() != null) {
-            final List<Map<String, Object>> userParams =
-                    generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams();
-            if (userParams != null) {
-                final Map<String, Object> params = new HashMap<>();
-                userParams.stream().forEach(obj -> {
-                    params.putAll(obj);
-                });
-                LOGGER.info("User params found : {}", params);
-                if (userParams != null && !userParams.isEmpty()) {
-                    return userParamInputParametersProvider.getInputParameter(params);
-                }
-            }
+            LOGGER.error("Unable to instantiate CNF", exception);
         }
-        LOGGER.warn("No input parameters found in userparams ...");
-        return NullInputParameter.NULL_INSTANCE;
     }
 }