Code changes in SO api-handler for RAN Slice 43/132943/10
authorAbhishek Patil <abhishek.patil@t-systems.com>
Fri, 31 Mar 2023 05:09:46 +0000 (10:39 +0530)
committerAbhishek Patil <abhishek.patil@t-systems.com>
Fri, 31 Mar 2023 05:09:46 +0000 (10:39 +0530)
Issue-ID: SO-4038
Change-Id: Ifad4e0a65dc810a753d30741a84c08081bcfd258
Signed-off-by: Patil <Abhishek.Patil@t-systems.com>
20 files changed:
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
common/src/main/java/org/onap/so/moi/Attributes.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/GETMoiResponse.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/MoiAllocateRequest.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/PlmnId.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/PlmnInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/RANSliceSubnetProfile.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/SliceProfile.java [new file with mode: 0644]
common/src/main/java/org/onap/so/moi/Snssai.java [new file with mode: 0644]
docs/api/apis/ManagedObject3gppServiceInstances.rst [new file with mode: 0644]
docs/api/offered_consumed_apis.rst
docs/api/swagger/swagger.json
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManagedObject3gppServiceInstances.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfile.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfileBadGateWay.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/DeleteSliceProfile.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/ModifySliceProfile.json [new file with mode: 0644]

index 0a60724..f307788 100644 (file)
@@ -32,6 +32,7 @@ public enum WorkflowType {
     NETWORKCOLLECTION("NetworkCollection"),
     CONFIGURATION("Configuration"),
     INSTANCE_GROUP("InstanceGroup"),
+    NETWORK_SLICE_SUBNET("NetworkSliceSubnet"),
     CNF("Cnf");
 
     private final String type;
diff --git a/common/src/main/java/org/onap/so/moi/Attributes.java b/common/src/main/java/org/onap/so/moi/Attributes.java
new file mode 100644 (file)
index 0000000..72d00c2
--- /dev/null
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"sliceProfileList"})
+public class Attributes {
+
+    @JsonProperty("sliceProfileList")
+    private List<SliceProfile> sliceProfileList = null;
+
+    @JsonProperty("operationalState")
+    private String operationalState;
+
+    @JsonProperty("administrativeState")
+    private String administrativeState;
+
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("sliceProfileList")
+    public List<SliceProfile> getSliceProfileList() {
+        return sliceProfileList;
+    }
+
+    @JsonProperty("sliceProfileList")
+    public void setSliceProfileList(List<SliceProfile> sliceProfileList) {
+        this.sliceProfileList = sliceProfileList;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+    @JsonProperty("operationalState")
+    public String getOperationalState() {
+        return operationalState;
+    }
+
+    @JsonProperty("operationalState")
+    public void setOperationalState(String operationalState) {
+        this.operationalState = operationalState;
+    }
+
+    @JsonProperty("administrativeState")
+    public String getAdministrativeState() {
+        return administrativeState;
+    }
+
+    @JsonProperty("administrativeState")
+    public void setAdministrativeState(String administrativeState) {
+        this.administrativeState = administrativeState;
+    }
+}
diff --git a/common/src/main/java/org/onap/so/moi/GETMoiResponse.java b/common/src/main/java/org/onap/so/moi/GETMoiResponse.java
new file mode 100644 (file)
index 0000000..569b3a4
--- /dev/null
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"id", "operationalState", "administrativeState", "attributes"})
+public class GETMoiResponse {
+
+    @JsonProperty("id")
+    private String id = null;
+
+    @JsonProperty("operationalState")
+    private String operationalState = null;
+
+    @JsonProperty("administrativeState")
+    private String administrativeState = null;
+
+    @Autowired
+    @JsonProperty("attributes")
+    private Attributes attributes;
+
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("id")
+    public String getId() {
+        return id;
+    }
+
+    @JsonProperty("id")
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    @JsonProperty("operationalState")
+    public String getOperationalState() {
+        return operationalState;
+    }
+
+    @JsonProperty("operationalState")
+    public void setOperationalState(String operationalState) {
+        this.operationalState = operationalState;
+    }
+
+    @JsonProperty("administrativeState")
+    public String getAdministrativeState() {
+        return administrativeState;
+    }
+
+    @JsonProperty("administrativeState")
+    public void setAdministrativeState(String administrativeState) {
+        this.administrativeState = administrativeState;
+    }
+
+    @JsonProperty("attributes")
+    public Attributes getAttributes() {
+        return attributes;
+    }
+
+    @JsonProperty("attributes")
+    public void setAttributes(Attributes attributes) {
+        this.attributes = attributes;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+        this.additionalProperties = additionalProperties;
+    }
+}
diff --git a/common/src/main/java/org/onap/so/moi/MoiAllocateRequest.java b/common/src/main/java/org/onap/so/moi/MoiAllocateRequest.java
new file mode 100644 (file)
index 0000000..cc4f020
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"attributes"})
+public class MoiAllocateRequest {
+
+    @JsonProperty("attributes")
+    private Attributes attributes;
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("attributes")
+    public Attributes getAttributes() {
+        return attributes;
+    }
+
+    @JsonProperty("attributes")
+    public void setAttributes(Attributes attributes) {
+        this.attributes = attributes;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/moi/PlmnId.java b/common/src/main/java/org/onap/so/moi/PlmnId.java
new file mode 100644 (file)
index 0000000..77a44bd
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"mcc", "mnc"})
+public class PlmnId {
+
+    @JsonProperty("mcc")
+    private Integer mcc;
+    @JsonProperty("mnc")
+    private Integer mnc;
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("mcc")
+    public Integer getMcc() {
+        return mcc;
+    }
+
+    @JsonProperty("mcc")
+    public void setMcc(Integer mcc) {
+        this.mcc = mcc;
+    }
+
+    @JsonProperty("mnc")
+    public Integer getMnc() {
+        return mnc;
+    }
+
+    @JsonProperty("mnc")
+    public void setMnc(Integer mnc) {
+        this.mnc = mnc;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/moi/PlmnInfo.java b/common/src/main/java/org/onap/so/moi/PlmnInfo.java
new file mode 100644 (file)
index 0000000..bd16423
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"plmnId", "snssai"})
+public class PlmnInfo {
+
+    @JsonProperty("plmnId")
+    private PlmnId plmnId;
+    @JsonProperty("snssai")
+    private Snssai snssai;
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("plmnId")
+    public PlmnId getPlmnId() {
+        return plmnId;
+    }
+
+    @JsonProperty("plmnId")
+    public void setPlmnId(PlmnId plmnId) {
+        this.plmnId = plmnId;
+    }
+
+    @JsonProperty("snssai")
+    public Snssai getSnssai() {
+        return snssai;
+    }
+
+    @JsonProperty("snssai")
+    public void setSnssai(Snssai snssai) {
+        this.snssai = snssai;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/moi/RANSliceSubnetProfile.java b/common/src/main/java/org/onap/so/moi/RANSliceSubnetProfile.java
new file mode 100644 (file)
index 0000000..dc2bac5
--- /dev/null
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import javax.annotation.Generated;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"coverageAreaTAList", "dLLatency", "uLLatency", "resourceSharingLevel", "serviceType",
+        "maxNumberofUEs"})
+@Generated("jsonschema2pojo")
+public class RANSliceSubnetProfile {
+
+    @JsonProperty("coverageAreaTAList")
+    private Integer coverageAreaTAList;
+    @JsonProperty("latency")
+    private Integer latency;
+    @JsonProperty("dLLatency")
+    private Integer dLLatency;
+    @JsonProperty("uLLatency")
+    private Integer uLLatency;
+    @JsonProperty("resourceSharingLevel")
+    private String resourceSharingLevel;
+    @JsonProperty("serviceType")
+    private String serviceType;
+    @JsonProperty("maxNumberofUEs")
+    private Integer maxNumberofUEs;
+    @JsonProperty("areaTrafficCapDL")
+    private Integer areaTrafficCapDL;
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("coverageAreaTAList")
+    public Integer getCoverageAreaTAList() {
+        return coverageAreaTAList;
+    }
+
+    @JsonProperty("coverageAreaTAList")
+    public void setCoverageAreaTAList(Integer coverageAreaTAList) {
+        this.coverageAreaTAList = coverageAreaTAList;
+    }
+
+    @JsonProperty("dLLatency")
+    public Integer getdLLatency() {
+        return dLLatency;
+    }
+
+    @JsonProperty("dLLatency")
+    public void setdLLatency(Integer dLLatency) {
+        this.dLLatency = dLLatency;
+    }
+
+    @JsonProperty("uLLatency")
+    public Integer getuLLatency() {
+        return uLLatency;
+    }
+
+    @JsonProperty("uLLatency")
+    public void setuLLatency(Integer uLLatency) {
+        this.uLLatency = uLLatency;
+    }
+
+    @JsonProperty("resourceSharingLevel")
+    public String getResourceSharingLevel() {
+        return resourceSharingLevel;
+    }
+
+    @JsonProperty("resourceSharingLevel")
+    public void setResourceSharingLevel(String resourceSharingLevel) {
+        this.resourceSharingLevel = resourceSharingLevel;
+    }
+
+    @JsonProperty("serviceType")
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    @JsonProperty("serviceType")
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    @JsonProperty("maxNumberofUEs")
+    public Integer getMaxNumberofUEs() {
+        return maxNumberofUEs;
+    }
+
+    @JsonProperty("maxNumberofUEs")
+    public void setMaxNumberofUEs(Integer maxNumberofUEs) {
+        this.maxNumberofUEs = maxNumberofUEs;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+    @JsonProperty("areaTrafficCapDL")
+    public Integer getAreaTrafficCapDL() {
+        return this.areaTrafficCapDL;
+    }
+
+    @JsonProperty("latency")
+    public Integer getLatency() {
+        return latency;
+    }
+
+    @JsonProperty("latency")
+    public void setLatency(Integer latency) {
+        this.latency = latency;
+    }
+
+    @JsonProperty("areaTrafficCapDL")
+    public void setAreaTrafficCapDL(Integer areaTrafficCapDL) {
+        this.areaTrafficCapDL = areaTrafficCapDL;
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/moi/SliceProfile.java b/common/src/main/java/org/onap/so/moi/SliceProfile.java
new file mode 100644 (file)
index 0000000..ec6104f
--- /dev/null
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"sliceProfileId", "plmnInfoList", "RANSliceSubnetProfile"})
+public class SliceProfile {
+
+    @JsonProperty("sliceProfileId")
+    private String sliceProfileId = null;
+
+    @JsonProperty("plmnInfoList")
+    private List<PlmnInfo> plmnInfoList = null;
+
+    @JsonProperty("RANSliceSubnetProfile")
+    private RANSliceSubnetProfile rANSliceSubnetProfile;
+
+    @JsonProperty("sliceProfileId")
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    @JsonProperty("sliceProfileId")
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("plmnInfoList")
+    public List<PlmnInfo> getPlmnInfoList() {
+        return plmnInfoList;
+    }
+
+    @JsonProperty("plmnInfoList")
+    public void setPlmnInfoList(List<PlmnInfo> plmnInfoList) {
+        this.plmnInfoList = plmnInfoList;
+    }
+
+    @JsonProperty("RANSliceSubnetProfile")
+    public RANSliceSubnetProfile getRANSliceSubnetProfile() {
+        return rANSliceSubnetProfile;
+    }
+
+    @JsonProperty("RANSliceSubnetProfile")
+    public void setrANSliceSubnetProfile(RANSliceSubnetProfile rANSliceSubnetProfile) {
+        this.rANSliceSubnetProfile = rANSliceSubnetProfile;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+}
diff --git a/common/src/main/java/org/onap/so/moi/Snssai.java b/common/src/main/java/org/onap/so/moi/Snssai.java
new file mode 100644 (file)
index 0000000..8ed2892
--- /dev/null
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2023 DTAG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.moi;
+
+import com.fasterxml.jackson.annotation.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"sst", "sd"})
+public class Snssai {
+
+    @JsonProperty("sst")
+    private String sst;
+    @JsonProperty("sd")
+    private String sd;
+    @JsonIgnore
+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+    @JsonProperty("sst")
+    public String getSst() {
+        return sst;
+    }
+
+    @JsonProperty("sst")
+    public void setSst(String sst) {
+        this.sst = sst;
+    }
+
+    @JsonProperty("sd")
+    public String getSd() {
+        return sd;
+    }
+
+    @JsonProperty("sd")
+    public void setSd(String sd) {
+        this.sd = sd;
+    }
+
+    @JsonAnyGetter
+    public Map<String, Object> getAdditionalProperties() {
+        return this.additionalProperties;
+    }
+
+    @JsonAnySetter
+    public void setAdditionalProperty(String name, Object value) {
+        this.additionalProperties.put(name, value);
+    }
+
+}
diff --git a/docs/api/apis/ManagedObject3gppServiceInstances.rst b/docs/api/apis/ManagedObject3gppServiceInstances.rst
new file mode 100644 (file)
index 0000000..1d3336a
--- /dev/null
@@ -0,0 +1,262 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2023 DTAG
+
+ManagedObject3gppServiceInstances API
+=====================================
+
+Create a ManagedObject3gppServiceInstances
+++++++++++++++++++++++++++++++++++++++++++
+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description                                                 |
++====================+============================================================+
+|URI                 |onap/so/infra/moi/api/rest/v1/NetworkSliceSubnet/$NSSID     |
++--------------------+------------------------------------------------------------+
+|Operation Type      |PUT                                                         |
++--------------------+------------------------------------------------------------+
+|Content-Type        |application/json                                            |
++--------------------+------------------------------------------------------------+
+
+Request Body:
+
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+|Attribute                          |Qualifier|Cardinality|Content       |Description                            |
++===================================+=========+===========+==============+=======================================+
+|ManagedObject3gppServiceInstances  |M        |1          |allocateMOI   |Content of allocate3gppMOI object      |
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+
+ManagedObject3gppServiceInstances Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|attributes                    |List             |List of Slice Profile Attribute                                    |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+SliceProfileList Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|plmnInfoList                  |List             |Contains plmnInfoList                                              |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|RANSliceSubnetProfile         |Object           |Contains RAN Attributes Object                                     |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+plmnInfoList Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|plmnId                        |Object           |Contains plmnData                                                  |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|snssai                        |Object           |Contains snssai data                                               |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+plmnId Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|mcc                           |integer          |Contains mcc value                                                 |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|mnc                           |integer          |Contains mcc value                                                 |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+snssai Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|sst                           |string           |Contains sst                                                       |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|sd                            |string           |Contains sd                                                        |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+RAN Attribute Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|coverageAreaTAList            |integer          |Contains coverageAreaTAList                                        |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|latency                       |integer          |desired latency of slice                                           |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|areaTrafficCapDL              |integer          |Contains areaTrafficCapDL                                          |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|resourceSharingLevel          |string           |describes slice sharing level                                      |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|serviceType                   |string           |describes serviceType                                              |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|maxNumberofUEs                |integer          |describes maxNumberofUEs                                           |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+Response:
+
++-------------------------+---------+-----------+-----------------+-------------------------------------------+
+|Attribute                |Qualifier|Cardinality|Content          |Description                                |
++=========================+=========+===========+=================+===========================================+
+|requestReferences        |M        |1          |Response Object  |Content of Response object.                |
++----------------+--------+---------+-----------+-----------------+-------------------------------------------+
+
+Response Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute          |Qualifier|Cardinality|Content                   |Description                                |
++===================+=========+===========+==========================+===========================================+
+|requestId          |M        |1          |String                    |Request Id.                                |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails     |M        |1          |requestDetails Object     |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|instanceId         |M        |1          |requestStatus Object      |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+
+
+Terminate/Deallocate a MOI
+++++++++++++++++++++++++++
+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description                                                 |
++====================+============================================================+
+|URI                 |onap/so/infra/moi/api/rest/v1/NetworkSliceSubnet/$NSSID     |
++--------------------+------------------------------------------------------------+
+|Operation Type      |DELETE                                                      |
++--------------------+------------------------------------------------------------+
+|Content-Type        |application/json                                            |
++--------------------+------------------------------------------------------------+
+
+
+Request Body:
+
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+|Attribute                          |Qualifier|Cardinality|Content       |Description                            |
++===================================+=========+===========+==============+=======================================+
+|ManagedObject3gppServiceInstances  |M        |1          |deleteMOI     |Content of deleteMOI object            |
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+
+ManagedObject3gppServiceInstances Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|attributes                    |List             |List of Slice Profile Attribute                                    |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+SliceProfileList Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|sliceProfileId                |string           |slice profile id to be deleted                                     |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+Response
+
++-------------------------+---------+-----------+-----------------+-------------------------------------------+
+|Attribute                |Qualifier|Cardinality|Content          |Description                                |
++=========================+=========+===========+=================+===========================================+
+|requestReferences        |M        |1          |Response Object  |Content of Response object.                |
++-------------------------+---------+-----------+-----------------+-------------------------------------------+
+
+Response Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute          |Qualifier|Cardinality|Content                   |Description                                |
++===================+=========+===========+==========================+===========================================+
+|requestId          |M        |1          |String                    |Request Id.                                |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails     |M        |1          |requestDetails Object     |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|instanceId         |M        |1          |requestStatus Object      |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+
+
+
+Modify a 3GPP service instance
+++++++++++++++++++++++++++++++
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description                                                 |
++====================+============================================================+
+|URI                 |onap/so/infra/moi/api/rest/v1/NetworkSliceSubnet/$NSSID     |
++--------------------+------------------------------------------------------------+
+|Operation Type      |PATCH                                                       |
++--------------------+------------------------------------------------------------+
+|Content-Type        |application/json                                            |
++--------------------+------------------------------------------------------------+
+
+
+Request Body:
+
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+|Attribute                          |Qualifier|Cardinality|Content       |Description                            |
++===================================+=========+===========+==============+=======================================+
+|ManagedObject3gppServiceInstances  |M        |1          |modifyMOI     |Content of modifyMOI object            |
++-----------------------------------+---------+-----------+--------------+---------------------------------------+
+
+
+ManagedObject3gppServiceInstances Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|attributes                    |List             |List of Slice Profile Attribute                                    |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+SliceProfileList Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|sliceProfileId                |string           |slice profile id to be modify                                      |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|RANSliceSubnetProfile         |Object           |Contains RAN Attributes Object                                     |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+RAN Attribute Object
+
++------------------------------+-----------------+-------------------------------------------------------------------+
+|Attribute                     |Content          |Description                                                        |
++==============================+=================+===================================================================+
+|coverageAreaTAList            |integer          |Contains coverageAreaTAList                                        |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|latency                       |integer          |desired latency of slice                                           |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|areaTrafficCapDL              |integer          |Contains areaTrafficCapDL                                          |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|resourceSharingLevel          |string           |describes slice sharing level                                      |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|serviceType                   |string           |describes serviceType                                              |
++------------------------------+-----------------+-------------------------------------------------------------------+
+|maxNumberofUEs                |integer          |describes maxNumberofUEs                                           |
++------------------------------+-----------------+-------------------------------------------------------------------+
+
+
+Response:
+
++-------------------------+---------+-----------+-----------------+-------------------------------------------+
+|Attribute                |Qualifier|Cardinality|Content          |Description                                |
++=========================+=========+===========+=================+===========================================+
+|requestReferences        |M        |1          |Response Object  |Content of Response object.                |
++-------------------------+---------+-----------+-----------------+-------------------------------------------+
+
+Response Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute          |Qualifier|Cardinality|Content                   |Description                                |
++===================+=========+===========+==========================+===========================================+
+|requestId          |M        |1          |String                    |Request Id.                                |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails     |M        |1          |requestDetails Object     |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|instanceId         |M        |1          |requestStatus Object      |Type of the request.                       |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
\ No newline at end of file
index 11e52e8..fa872db 100644 (file)
@@ -46,3 +46,4 @@ Detailed documentation can be found here:
    apis/e2eServiceInstances-api.rst
    apis/onap3gppServiceInstances-api.rst
    apis/consumed-apis.rst
+   apis/ManagedObject3gppServiceInstances.rst
index ac0e523..1d23498 100644 (file)
@@ -1,7 +1,7 @@
 {
   "openapi": "3.0.1",
   "info": {
-    "title": "SO Guilin APIs",
+    "title": "SO London APIs",
     "version": "3.1.2"
   },
   "servers": [
@@ -48,6 +48,9 @@
     },
     {
       "name": "onapsoinfrainstanceManagement"
+    },
+    {
+      "name": "ManagedObject3gppServiceInstances"
     }
   ],
   "paths": {
         },
         "x-codegen-request-body-name": "body"
       }
+    },
+    "/onap/so/infra/moi/api/rest/{version}/NetworkSliceSubnet/{NSSID}": {
+      "put": {
+        "tags": [
+          "ManagedObject3gppServiceInstances"
+        ],
+        "summary": "Create a 3GPP MOI NSSI on a version provided",
+        "operationId": "createMOI",
+        "parameters": [
+          {
+            "name": "version",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "pattern": "[vV][1]",
+              "type": "string"
+            }
+          },
+          {
+            "name": "NSSID",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            }
+          }
+        ],
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "$ref": "#/components/schemas/createMOI"
+              }
+            }
+          },
+          "required": true
+        },
+        "responses": {
+          "default": {
+            "description": "successful operation",
+            "content": {}
+          }
+        },
+        "x-codegen-request-body-name": "body"
+      },
+      "patch": {
+        "tags": [
+          "ManagedObject3gppServiceInstances"
+        ],
+        "summary": "Modify a 3GPP MOI NSSI on a version provided",
+        "operationId": "modifyMOI",
+        "parameters": [
+          {
+            "name": "version",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "pattern": "[vV][1]",
+              "type": "string"
+            }
+          },
+          {
+            "name": "NSSID",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            }
+          }
+        ],
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "$ref": "#/components/schemas/modifyMOI"
+              }
+            }
+          },
+          "required": true
+        },
+        "responses": {
+          "default": {
+            "description": "successful operation",
+            "content": {}
+          }
+        },
+        "x-codegen-request-body-name": "body"
+      },
+      "delete": {
+        "tags": [
+          "ManagedObject3gppServiceInstances"
+        ],
+        "summary": "delete a 3GPP MOI NSSI on a version provided",
+        "operationId": "deleteMOI",
+        "parameters": [
+          {
+            "name": "version",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "pattern": "[vV][1]",
+              "type": "string"
+            }
+          },
+          {
+            "name": "NSSID",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            }
+          }
+        ],
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "$ref": "#/components/schemas/deleteMOI"
+              }
+            }
+          },
+          "required": true
+        },
+        "responses": {
+          "default": {
+            "description": "successful operation",
+            "content": {}
+          }
+        },
+        "x-codegen-request-body-name": "body"
+      },
+      "get": {
+        "tags": [
+          "ManagedObject3gppServiceInstances"
+        ],
+        "summary": "get the slice profile list of given nssiID",
+        "operationId": "getMOI",
+        "parameters": [
+          {
+            "name": "version",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "pattern": "[vV][1]",
+              "type": "string"
+            }
+          },
+          {
+            "name": "NSSID",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            }
+          }
+        ],
+        "responses": {
+          "default": {
+            "description": "successful operation",
+            "content": {}
+          }
+        },
+        "x-codegen-request-body-name": "body"
+      }
     }
   },
   "components": {
         "type": "object",
         "properties": {
           "workflowSpecificationList": {
-            "type": "array",
+            "type": "C",
             "description": "List of Workflow specification data",
             "items": {
               "$ref": "#/components/schemas/WorkflowSpecification"
             }
           }
         ]
+      },
+      "createMOI": {
+        "type": "object",
+        "properties": {
+          "attributes": {
+            "type": "object",
+            "properties": {
+              "sliceProfileList": {
+                "type": "array",
+                "description": "List of slice profile attributes",
+                "items": {
+                  "type": "array",
+                  "description": "List of PlmnData attributes",
+                  "items": {
+                    "plmnid": {
+                      "type": "object",
+                      "properties": {
+                        "mcc": {
+                          "type": "integer",
+                          "description": "mcc"
+                        },
+                        "mnc": {
+                          "type": "integer",
+                          "description": "mnc"
+                        }
+                      }
+                    },
+                    "snssai": {
+                      "type": "object",
+                      "properties": {
+                        "mcc": {
+                          "type": "integer",
+                          "description": "mcc"
+                        },
+                        "mnc": {
+                          "type": "integer",
+                          "description": "mnc"
+                        }
+                      }
+                    }
+                  },
+                  "RANSliceSubnetProfile": {
+                    "type": "object",
+                    "properties": {
+                      "coverageAreaTAList": {
+                        "type": "integer",
+                        "description": "coverageAreaTAList"
+                      },
+                      "latency": {
+                        "type": "integer",
+                        "description": "latency"
+                      },
+                      "areaTrafficCapDL": {
+                        "type": "integer",
+                        "description": "areaTrafficCapDL"
+                      },
+                      "resourceSharingLevel": {
+                        "type": "string",
+                        "description": "resourceSharingLevel"
+                      },
+                      "serviceType": {
+                        "type": "string",
+                        "description": "serviceType"
+                      },
+                      "maxNumberofUEs": {
+                        "type": "integer",
+                        "description": "maxNumberofUEs"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      },
+      "modifyMOI": {
+        "type": "object",
+        "properties": {
+          "attributes": {
+            "type": "object",
+            "properties": {
+              "sliceProfileList": {
+                "type": "array",
+                "description": "List of slice profile attributes",
+                "items": {
+                  "sliceProfileId": {
+                    "type": "string",
+                    "description": "sliceProfileId to be modify"
+                  },
+                  "RANSliceSubnetProfile": {
+                    "type": "object",
+                    "properties": {
+                      "coverageAreaTAList": {
+                        "type": "integer",
+                        "description": "coverageAreaTAList"
+                      },
+                      "latency": {
+                        "type": "integer",
+                        "description": "latency"
+                      },
+                      "areaTrafficCapDL": {
+                        "type": "integer",
+                        "description": "areaTrafficCapDL"
+                      },
+                      "resourceSharingLevel": {
+                        "type": "string",
+                        "description": "resourceSharingLevel"
+                      },
+                      "serviceType": {
+                        "type": "string",
+                        "description": "serviceType"
+                      },
+                      "maxNumberofUEs": {
+                        "type": "integer",
+                        "description": "maxNumberofUEs"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      },
+      "deleteMOI": {
+        "type": "object",
+        "properties": {
+          "attributes": {
+            "type": "object",
+            "properties": {
+              "sliceProfileList": {
+                "type": "object",
+                "description": "List of slice profile attributes",
+                "properties": {
+                  "sliceProfileId": {
+                    "type": "string",
+                    "description": "sliceProfileId to be modify"
+                  }
+                }
+              }
+            }
+          }
+        }
       }
     }
   }
index bf9ad56..03260db 100644 (file)
@@ -36,6 +36,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.aaiclient.client.graphinventory.Format;
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -114,6 +115,17 @@ public class AAIRestClientImpl implements AAIRestClientI {
         return Optional.ofNullable(response.readEntity(ServiceInstance.class));
     }
 
+    public Optional<ServiceInstance> getServiceInstanceByIdWithDepth(String serviceInstanceId, String serviceType,
+            String globalSubscriberId) {
+        Response response =
+                new AAIResourcesClient()
+                        .getFullResponse(AAIUriFactory
+                                .createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+                                        .serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
+                                .depth(Depth.ALL));
+        return Optional.ofNullable(response.readEntity(ServiceInstance.class));
+    }
+
     @Override
     public void updateServiceInstance(String serviceInstanceId, String serviceType, String globalSubscriberId,
             ServiceInstance serviceInstance) {
index 5d23811..a5f5a72 100644 (file)
@@ -49,5 +49,8 @@ public enum Action implements Actions {
     addMembers,
     removeMembers,
     forCustomWorkflow,
+    createRanSlice,
+    modifyRanSlice,
+    deleteRanSlice,
     upgradeCnf
 }
index 031e9ee..43fbb0b 100644 (file)
@@ -93,6 +93,7 @@ public class JerseyConfiguration extends ResourceConfig {
         register(RequestConflictMapper.class);
         register(WorkflowEngineConnectionMapper.class);
         register(OrchestrationTasks.class);
+        register(ManagedObject3gppServiceInstances.class);
         // this registration seems to be needed to get predictable
         // execution behavior for the above JSON Exception Mappers
         register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManagedObject3gppServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManagedObject3gppServiceInstances.java
new file mode 100644 (file)
index 0000000..605e2a8
--- /dev/null
@@ -0,0 +1,568 @@
+/*-
+ * ============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.apihandlerinfra;
+
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.aaiclient.client.aai.AAIRestClientImpl;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandler.common.*;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.moi.*;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.onap.so.serviceinstancebeans.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import javax.ws.rs.*;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.sql.Timestamp;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Component
+@Path("/onap/so/infra/moi/api/rest/")
+@OpenAPIDefinition(
+        info = @Info(title = "/onap/so/infra/moi/api/rest/", description = "API Requests for 3gpp MO Instances"))
+public class ManagedObject3gppServiceInstances {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ManagedObject3gppServiceInstances.class);
+
+    private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+    private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+
+    private static final String SAVE_TO_DB = "save instance to db";
+
+    private static final String URI_PREFIX = "/moi/api/rest/";
+
+    @Autowired
+    private MsoRequest msoRequest;
+
+    @Autowired
+    private CatalogDbClient catalogDbClient;
+
+    @Autowired
+    private RequestsDbClient requestsDbClient;
+
+    @Autowired
+    private RequestHandlerUtils requestHandlerUtils;
+
+    @Autowired
+    private ResponseBuilder builder;
+
+    @Autowired
+    private CamundaClient camundaClient;
+
+    @Autowired
+    private ResponseHandler responseHandler;
+
+    private AAIRestClientImpl aaiRestClient = new AAIRestClientImpl();
+
+    /**
+     * POST Requests for 3GPP MOI Service create nssi on a version provided
+     *
+     * @throws ApiException
+     */
+
+    @PUT
+    @Path("/{version:[vV][1]}/NetworkSliceSubnet/{id}")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Operation(description = "Create a 3GPP MOI NSSI on a version provided", responses = @ApiResponse(
+            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+    public Response allocateNssi(MoiAllocateRequest request, @PathParam("version") String version,
+            @PathParam("id") String id, @Context ContainerRequestContext requestContext) throws ApiException {
+        String requestId = requestHandlerUtils.getRequestId(requestContext);
+        HashMap<String, String> instanceIdMap = new HashMap<>();
+        instanceIdMap.put("serviceInstanceId", id);
+        return processAllocateRequest(request, Action.createRanSlice, version, requestId, instanceIdMap,
+                requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+    }
+
+    @PATCH
+    @Path("/{version:[vV][1]}/NetworkSliceSubnet/{id}")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Operation(description = "Modify a 3GPP MOI NSSI on a version provided", responses = @ApiResponse(
+            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+    public Response modifyNssi(MoiAllocateRequest request, @PathParam("version") String version,
+            @PathParam("id") String id, @Context ContainerRequestContext requestContext) throws ApiException {
+        String requestId = requestHandlerUtils.getRequestId(requestContext);
+        HashMap<String, String> instanceIdMap = new HashMap<>();
+        instanceIdMap.put("serviceInstanceId", id);
+        return processAllocateRequest(request, Action.modifyRanSlice, version, requestId, instanceIdMap,
+                requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+    }
+
+    /**
+     * DELETE Requests to delete 3GPP MOI Service instance on a version provided
+     *
+     * @throws ApiException
+     */
+    @DELETE
+    @Path("/{version:[vV][1]}/NetworkSliceSubnet/{id}")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Operation(description = "Delete a 3GPP MOI NSSI on a version provided", responses = @ApiResponse(
+            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+    public Response deleteNssi(MoiAllocateRequest request, @PathParam("version") String version,
+            @PathParam("id") String id, @Context ContainerRequestContext requestContext) throws ApiException {
+        String requestId = requestHandlerUtils.getRequestId(requestContext);
+        HashMap<String, String> instanceIdMap = new HashMap<>();
+        instanceIdMap.put("serviceInstanceId", id);
+        return processAllocateRequest(request, Action.deleteRanSlice, version, requestId, instanceIdMap,
+                requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+    }
+
+    /**
+     * GET Requests for 3GPP MOI Service get nssi on a version provided
+     *
+     * @throws ApiException
+     */
+    @GET
+    @Operation(description = "Find slice Profile for nssi id", responses = @ApiResponse(
+            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Vnf.class)))))
+    @Path("/{version:[vV][1]}/NetworkSliceSubnet/{id}")
+    @Produces({MediaType.APPLICATION_JSON})
+    @Transactional(readOnly = true)
+    public Response getMOIAttributes(@PathParam("version") String version, @PathParam("id") String id)
+            throws ApiException {
+        GETMoiResponse mOIResponse = new GETMoiResponse();
+        String response = null;
+
+        Optional<ServiceInstance> serviceInstance = aaiRestClient.getServiceInstanceById(id, "5G", "5GCustomer");
+        if (serviceInstance.isPresent()) {
+            LOGGER.info("Id from request {}", id);
+            ServiceInstance serviceInstanceObj = serviceInstance.get();
+            mOIResponse.setId(serviceInstanceObj.getServiceInstanceId());
+            mOIResponse.setAdministrativeState(serviceInstanceObj.getOperationalStatus());
+            mOIResponse.setOperationalState(serviceInstanceObj.getOrchestrationStatus());
+
+
+            Attributes attributes = new Attributes();
+            List<org.onap.so.moi.SliceProfile> sliceProfileList = new ArrayList<org.onap.so.moi.SliceProfile>();
+
+            List<Relationship> listOfNssiRelationship = serviceInstanceObj.getRelationshipList().getRelationship();
+
+            List<Relationship> listOfNssiRelationshipAR = listOfNssiRelationship.stream()
+                    .filter(relationship -> relationship.getRelatedTo().equalsIgnoreCase("allotted-resource"))
+                    .collect(Collectors.toList());
+
+            for (Relationship relationship : listOfNssiRelationshipAR) {
+                org.onap.so.moi.SliceProfile sliceProfile = new org.onap.so.moi.SliceProfile();
+                for (RelationshipData relationshipData : relationship.getRelationshipData()) {
+                    if (relationshipData.getRelationshipKey()
+                            .equalsIgnoreCase("service-instance.service-instance-id")) {
+                        String sliceProfileInstanceId = relationshipData.getRelationshipValue();
+                        LOGGER.debug(">>> sliceProfileInstance: {}", sliceProfileInstanceId);
+
+                        Optional<ServiceInstance> sliceProfileServiceInstance = aaiRestClient
+                                .getServiceInstanceByIdWithDepth(sliceProfileInstanceId, "5G", "5GCustomer");
+                        if (sliceProfileServiceInstance.isPresent()) {
+                            ServiceInstance sliceProfileServiceInstanceObj = sliceProfileServiceInstance.get();
+                            SliceProfile sliceProfile1 =
+                                    sliceProfileServiceInstanceObj.getSliceProfiles().getSliceProfile().get(0);
+                            try {
+                                sliceProfileList
+                                        .add(AAISliceProfileToMOISlice(sliceProfile1, sliceProfileServiceInstanceObj));
+                            } catch (Exception e) {
+                                LOGGER.info("Can not construct responce {}", e);
+                            }
+
+                        }
+
+
+                    }
+                }
+
+            }
+
+            attributes.setSliceProfileList(sliceProfileList);
+            mOIResponse.setAttributes(attributes);
+            ObjectMapper mapper = new ObjectMapper();
+            try {
+                response = mapper.writeValueAsString(mOIResponse);
+            } catch (Exception exception) {
+                LOGGER.error("Error while creating MOIResponse JSON" + exception.getMessage());
+            }
+
+            return builder.buildResponse(HttpStatus.SC_OK, null, response, version);
+
+
+        }
+        return builder.buildResponse(HttpStatus.SC_NOT_FOUND, null, null, version);
+    }
+
+    private org.onap.so.moi.SliceProfile AAISliceProfileToMOISlice(SliceProfile sliceProfile,
+            ServiceInstance serviceInstance) {
+        org.onap.so.moi.SliceProfile sliceProfileMoi = new org.onap.so.moi.SliceProfile();
+
+        sliceProfileMoi.setSliceProfileId(sliceProfile.getProfileId());
+
+        String serviceType = serviceInstance.getServiceType();
+
+        // rANSliceSubnetProfile
+        RANSliceSubnetProfile ranSliceSubnetProfile = new RANSliceSubnetProfile();
+        ranSliceSubnetProfile.setServiceType(serviceType);
+        ranSliceSubnetProfile.setdLLatency(sliceProfile.getLatency());
+        ranSliceSubnetProfile.setCoverageAreaTAList(Integer.valueOf(sliceProfile.getCoverageAreaTAList()));
+        ranSliceSubnetProfile.setMaxNumberofUEs(sliceProfile.getMaxNumberOfUEs());
+        ranSliceSubnetProfile.setResourceSharingLevel(sliceProfile.getResourceSharingLevel());
+        ranSliceSubnetProfile.setAreaTrafficCapDL(sliceProfile.getAreaTrafficCapDL());
+
+        // plmnId
+        String[] plmnIdData = serviceInstance.getServiceInstanceLocationId().split("-");
+        PlmnId plmnId = new PlmnId();
+        plmnId.setMcc(Integer.valueOf(plmnIdData[0]));
+        plmnId.setMnc(Integer.valueOf(plmnIdData[1]));
+
+        // snssai
+        String[] snssaiData = serviceInstance.getEnvironmentContext().split("-");
+        Snssai snssai = new Snssai();
+        snssai.setSst(snssaiData[0]);
+        snssai.setSd(snssaiData[1]);
+
+        // Plmninfo
+        PlmnInfo plmnInfo = new PlmnInfo();
+        plmnInfo.setPlmnId(plmnId);
+        plmnInfo.setSnssai(snssai);
+
+        List<PlmnInfo> plmnInfoList = new ArrayList<PlmnInfo>();
+        plmnInfoList.add(plmnInfo);
+
+        sliceProfileMoi.setrANSliceSubnetProfile(ranSliceSubnetProfile);
+        sliceProfileMoi.setPlmnInfoList(plmnInfoList);
+
+        return sliceProfileMoi;
+
+    }
+
+    /**
+     * Process allocate service request and send request to corresponding workflow
+     *
+     * @param request
+     * @param action
+     * @param version
+     * @return
+     * @throws ApiException
+     */
+    private Response processAllocateRequest(MoiAllocateRequest request, Action action, String version, String requestId,
+            HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+        String defaultServiceModelName = "UUI_DEFAULT";
+        String requestScope = ModelType.service.name();
+        String apiVersion = version.substring(1);
+        String serviceRequestJson = toString.apply(request);
+
+        ServiceInstancesRequest sir = createServiceInstanceRequest(request, requestId);
+        String requestDetails = null;
+        try {
+            requestDetails = new ObjectMapper().writeValueAsString(sir);
+            LOGGER.debug(">>> sir: {}", sir);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        if (serviceRequestJson != null) {
+            InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+                    requestScope, serviceRequestJson);
+            // instanceName ???
+            String instanceId = instanceIdMap.get("serviceInstanceId");
+            String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
+            requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+                    instanceName);
+
+            requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, instanceId, instanceIdMap);
+            try {
+                requestsDbClient.save(currentActiveReq);
+            } catch (Exception e) {
+                LOGGER.error("Exception occurred", e);
+                ErrorLoggerInfo errorLoggerInfo =
+                        new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+                                .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+                throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+                        HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+                                .errorInfo(errorLoggerInfo).build();
+            }
+
+            RecipeLookupResult recipeLookupResult;
+            try {
+                recipeLookupResult = getServiceInstanceOrchestrationURI("123", action, defaultServiceModelName);
+
+                LOGGER.debug("recipeLookupResult: {}", recipeLookupResult);
+            } catch (Exception e) {
+                LOGGER.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+                        ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+                Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                        MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+                        ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+                LOGGER.debug(END_OF_THE_TRANSACTION + response.getEntity());
+                return response;
+            }
+
+            if (recipeLookupResult == null) {
+                LOGGER.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+                        MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+                Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+                        MsoException.ServiceException, "Recipe does not exist in catalog DB",
+                        ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+                LOGGER.debug(END_OF_THE_TRANSACTION + response.getEntity());
+                return response;
+            }
+
+            String serviceInstanceType = sir.getRequestDetails().getRequestParameters().getSubscriptionServiceType();
+            RequestClientParameter parameter;
+            try {
+                parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+                        .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+                        .setServiceInstanceId(instanceId).setServiceType(serviceInstanceType)
+                        .setRequestDetails(requestDetails).setApiVersion(version).setALaCarte(false)
+                        .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion)
+                        .setRequestUri(requestUri).build();
+            } catch (Exception e) {
+                LOGGER.error("Exception occurred", e);
+                ErrorLoggerInfo errorLoggerInfo =
+                        new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+                                .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+                throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
+                        HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+                                .build();
+            }
+            return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+        } else {
+            Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+                    MsoException.ServiceException, "JsonProcessingException occurred - serviceRequestJson is null",
+                    ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+            return response;
+        }
+    }
+
+
+    private ServiceInstancesRequest createServiceInstanceRequest(MoiAllocateRequest request, String id) {
+
+        RequestDetails requestDetails = new RequestDetails();
+        RequestInfo requestInfo = new RequestInfo();
+        requestInfo.setInstanceName("ran_nssi_" + id);
+        requestInfo.setRequestorId("MO");
+        requestInfo.setProductFamilyId("5G");
+        requestInfo.setSource("MO");
+
+        requestDetails.setRequestInfo(requestInfo);
+
+        SubscriberInfo subscriberInfo = new SubscriberInfo();
+        subscriberInfo.setGlobalSubscriberId("5GCustomer");
+        requestDetails.setSubscriberInfo(subscriberInfo);
+
+        Project project = new Project();
+        project.setProjectName("basicnw-project");
+        requestDetails.setProject(project);
+
+        OwningEntity owningEntity = new OwningEntity();
+        owningEntity.setOwningEntityId("67f2e84c-734d-4e90-a1e4-d2ffa2e75849");
+        owningEntity.setOwningEntityName("OE-5GCustomer");
+        requestDetails.setOwningEntity(owningEntity);
+
+        RequestParameters requestParameters = new RequestParameters();
+        requestParameters.setaLaCarte(false);
+        requestParameters.setSubscriptionServiceType("5G");
+
+        Map<String, Object> nssiUserParams = new HashMap<>();
+        Attributes attributes = request.getAttributes();
+        nssiUserParams.put("nssi", attributes);
+
+        Map<String, Object> homingSolution = new HashMap<>();
+        homingSolution.put("Homing_Solution", "true");
+
+        List<Map<String, Object>> userParams = new ArrayList<>();
+
+        userParams.add(nssiUserParams);
+        userParams.add(homingSolution);
+
+        requestParameters.setUserParams(userParams);
+
+        requestDetails.setRequestParameters(requestParameters);
+
+        ServiceInstancesRequest sir = new ServiceInstancesRequest();
+        sir.setServiceInstanceId(id);
+        sir.setRequestDetails(requestDetails);
+
+        return sir;
+    }
+
+    public InfraActiveRequests createRequestObject(Object request, Action action, String requestId, Status status,
+            String requestScope, String requestJson) {
+        InfraActiveRequests aq = new InfraActiveRequests();
+        try {
+            String serviceInstanceName = null;
+            String serviceInstanceId = null;
+            if (action.name().equals("ranSlice")) {
+                serviceInstanceName = "ran_nssi_" + requestId;
+                aq.setServiceInstanceName(serviceInstanceName);
+            } else if (action.name().equals("updateInstance")) {
+                LOGGER.debug(">>>>> updateInstance");
+            }
+
+            aq.setRequestId(requestId);
+            aq.setRequestAction(action.toString());
+            aq.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+            Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+            aq.setStartTime(startTimeStamp);
+            aq.setRequestScope(requestScope);
+            aq.setRequestBody(requestJson);
+            aq.setRequestStatus(status.toString());
+            aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+        } catch (Exception e) {
+            LOGGER.error("Exception when creation record request", e);
+
+            if (!status.equals(Status.FAILED)) {
+                throw e;
+            }
+        }
+        return aq;
+    }
+
+    /**
+     * Getting recipes from catalogDb
+     *
+     * @param serviceModelUUID the service model version uuid
+     * @param action the action for the service
+     * @param defaultServiceModelName default service name
+     * @return the service recipe result
+     */
+    private RecipeLookupResult getServiceInstanceOrchestrationURI(String serviceModelUUID, Action action,
+            String defaultServiceModelName) {
+
+        RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action, defaultServiceModelName);
+
+        if (recipeLookupResult != null) {
+            LOGGER.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: "
+                    + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+        } else {
+            LOGGER.debug("No matching recipe record found");
+        }
+        return recipeLookupResult;
+    }
+
+    Function<Object, String> toString = serviceRequest -> {
+        ObjectMapper mapper = new ObjectMapper();
+        String requestAsString = null;
+        try {
+            requestAsString = mapper.writeValueAsString(serviceRequest);
+        } catch (JsonProcessingException e) {
+            LOGGER.debug("Exception while converting service request object to String {}", e);
+        }
+        return requestAsString;
+    };
+
+    /**
+     * Getting recipes from catalogDb If Service recipe is not set, use default recipe, if set , use special recipe.
+     *
+     * @param serviceModelUUID the service version uuid
+     * @param action the action of the service.
+     * @param defaultServiceModelName default service name
+     * @return the service recipe result.
+     */
+    private RecipeLookupResult getServiceURI(String serviceModelUUID, Action action, String defaultServiceModelName) {
+
+        Service defaultServiceRecord =
+                catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+        // set recipe as default generic recipe
+        ServiceRecipe recipe =
+                catalogDbClient.getFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name());
+        // check the service special recipe
+        if (null != serviceModelUUID && !serviceModelUUID.isEmpty()) {
+            ServiceRecipe serviceSpecialRecipe =
+                    catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceModelUUID, action.name());
+            if (null != serviceSpecialRecipe) {
+                // set service special recipe.
+                recipe = serviceSpecialRecipe;
+            }
+        }
+
+        if (recipe == null) {
+            return null;
+        }
+        return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout(), recipe.getParamXsd());
+
+    }
+
+    private Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter parameter,
+            String orchestrationURI, String requestScope) throws ApiException {
+        ResponseEntity<String> response =
+                requestHandlerUtils.postRequest(currentActiveReq, parameter, orchestrationURI);
+        LOGGER.debug("BPEL response : " + response);
+        int bpelStatus = responseHandler.setStatus(response.getStatusCodeValue());
+        String jsonResponse;
+        try {
+            responseHandler.acceptedResponse(response);
+            CamundaResponse camundaResponse = responseHandler.getCamundaResponse(response);
+            String responseBody = camundaResponse.getResponse();
+            if ("Success".equalsIgnoreCase(camundaResponse.getMessage())) {
+                jsonResponse = responseBody;
+            } else {
+                BPMNFailureException bpmnException =
+                        new BPMNFailureException.Builder(String.valueOf(bpelStatus) + responseBody, bpelStatus,
+                                ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
+                requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, bpmnException.getMessage());
+                throw bpmnException;
+            }
+        } catch (ApiException e) {
+            requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, e.getMessage());
+            throw e;
+        }
+        return builder.buildResponse(HttpStatus.SC_ACCEPTED, parameter.getRequestId(), jsonResponse,
+                parameter.getApiVersion());
+    }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfile.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfile.json
new file mode 100644 (file)
index 0000000..4ad4b8d
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "sliceProfileList": [
+    {
+      "plmnInfoList": [
+        {
+          "plmnId": {
+            "mcc": 260,
+            "mnc": 70
+          },
+          "snssai": {
+            "sst": "001",
+            "sd": "300"
+          }
+        }
+      ],
+      "rANSliceSubnetProfile": {
+        "coverageAreaTAList": 888,
+        "dLLatency": 20,
+        "uLLatency": 20,
+        "resourceSharingLevel": "SHARED",
+        "serviceType": "eMBB",
+        "maxNumberofUEs": 2000
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfileBadGateWay.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/CreateSliceProfileBadGateWay.json
new file mode 100644 (file)
index 0000000..ecf636d
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "sliceProfileList": [
+    {
+      "plmnInfoList": [
+        {
+          "plmnId": {
+            "mcc": 260,
+            "mnc": 70
+          },
+          "snssai": {
+            "sst": "test",
+            "sd": "test"
+          }
+        }
+      ],
+      "rANSliceSubnetProfile": {
+        "coverageAreaTAList": "test",
+        "dLLatency": 20,
+        "uLLatency": 20,
+        "resourceSharingLevel": "SHARED",
+        "serviceType": "eMBB",
+        "maxNumberofUEs": 2000
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/DeleteSliceProfile.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/DeleteSliceProfile.json
new file mode 100644 (file)
index 0000000..15cc4d4
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "attributes": {
+    "sliceProfileList": [
+      {
+        "sliceProfileId": "f832ea13-04c2-4bd5-b93e-4cb7e1fd7f44"
+      }
+    ]
+  }
+}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/ModifySliceProfile.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ManagedObject3gppServiceInstancesTest/ModifySliceProfile.json
new file mode 100644 (file)
index 0000000..f03a7be
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "attributes": {
+    "sliceProfileList": [{
+      "sliceProfileId": "a1e5d51f-4bcb-42f0-83e2-cde6ac0a2e66",
+      "RANSliceSubnetProfile": {
+        "coverageAreaTAList": 777,
+        "dLLatency": 200,
+        "uLLatency": 200,
+        "resourceSharingLevel":"SHARED"
+      }
+    }]
+  }
+}
\ No newline at end of file