aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java40
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java57
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java26
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java14
20 files changed, 277 insertions, 55 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
index b554d7a9ba..4ad7fbdbd3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
@@ -45,6 +45,14 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String namingPolicy;
@JsonProperty("onap-generated-naming")
private Boolean onapGeneratedNaming;
+ @JsonProperty("cds-blueprint-name")
+ private String blueprintName;
+ @JsonProperty("cds-blueprint-version")
+ private String blueprintVersion;
+ @JsonProperty("controller-actor")
+ private String controllerActor;
+ @JsonProperty("skip-post-instantiation-configuration")
+ private Boolean skipPostInstConf = Boolean.TRUE;
public String getDescription() {
@@ -119,4 +127,36 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) {
this.onapGeneratedNaming = onapGeneratedNaming;
}
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+ public String getControllerActor() {
+ return controllerActor;
+ }
+
+ public void setControllerActor(String controllerActor) {
+ this.controllerActor = controllerActor;
+ }
+
+ public Boolean getSkipPostInstConf() {
+ return skipPostInstConf;
+ }
+
+ public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ this.skipPostInstConf = skipPostInstConf;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
index 0d79dbb375..f393d2a49d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
import com.google.gson.JsonObject;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
@@ -51,13 +52,17 @@ public class ConfigureInstanceParamsForPnf {
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
String modelCustomizationUuid) throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList = getInstanceParamForPnf(service, modelCustomizationUuid);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParamForPnf(service.get(), modelCustomizationUuid);
+
+ applyParamsToObject(instanceParamsList, jsonObject);
+ }
} catch (Exception exception) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", exception);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", exception);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
new file mode 100644
index 0000000000..e8c88e00d7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ConfigureInstanceParamsForService {
+
+ @Autowired
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ /**
+ * Read instance parameters for Service and put into JsonObject.
+ *
+ * @param jsonObject - JsonObject which will hold the payload to send to CDS.
+ * @param userParamsFromRequest - User parameters.
+ * @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
+ */
+ public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest)
+ throws PayloadGenerationException {
+ try {
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+
+ service.map(Service::getInstanceParams).ifPresent(p -> applyParamsToObject(p, jsonObject));
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
index eeaecb9264..b1e632a701 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
@@ -20,7 +20,9 @@
package org.onap.so.client.cds;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
import com.google.gson.JsonObject;
+import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
@@ -50,19 +52,22 @@ public class ConfigureInstanceParamsForVfModule {
String vnfCustomizationUuid, String vfModuleCustomizationUuid, String vfModuleInstanceName)
throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList;
- if (StringUtils.isNotBlank(vfModuleInstanceName)) {
- instanceParamsList = getInstanceParamsByInstanceNames(service, vfModuleInstanceName);
- } else {
- instanceParamsList = getInstanceParams(service, vnfCustomizationUuid, vfModuleCustomizationUuid);
- }
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vfModuleInstanceName)) {
+ instanceParamsList = getInstanceParamsByInstanceNames(service.get(), vfModuleInstanceName);
+ } else {
+ instanceParamsList =
+ getInstanceParams(service.get(), vnfCustomizationUuid, vfModuleCustomizationUuid);
+ }
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ applyParamsToObject(instanceParamsList, jsonObject);
+ }
} catch (Exception e) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
index 43283ac98b..5d8388b6e0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
@@ -20,8 +20,9 @@
package org.onap.so.client.cds;
-import com.google.gson.JsonObject;
+import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject;
import org.apache.commons.lang3.StringUtils;
+import com.google.gson.JsonObject;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.Vnfs;
@@ -48,19 +49,20 @@ public class ConfigureInstanceParamsForVnf {
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
String modelCustomizationUuid, String vnfInstanceName) throws PayloadGenerationException {
try {
- Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+ Optional<Service> service =
+ extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList;
- if (StringUtils.isNotBlank(vnfInstanceName)) {
- instanceParamsList = getInstanceParamByVnfInstanceName(service, vnfInstanceName);
- } else {
- instanceParamsList = getInstanceParamForVnf(service, modelCustomizationUuid);
+ if (service.isPresent()) {
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vnfInstanceName)) {
+ instanceParamsList = getInstanceParamByVnfInstanceName(service.get(), vnfInstanceName);
+ } else {
+ instanceParamsList = getInstanceParamForVnf(service.get(), modelCustomizationUuid);
+ }
+ applyParamsToObject(instanceParamsList, jsonObject);
}
-
- instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
- .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
} catch (Exception e) {
- throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ throw new PayloadGenerationException("Failed to resolve instance parameters", e);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
new file mode 100644
index 0000000000..117fd74498
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+
+public final class ConfigureInstanceParamsUtil {
+
+ public static void applyParamsToObject(List<Map<String, String>> instanceParamsList, JsonObject jsonObject) {
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
index 43fabd3253..53e1da410e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Optional;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,10 +36,13 @@ public class ExtractServiceFromUserParameters {
@Autowired
private ObjectMapper objectMapper;
- public Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
- Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey(SERVICE_KEY)).findFirst()
- .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
- return getServiceObjectFromServiceMap(serviceMap);
+ public Optional<Service> getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Optional<Map<String, Object>> serviceMap =
+ userParams.stream().filter(key -> key.containsKey(SERVICE_KEY)).findFirst();
+ if (serviceMap.isPresent()) {
+ return Optional.of(getServiceObjectFromServiceMap(serviceMap.get()));
+ }
+ return Optional.empty();
}
private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws PayloadGenerationException {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
index 12c841a2c6..ce784dd5d6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
@@ -21,8 +21,11 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.PayloadGenerationException;
@@ -38,21 +41,22 @@ import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ServiceCDSRequestProvider implements CDSRequestProvider {
- private static final String EMPTY_STRING = "";
private String resolutionKey;
private BuildingBlockExecution execution;
+ private String bluePrintName;
+ private String bluePrintVersion;
@Autowired
- private ExtractPojosForBB extractPojosForBB;
+ private ConfigureInstanceParamsForService configureInstanceParamsForService;
@Override
public String getBlueprintName() {
- return EMPTY_STRING;
+ return bluePrintName;
}
@Override
public String getBlueprintVersion() {
- return EMPTY_STRING;
+ return bluePrintVersion;
}
@Override
@@ -65,17 +69,21 @@ public class ServiceCDSRequestProvider implements CDSRequestProvider {
JsonObject cdsPropertyObject = new JsonObject();
JsonObject serviceObject = new JsonObject();
try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getServiceInstance();
+ bluePrintName = serviceInstance.getModelInfoServiceInstance().getBlueprintName();
+ bluePrintVersion = serviceInstance.getModelInfoServiceInstance().getBlueprintVersion();
resolutionKey = serviceInstance.getServiceInstanceName();
- // TODO Need to figure out how to populate blueprint name and version for service.
-
serviceObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
serviceObject.addProperty("service-model-uuid",
serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForService.populateInstanceParams(serviceObject, userParamsFromRequest);
+ }
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObjectForService", e);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
index 6de1364a47..42b29ea669 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
@@ -20,6 +20,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonParser;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -143,12 +144,12 @@ public abstract class AbstractVnfCDSRequestProviderTest {
return userParams;
}
- protected Service getUserParams() {
+ protected Optional<Service> getUserParams() {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfList());
service.setResources(resources);
- return service;
+ return Optional.of(service);
}
protected List<Vnfs> createVnfList() {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
index 0273b9dbf6..be100652c0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -67,7 +68,7 @@ public class ConfigureInstanceParamsForVfModuleTest {
resources.setVnfs(createVnfs());
service.setResources(resources);
- when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_CUSTOMIZATION_ID,
@@ -85,7 +86,7 @@ public class ConfigureInstanceParamsForVfModuleTest {
resources.setVnfs(createVnfs());
service.setResources(resources);
- when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
// No instance name is passed
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
index 547129e898..6466da59d0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -64,7 +65,7 @@ public class ConfigureInstanceParamsForVnfTest {
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
- when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_2_CUSTOMIZATION_ID,
@@ -81,7 +82,7 @@ public class ConfigureInstanceParamsForVnfTest {
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
- when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
// No instance name is passed
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java
new file mode 100644
index 0000000000..f7c3e8a192
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsUtilTest.java
@@ -0,0 +1,24 @@
+package org.onap.so.client.cds;
+
+import static org.junit.Assert.assertEquals;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+
+public class ConfigureInstanceParamsUtilTest {
+
+ @Test
+ public void testApplyParamsToObject() {
+ List<Map<String, String>> instanceParamsList =
+ List.of(Map.of("test-param-1", "value1", "test-param-2", "value2"), Map.of("test-param-3", "value3"));
+ JsonObject jsonObject = new JsonObject();
+
+ ConfigureInstanceParamsUtil.applyParamsToObject(instanceParamsList, jsonObject);
+
+ assertEquals("value1", jsonObject.get("test-param-1").getAsString());
+ assertEquals("value2", jsonObject.get("test-param-2").getAsString());
+ assertEquals("value3", jsonObject.get("test-param-3").getAsString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
index 70ce3a1eed..c860d0fc5e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import static org.assertj.core.api.Assertions.assertThat;
@@ -35,13 +36,15 @@ public class ServiceCDSRequestProviderTest extends AbstractVnfCDSRequestProvider
@InjectMocks
private ServiceCDSRequestProvider serviceCDSRequestProvider;
+ @Mock
+ private ConfigureInstanceParamsForService configureInstanceParamsForService;
+
@Test
public void testRequestPayloadForCreateService() throws Exception {
// given
setScopeAndAction(SERVICE_SCOPE, SERVICE_ACTION);
ServiceInstance instance = createServiceInstance();
- doReturn(instance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
- ResourceKey.SERVICE_INSTANCE_ID);
+ buildingBlockExecution.getGeneralBuildingBlock().setServiceInstance(instance);
// when
serviceCDSRequestProvider.setExecutionObject(buildingBlockExecution);
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
index 42ae25a7b1..af3b3ffba8 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoServiceInstance.json
@@ -8,5 +8,6 @@
"service-type": "serviceType",
"service-role": "serviceRole",
"environment-context": "environmentContext",
- "workload-context": "workloadContext"
+ "workload-context": "workloadContext",
+ "skip-post-instantiation-configuration": true
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
index f3b767a8f1..1da9ad584a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/AbstractControllerExecution.java
@@ -157,6 +157,16 @@ public abstract class AbstractControllerExecution<T> {
}
/**
+ * Check whether the controller scope is SERVICE
+ *
+ * @param controllerScope controller scope, e.g, pnf, vnf, vfModule, service
+ * @return true if the controller scope is service, else return false
+ */
+ protected boolean isServiceResourceScope(final String controllerScope) {
+ return "service".equalsIgnoreCase(controllerScope);
+ }
+
+ /**
* Check whether the controller scope is VNF resource related.
*
* @param controllerScope controller scope, e.g, pnf, vnf, vfModule
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
index 39a695b0b6..92be824691 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/ControllerExecutionBB.java
@@ -109,6 +109,8 @@ public class ControllerExecutionBB extends AbstractControllerExecution<BuildingB
PnfResourceCustomization pnfResourceCustomization =
catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
controllerActor = pnfResourceCustomization.getControllerActor();
+ } else if (isServiceResourceScope(controllerScope)) {
+ return controllerActor;
} else if (isVnfResourceScope(controllerScope)) {
VnfResourceCustomization vnfResourceCustomization =
catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(resourceCustomizationUuid);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
index c56ab3e71d..f2f3b5da08 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
@@ -26,7 +26,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -87,6 +89,11 @@ public class ControllerExecution {
execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId());
execution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
execution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ } else if ("service".equalsIgnoreCase(scope)) {
+ GeneralBuildingBlock gbb = execution.getGeneralBuildingBlock();
+ ModelInfoServiceInstance modelInfoServiceInstance =
+ gbb.getServiceInstance().getModelInfoServiceInstance();
+ controllerActor = Optional.ofNullable(modelInfoServiceInstance.getControllerActor()).orElse("CDS");
} else {
GenericVnf genericVnf = getGenericVnf(execution);
String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
index 1fae5ce06c..5442f444ee 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
@@ -46,6 +46,7 @@ public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockE
public static final String CDS_ACTOR = "cds";
public static final String VNF_SCOPE = "vnf";
public static final String VF_MODULE_SCOPE = "vfmodule";
+ public static final String SERVICE_SCOPE = "service";
@Autowired
private ExceptionBuilder exceptionBuilder;
@@ -59,8 +60,8 @@ public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockE
@Override
public Boolean understand(ControllerContext<BuildingBlockExecution> context) {
String scope = context.getControllerScope();
- return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor())
- && (VNF_SCOPE.equalsIgnoreCase(scope) || VF_MODULE_SCOPE.equalsIgnoreCase(scope));
+ return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor()) && (SERVICE_SCOPE.equalsIgnoreCase(scope)
+ || VNF_SCOPE.equalsIgnoreCase(scope) || VF_MODULE_SCOPE.equalsIgnoreCase(scope));
}
@Override
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
index 272c6189b4..ff6c113af3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -29,8 +29,10 @@ import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -76,11 +78,11 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator {
BuildingBlockExecution execution) {
String customizationUUID = currentBB.getBuildingBlock().getKey();
- if (Strings.isEmpty(customizationUUID)) {
- return;
- }
-
- if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
+ if ("SERVICE".equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnScope())) {
+ String modelUUID = currentBB.getRequestDetails().getModelInfo().getModelUuid();
+ Service service = catalogDbClient.getServiceByID(modelUUID);
+ currentSequenceSkipCheck(execution, service.getSkipPostInstConf());
+ } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
&& containsIgnoreCaseAction(currentBB, vnfActions)) {
List<VnfResourceCustomization> vnfResourceCustomizations =
catalogDbClient.getVnfResourceCustomizationByModelUuid(
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
index fdf4d36c89..b23147e351 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
@@ -37,6 +37,7 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -46,6 +47,7 @@ import org.onap.so.serviceinstancebeans.RequestDetails;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SkipCDSBuildingBlockListenerTest {
+ private static final String SERVICE_SCOPE = "service";
private static final String VNF_SCOPE = "VNF";
private static final String VF_SCOPE = "VFModule";
private static final String PNF_SCOPE = "pnf";
@@ -90,6 +92,18 @@ public class SkipCDSBuildingBlockListenerTest {
}
@Test
+ public void testSkipCDSforService() {
+ setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", 0);
+ Service service = new Service();
+ when(catalogDbClient.getServiceByID(TEST_MODELUUID)).thenReturn(service);
+
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+ }
+
+ @Test
public void testProcessForVNFToSkipCDSBB() {
// given
setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);