summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSunilB <SB00577584@techmahindra.com>2020-01-10 15:53:41 +0530
committerSunil Kumar Biradar <SB00577584@techmahindra.com>2020-01-10 10:38:39 +0000
commitca7fa9dce1d37491e648531998c1577446eff23b (patch)
treec3a0410378323d4c7e8be12b6526a905f0db2a9e /src/main
parentdf23184a2288013d954392d3f5e59787aeca41bc (diff)
Identify whether the Service is of A-la-carte or macro type
Issue-ID: EXTAPI-367 Signed-off-by: sunilb <sb00577584@techmahindra.com> Change-Id: I281936af78a0bbb7b08f7e96fd64015eaa4a6b5a
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java5
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/utils/MacroServiceUtils.java33
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java7
3 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
index 14b2541..2153b84 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
@@ -24,6 +24,7 @@ import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.parameters.Input;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -145,6 +146,10 @@ public class ToscaInfosProcessor {
String svcCharacteristicsJson = Json.pretty(definitions);
serviceSpecificationDBManager.saveSpecificationInputSchema(svcCharacteristicsJson, serviceCatalogResponse);
+ Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata();
+ String instantationType = serviceMetadata.getValue("instantiationType");
+ serviceCatalogResponse.put("instantiationType", instantationType);
+
LinkedHashMap inputSchemaRef = new LinkedHashMap();
// use object to match examples in Specifications
inputSchemaRef.put("valueType", "object");
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/utils/MacroServiceUtils.java b/src/main/java/org/onap/nbi/apis/serviceorder/utils/MacroServiceUtils.java
new file mode 100644
index 0000000..427ba3b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/utils/MacroServiceUtils.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2020 TechMahindra
+ *
+ * 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.
+ */
+
+package org.onap.nbi.apis.serviceorder.utils;
+
+import java.util.Map;
+
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
+
+public class MacroServiceUtils {
+ public static boolean isMacroService(ServiceOrderItemInfo serviceOrderItemInfo) {
+ Map<String, Object> sdcInfos = serviceOrderItemInfo.getCatalogResponse();
+ boolean macroService = false;
+ if (sdcInfos.get("instantiationType") != null) {
+ String instantiationType = ((String) sdcInfos.get("instantiationType")).toLowerCase();
+ if (instantiationType.equals("macro")) {
+ macroService = true;
+ }
+ }
+ return macroService;
+}
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
index 843f599..d63d122 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -31,6 +31,7 @@ import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
import org.onap.nbi.apis.serviceorder.service.ServiceOrderService;
import org.onap.nbi.apis.serviceorder.utils.E2EServiceUtils;
import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
+import org.onap.nbi.apis.serviceorder.utils.MacroServiceUtils;
import org.onap.nbi.exceptions.TechnicalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,12 +82,18 @@ public class SOTaskProcessor {
ServiceOrderItem serviceOrderItem = getServiceOrderItem(executionTask, serviceOrder);
boolean e2eService =
E2EServiceUtils.isE2EService(serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()));
+ boolean macroService = MacroServiceUtils
+ .isMacroService(serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()));
if (shouldPostSo(serviceOrderItem)) {
if (e2eService) {
ResponseEntity<CreateE2EServiceInstanceResponse> response =
postSoProcessor.postE2EServiceOrderItem(serviceOrderInfo, serviceOrderItem, serviceOrder);
updateE2EServiceOrderItem(response, serviceOrderItem, serviceOrder);
+ } else if (macroService) {
+ LOGGER.info("Mode type macro");
+ //TODO: Add logic to construct SO macro request body and call SO macro flow.(EXTAPI-368)
+
} else {
ResponseEntity<CreateServiceInstanceResponse> response =