aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main
diff options
context:
space:
mode:
authorAbhishek Patil <abhishek.patil@t-systems.com>2023-04-12 18:51:19 +0530
committerAbhishek Patil <abhishek.patil@t-systems.com>2023-05-03 11:21:52 +0000
commit09e2242fd1b3258d299018e501c10f124e5b3104 (patch)
tree02a74f1a97bac084364705692754325c66cd48ee /bpmn/MSOCommonBPMN/src/main
parent6624366c1485f352220216e45666d6083da04d6c (diff)
Code changes in BPMN infra for RAN Slice Use case
New module so-bomn-moi is created. New bpmn flows : AssignRANNssiBB ActivateRANNssiBB ModifyRANNssiBB DeleteRANNssiBB Issue-ID: SO-4039 Signed-off-by: Patil <Abhishek.Patil@t-systems.com> Change-Id: Ifad4e0a65dc810a753d30123a84c08081bcfd987
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/NssiCDSRequestProvider.java284
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java1
6 files changed, 397 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 69c1c9f8ac..0e6cb64751 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -547,6 +547,30 @@ class OofUtils {
return response.toString()
}
+ public String buildSelectNSSTRequest(String requestId,String messageType, Map<String, Object> profileInfo) {
+ def transactionId = requestId
+ logger.debug( "transactionId is: " + transactionId)
+ String correlator = requestId
+ String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+ ObjectMapper objectMapper = new ObjectMapper()
+ String json = objectMapper.writeValueAsString(profileInfo)
+ StringBuilder response = new StringBuilder()
+ response.append(
+ "{\n" +
+ " \"requestInfo\": {\n" +
+ " \"transactionId\": \"${transactionId}\",\n" +
+ " \"requestId\": \"${requestId}\",\n" +
+ " \"sourceId\": \"so\",\n" +
+ " \"timeout\": 600,\n" +
+ " \"callbackUrl\": \"${callbackUrl}\"\n" +
+ " },\n")
+ response.append(" \"SliceProfile\":")
+ response.append(json)
+ response.append("\n}\n")
+ return response.toString()
+ }
+
+
public String buildSelectNSIRequest(String requestId, String nstInfo,String messageType, Map<String, Object> profileInfo){
def transactionId = requestId
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index aa5da4c790..57d00efb7d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -39,5 +39,9 @@ public enum ResourceKey {
VNF_INSTANCE_NAME,
VF_MODULE_INSTANCE_NAME,
CHILD_SERVICE_INSTANCE_ID,
- CHILD_SERVICE_INSTANCE_NAME
+ CHILD_SERVICE_INSTANCE_NAME,
+ ServiceInstance,
+ ModelInfoServiceInstance,
+ operationalState,
+ administrativeState
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 178612c4bd..b38bd25c66 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -75,6 +75,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.entities.ServiceModel;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
@@ -189,6 +190,13 @@ public class BBInputSetup implements JavaDelegate {
boolean homing = Boolean.TRUE.equals(executeBB.isHoming());
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
+ logger.debug("setting Homing");
+ if (executeBB.getBuildingBlock().getBpmnFlowName().contains("AssignRANNssiBB")) {
+ execution.setVariable("homing", true);
+ } else {
+ execution.setVariable("homing", false);
+ }
+
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB));
@@ -240,6 +248,11 @@ public class BBInputSetup implements JavaDelegate {
requestDetails = bbInputSetupUtils.getRequestDetails(requestId);
}
if (requestDetails.getModelInfo() == null) {
+ if (requestAction.contains("RanSlice")) {
+ logger.debug(">>> RequestAction: {}", executeBB.getRequestAction());
+
+ return this.getGBBRanSlicing(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
+ }
return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
} else {
ModelType modelType = requestDetails.getModelInfo().getModelType();
@@ -347,7 +360,7 @@ public class BBInputSetup implements JavaDelegate {
List<GenericVnf> genericVnfs = serviceInstance.getVnfs();
String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
- if (vnfId != null) {
+ if (vnfId != null && !vnfId.isEmpty()) {
org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
genericVnfs.add(genericVnf);
@@ -394,6 +407,67 @@ public class BBInputSetup implements JavaDelegate {
return this.populateGBBWithSIAndAdditionalInfo(parameter);
}
+ protected GeneralBuildingBlock getGBBRanSlicing(ExecuteBuildingBlock executeBB, RequestDetails requestDetails,
+ Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception {
+ org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+
+ executeBB.setHoming(true);
+ Customer customer = new Customer();
+
+ String subscriberId = executeBB.getRequestDetails().getSubscriberInfo().getGlobalSubscriberId();
+ customer.setGlobalCustomerId(subscriberId);
+
+ String subscriberName = executeBB.getRequestDetails().getSubscriberInfo().getSubscriberName();
+ customer.setSubscriberName(subscriberName);
+
+ String subscriptionType = executeBB.getRequestDetails().getRequestParameters().getSubscriptionServiceType();
+
+ ServiceSubscription serviceSubscription = new ServiceSubscription();
+ serviceSubscription.setServiceType(subscriptionType);
+
+ customer.setServiceSubscription(serviceSubscription);
+
+ String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
+
+ serviceInstanceAAI = getServiceInstanceAAI(requestDetails, customer, serviceInstanceId, false, bbName);
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(serviceInstanceId);
+ logger.debug(">>>>> serviceInstanceAAI: {}", serviceInstanceAAI);
+ if (serviceInstanceAAI != null) {
+ String modelVersionId = serviceInstanceAAI.getModelVersionId();
+
+ Service service = bbInputSetupUtils.getCatalogServiceByModelUUID(modelVersionId);
+
+ // Check if there is any existing method for mapping
+ String modelInvariantId = serviceInstanceAAI.getModelInvariantId();
+ String modelVersion = service.getModelVersion();
+ String serviceType = service.getServiceType();
+ String serviceRole = service.getServiceRole();
+ String controllerActor = service.getControllerActor();
+ String blueprintName = service.getBlueprintName();
+ String blueprintVersion = service.getBlueprintVersion();
+
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setServiceType(serviceType);
+ modelInfoServiceInstance.setServiceRole(serviceRole);
+ modelInfoServiceInstance.setControllerActor(controllerActor);
+ modelInfoServiceInstance.setBlueprintName(blueprintName);
+ modelInfoServiceInstance.setBlueprintVersion(blueprintVersion);
+ modelInfoServiceInstance.setModelInvariantUuid(modelInvariantId);
+ modelInfoServiceInstance.setModelUuid(modelVersionId);
+ modelInfoServiceInstance.setModelVersion(modelVersion);
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ }
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestDetails(requestDetails)
+ .setServiceInstance(serviceInstance).setExecuteBB(executeBB).setRequestAction(requestAction)
+ .setCustomer(customer).build();
+ return this.populateGBBWithSIAndAdditionalInfo(parameter);
+
+ }
+
protected void populateObjectsOnAssignAndCreateFlows(BBInputSetupParameter parameter) throws Exception {
parameter.setModelInfo(parameter.getRequestDetails().getModelInfo());
parameter.setInstanceName(parameter.getRequestDetails().getRequestInfo().getInstanceName());
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java
index fb79880572..12d5d06b53 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java
@@ -56,6 +56,10 @@ public class GeneratePayloadForCds {
@Autowired
private PnfCDSRequestProvider pnfCDSRequestProvider;
+ @Autowired
+ private NssiCDSRequestProvider nssiCDSRequestProvider;
+
+
/**
* Build properties like (blueprint name, version, action etc..) along with the request payload for vnf, vf-module
* and service.
@@ -145,6 +149,10 @@ public class GeneratePayloadForCds {
case PayloadConstants.PNF_SCOPE:
requestProvider = pnfCDSRequestProvider;
break;
+
+ case PayloadConstants.NSSI_SCOPE:
+ requestProvider = nssiCDSRequestProvider;
+ break;
default:
throw new PayloadGenerationException("No scope defined with " + scope);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/NssiCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/NssiCDSRequestProvider.java
new file mode 100644
index 0000000000..d283092e0a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/NssiCDSRequestProvider.java
@@ -0,0 +1,284 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2022 Deutsche telekom
+ * ================================================================================
+ * 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.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import org.onap.aai.domain.yang.ServiceInstances;
+import org.onap.aaiclient.client.aai.entities.CustomQuery;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.entities.uri.NodesSingleUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.graphinventory.Format;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.core.json.JsonUtils;
+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.BBObjectNotFoundException;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.moi.Attributes;
+import org.onap.so.moi.Snssai;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class NssiCDSRequestProvider implements CDSRequestProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NssiCDSRequestProvider.class);
+
+ private String blueprintName;
+ private String blueprintVersion;
+ private BuildingBlockExecution execution;
+
+ private static final String DELETE_SLICE_PROFILE_ACTION = "delete-sliceprofile";
+ private static final String CREATE_SLICE_PROFILE_ACTION = "create-sliceprofile";
+ private static final String MODIFY_SLICE_PROFILE_ACTION = "modify-sliceprofile";
+ private static final String SERVICE_INSTANCE_KEY = "service-instance";
+ private static final String SERVICE_INSTANCE_ID_KEY = "service-instance-id";
+ private static final String NSSI = "nssi";
+ private static final String NSSI_ID = "nssiId";
+ private static final String NSSI_NAME = "nssiName";
+ private static final String NSI_NAME = "nsiName";
+ private static final String NSI_ID = "nsiId";
+ private static final String SLICE_PROFILE_INSTANCE_ID = "sliceProfileInstanceId";
+ private static final String SLICE_INSTANCE_FROM_PROFILE_ID_CUSTOM_QUERY =
+ "related-to?startingNodeType=slice-profile&relatedToNodeType=service-instance";
+ private static final String ENVIRONMENT_CONTEXT_QUERY_PARAM = "environment-context";
+ private static final String AAI_SUPPORTED_SLICE_PROFILE =
+ "latency|maxNumberofUEs|coverageAreaTAList|areaTrafficCapDL|resourceSharingLevel|serviceType|uEMobilityLevel|expDataRateUL|expDataRateDL";
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ JsonUtils jsonUtil = new JsonUtils();
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private InjectionHelper injectionHelper;
+
+ @Override
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ @Override
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ @Override
+ public <T> void setExecutionObject(T executionObject) {
+ execution = (BuildingBlockExecution) executionObject;
+ }
+
+ @Override
+ public Optional<String> buildRequestPayload(String action) throws PayloadGenerationException {
+ JsonObject cdsPropertyObject = null;
+
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ // get values from service Instance
+ blueprintName = serviceInstance.getModelInfoServiceInstance().getBlueprintName();
+ blueprintVersion = serviceInstance.getModelInfoServiceInstance().getBlueprintVersion();
+
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to buildPropertyObjectForNssi", e);
+ }
+
+ cdsPropertyObject = setCreateSliceProfileRequestValues(action, buildingBlock);
+
+ return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
+ }
+
+ private JsonObject setCreateSliceProfileRequestValues(String action, GeneralBuildingBlock buildingBlock) {
+
+ JsonObject cdsRequestObject = new JsonObject();
+
+ ServiceInstance serviceInstance = null;
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ } catch (BBObjectNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+
+ Attributes attributes = null;
+
+ for (Map<String, Object> userParamData : userParamsFromRequest) {
+ if (userParamData.get(NSSI) != null) {
+ attributes = mapper.convertValue(userParamData.get(NSSI), Attributes.class);
+ }
+ }
+ // Value to come as a request == Hardcoded for now
+ String nssiId = serviceInstance.getServiceInstanceId();
+ String nssiName = getNssiName(nssiId);
+ String nsiId = "nssi-id";
+ String nsiName = "nssi-name";
+
+ cdsRequestObject.addProperty(NSSI_ID, nssiId);
+
+ if (!DELETE_SLICE_PROFILE_ACTION.equals(action)) {
+ cdsRequestObject.addProperty(NSSI_NAME, nssiName);
+ cdsRequestObject.addProperty(NSI_NAME, nsiName);
+ }
+
+ String sliceProfileInstanceId = null;
+ if (CREATE_SLICE_PROFILE_ACTION.equalsIgnoreCase(action)) {
+ Snssai snssai = attributes.getSliceProfileList().get(0).getPlmnInfoList().get(0).getSnssai();
+ String sNssaiString = snssai.getSst() + SEPARATOR + snssai.getSd();
+ sliceProfileInstanceId = getSliceProfileInstanceIdForNssi(sNssaiString);
+ } else {
+ String sliceProfileId = attributes.getSliceProfileList().get(0).getSliceProfileId();
+ sliceProfileInstanceId = getSliceProfileInstanceFromSliceProfileId(sliceProfileId);
+ }
+
+ cdsRequestObject.addProperty(SLICE_PROFILE_INSTANCE_ID, sliceProfileInstanceId);
+
+ cdsRequestObject.addProperty(NSI_ID, nsiId);
+ /*
+ * JsonObject nssiPropertyObject = setSliceProfileProperties(getSliceProfilesFromUserParams(buildingBlock));
+ * cdsRequestObject.add(action + SEPARATOR + PROPERTIES, nssiPropertyObject);
+ */
+ return cdsRequestObject;
+ }
+
+ private Map<String, Object> getSliceProfilesFromUserParams(GeneralBuildingBlock gBB) {
+
+
+ List<Map<String, Object>> mapUserParams = gBB.getRequestContext().getRequestParameters().getUserParams();
+
+ Map<String, Object> sliceProfileMap = null;
+ try {
+ String userParamsJson = mapper.writeValueAsString(mapUserParams.get(0));
+ String rANSliceSubnetProfile =
+ jsonUtil.getJsonParamValue(userParamsJson, "nssi.sliceProfileList", "RANSliceSubnetProfile");
+
+ if (rANSliceSubnetProfile != null) {
+ sliceProfileMap = mapper.readValue(rANSliceSubnetProfile, Map.class);
+ }
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ return sliceProfileMap;
+ }
+
+ // May be needed later
+
+ /*
+ * private JsonObject setSliceProfileProperties(Map<String, Object> userParamsMap) { JsonObject
+ * sliceProfilePropertiesNotPresentInAai = new JsonObject();
+ *
+ * if (userParamsMap != null) { userParamsMap.forEach((k, v) -> { if (!AAI_SUPPORTED_SLICE_PROFILE.contains((String)
+ * k)) { sliceProfilePropertiesNotPresentInAai.addProperty(k, v.toString()); } }); }
+ *
+ * return sliceProfilePropertiesNotPresentInAai; }
+ */
+
+ private String getSliceProfileInstanceFromSliceProfileId(String sliceProfileId) {
+
+ List<AAIResourceUri> startNodes = new ArrayList<>();
+ startNodes.add(
+ AAIUriFactory.createNodesUri(AAIFluentTypeBuilder.Types.SLICE_PROFILE.getFragment(sliceProfileId)));
+
+ CustomQuery customQuery = new CustomQuery(startNodes, SLICE_INSTANCE_FROM_PROFILE_ID_CUSTOM_QUERY);
+
+ String results = injectionHelper.getAaiQueryClient().query(Format.RESOURCE, customQuery);
+
+ if (results == null || results.isEmpty()) {
+ throw new RuntimeException("Slice Profile Instance Not found");
+ }
+
+ Map<String, List<Map<String, Object>>> serviceInstancesMap = null;
+ try {
+ serviceInstancesMap = mapper.readValue(results, Map.class);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ Map<String, Object> serviceInstance =
+ (Map<String, Object>) serviceInstancesMap.get("results").get(0).get(SERVICE_INSTANCE_KEY);
+
+ return (String) serviceInstance.get(SERVICE_INSTANCE_ID_KEY);
+ }
+
+ private String getSliceProfileInstanceIdForNssi(String sNssai) {
+
+ String sliceProfileInstanceId = null;
+
+ try {
+ AAIPluralResourceUri uriSI =
+ AAIUriFactory.createNodesUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCES.getFragment())
+ .queryParam(ENVIRONMENT_CONTEXT_QUERY_PARAM, sNssai);
+ Optional<ServiceInstances> sliceProfileInstancesOptional =
+ injectionHelper.getAaiClient().get(ServiceInstances.class, uriSI);
+
+ if (sliceProfileInstancesOptional.isPresent()) {
+ sliceProfileInstanceId =
+ sliceProfileInstancesOptional.get().getServiceInstance().get(0).getServiceInstanceId();
+ }
+ } catch (Exception e) {
+ LOGGER.error("Error in getting sliceProfile Instance" + e.getMessage());
+ }
+ return sliceProfileInstanceId;
+ }
+
+ private String getNssiName(String nssiId) {
+
+ String nssiName = null;
+
+ try {
+ NodesSingleUri uriSI =
+ AAIUriFactory.createNodesUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(nssiId));
+ Optional<org.onap.aai.domain.yang.ServiceInstance> sliceProfileInstancesOptional =
+ injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.ServiceInstance.class, uriSI);
+
+ if (sliceProfileInstancesOptional.isPresent()) {
+ nssiName = sliceProfileInstancesOptional.get().getServiceInstanceName();
+ }
+ } catch (Exception e) {
+ LOGGER.error("Error in getting Nssi Instance" + e.getMessage());
+ }
+ return nssiName;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java
index 019e336325..60e34e0834 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java
@@ -33,6 +33,7 @@ public final class PayloadConstants {
public static final String REQUEST = "request";
public static final String PROPERTIES = "properties";
public static final String SCOPE = "scope";
+ public static final String NSSI_SCOPE = "nssi";
public static final String ACTION = "action";
public static final String MODE = "mode";
public static final String SEPARATOR = "-";