summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhetengjiao <hetengjiao@chinamobile.com>2020-11-20 10:11:12 +0800
committerhetengjiao <hetengjiao@chinamobile.com>2020-11-23 12:17:12 +0800
commita3761511f6343eba0a478116f958881b6925c4cf (patch)
tree3ad74c60c1bf7e0810e159e66ceb04f674a1aed1
parenta65f924438cda21350682c24e17cba9c493e2192 (diff)
add serializable to fixed cn nssi processing error
Issue-ID: SO-2963 Signed-off-by: hetengjiao <hetengjiao@chinamobile.com> Change-Id: I0c50d7ea14298aa7b7a261faef9d01c811363633
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java3
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java12
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java17
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java11
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy9
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java3
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java6
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java24
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java3
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java5
16 files changed, 76 insertions, 41 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
index 84e1eb2acc..1e3c76cdde 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/consts/NssmfAdapterConsts.java
@@ -91,8 +91,7 @@ public class NssmfAdapterConsts {
private final static String INTERNAL_MODIFY_URL = "/onap/so/infra/3gppservices/{apiVersion}/modify";
//
- private final static String EXTERNAL_QUERY_JOB_STATUS =
- "/api/rest/provMns/{apiVersion}/NSS/jobs/{jobId}?responseId={responseId}";
+ private final static String EXTERNAL_QUERY_JOB_STATUS = "/api/rest/provMns/{apiVersion}/NSS/jobs/{jobId}";
private final static String INTERNAL_QUERY_SUB_NET_CAPABILITY =
"/onap/so/infra/3gppservices/{apiVersion}/subnetCapabilityQuery";
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java
index 9df20bac1c..530cc1be0d 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java
@@ -24,6 +24,9 @@ import lombok.Getter;
@Getter
public enum ActionType {
+ /**
+ * allocate
+ */
ALLOCATE("allocate"),
DEALLOCATE("deallocate"),
@@ -52,4 +55,13 @@ public enum ActionType {
ActionType(String type) {
this.type = type;
}
+
+ public static ActionType getActionType(String value) {
+ for (ActionType actionType : ActionType.values()) {
+ if (actionType.type.equalsIgnoreCase(value)) {
+ return actionType;
+ }
+ }
+ return null;
+ }
}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index 2de6e01693..fb880a91e3 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -31,14 +31,19 @@ import org.onap.so.adapters.nssmf.util.RestUtil;
import org.onap.so.beans.nsmf.*;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Example;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
public abstract class BaseNssmfManager implements NssmfManager {
+ private static final Logger logger = LoggerFactory.getLogger(BaseNssmfManager.class);
+
protected RestUtil restUtil;
protected ResourceOperationStatusRepository repository;
@@ -152,6 +157,7 @@ public abstract class BaseNssmfManager implements NssmfManager {
ResourceOperationStatus status =
getOperationStatus(serviceInfo.getNsiId(), jobId, serviceInfo.getServiceUuid());
+ logger.info("ResourceOperationStatus = {}", status);
this.restResponse = doQueryJobStatus(status);
afterQueryJobStatus(status);
@@ -165,11 +171,18 @@ public abstract class BaseNssmfManager implements NssmfManager {
private ResourceOperationStatus getOperationStatus(String nsiId, String jobId, String serviceUuid) {
+ logger.info("Query operations: nsiId = [{}], jobId = [{}], serviceUuid = [{}]", nsiId, jobId, serviceUuid);
+
ResourceOperationStatus status = new ResourceOperationStatus(nsiId, jobId, serviceUuid);
- Optional<ResourceOperationStatus> optional = repository.findOne(Example.of(status));
+ List<ResourceOperationStatus> resourceOperationStatuses =
+ repository.findByServiceIdAndOperationId(nsiId, jobId);
- return optional.orElse(null);
+ logger.info("resourceOperationStatuses = {}", resourceOperationStatuses);
+ if (resourceOperationStatuses.size() == 0) {
+ return null;
+ }
+ return resourceOperationStatuses.get(0);
}
@Override
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index 3c5be7eb39..4b0e98e8ec 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -75,8 +75,9 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
@Override
protected void afterQueryJobStatus(ResourceOperationStatus status) {
+ logger.info("afterQueryJobStatus = " + status);
if (Integer.parseInt(status.getProgress()) == 100) {
-
+ logger.info("after query finished = " + status);
ActionType jobOperType = ActionType.valueOf(status.getOperType());
if (ActionType.ALLOCATE.equals(jobOperType)) {
@@ -118,6 +119,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
JobStatusResponse jobStatusResponse = unMarshal(restResponse.getResponseContent(), JobStatusResponse.class);
ResponseDescriptor rspDesc = jobStatusResponse.getResponseDescriptor();
+
+ logger.info("status = {}", status);
rspDesc.setNssiId(status.getResourceInstanceID());
jobStatusResponse.setResponseDescriptor(rspDesc);
@@ -152,7 +155,7 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
protected void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status,
RestResponse rsp) throws ApplicationException {
-
+ status.setProgress(Integer.toString(rspDesc.getProgress()));
switch (fromString(rspDesc.getStatus())) {
case STARTED:
updateDbStatus(status, rsp.getStatus(), STARTED, QUERY_JOB_STATUS_SUCCESS);
@@ -168,6 +171,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
case ERROR:
updateDbStatus(status, rsp.getStatus(), ERROR, QUERY_JOB_STATUS_FAILED);
throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED);
+ default:
+ throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED);
}
}
@@ -227,6 +232,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
ResourceOperationStatus status =
new ResourceOperationStatus(serviceInfo.getNsiId(), response.getJobId(), serviceInfo.getServiceUuid());
status.setResourceInstanceID(response.getNssiId());
+ status.setOperType(actionType.toString());
+ status.setProgress("0");
updateDbStatus(status, restResponse.getStatus(), STARTED, NssmfAdapterUtil.getStatusDesc(actionType));
}
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
index 2d79544383..f150f47f4f 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
@@ -77,9 +77,9 @@ public class NssmfAdapterRestTest {
private final static String ALLOCATE = "{\n" + " \"esrInfo\" : {\n" + " \"vendor\" : \"huawei\",\n"
+ " \"networkType\" : \"cn\"\n" + " },\n" + " \"allocateCnNssi\" : {\n"
+ " \"nssiId\" : \"NSST-C-001-HDBNJ-NSSMF-01-A-ZX\",\n" + " \"nssiName\" : \"eMBB-001\",\n"
- + " \"sliceProfile\" : {\n" + " \"sNSSAIList\" : [ \"001-100001\" ],\n"
+ + " \"sliceProfile\" : {\n" + " \"snssaiList\" : [ \"001-100001\" ],\n"
+ " \"sliceProfileId\" : \"ab9af40f13f721b5f13539d87484098\",\n"
- + " \"pLMNIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n"
+ + " \"plmnIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n"
+ " \"perfReqEmbbList\" : [ {\n" + " \"activityFactor\" : 50\n" + " } ]\n"
+ " },\n" + " \"maxNumberofUEs\" : 200,\n"
+ " \"coverageAreaTAList\" : [ \"1\", \"2\", \"3\" ],\n" + " \"latency\" : 6,\n"
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
index 0d86056821..68adf8073b 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
@@ -361,9 +361,10 @@ public class NssmfManagerServiceImplTest {
NssmfAdapterNBIRequest nbiRequest = createNbiRequest();
nbiRequest.setResponseId("7512eb3feb5249eca5ddd742fedddd39");
- Optional<ResourceOperationStatus> optional = Optional.of(operationStatus);
+ List<ResourceOperationStatus> optional = new ArrayList<>();
+ optional.add(operationStatus);
- doAnswer(invocation -> optional).when(repository).findOne(any());
+ doAnswer(invocation -> optional).when(repository).findByServiceIdAndOperationId(any(), any());
createCommonMock(200, nssmf);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index 159f4c48ef..fac8871b52 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -555,8 +555,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//todo: endpointId -> set into tn
allocateTnNssi.setTransportSliceNetworks()
allocateTnNssi.setNetworkSliceInfos()
-
-
+ allocateTnNssi.setSliceProfile(sliceTaskInfo.sliceProfile.trans2TnProfile())
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(sliceParams.suggestNsiId)
+ nsiInfo.setNsiName(sliceParams.suggestNsiName)
+ allocateTnNssi.setNsiInfo(nsiInfo)
//allocateTnNssi.networkSliceInfos
@@ -768,7 +771,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
ServiceInstance rspi = new ServiceInstance()
rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
rspi.setServiceType(sliceTaskInfo.sliceProfile.getSST())
- rspi.setServiceRole("slice-profile-instance")
+ rspi.setServiceRole("slice-profile")
rspi.setOrchestrationStatus(oStatus)
rspi.setServiceInstanceLocationId(sliceTaskInfo.sliceProfile.getPLMNIdList())
rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java b/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java
index 5b070bb00f..3b542faf7f 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AdditionalProperties.java
@@ -26,11 +26,12 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
+@Deprecated
public class AdditionalProperties implements Serializable {
private static final long serialVersionUID = -4020397418955518175L;
- private SliceProfile sliceProfile;
+ private TnSliceProfile sliceProfile;
private List<EndPoint> endPoints;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
index f85cb0cd85..1b0986ca0d 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
@@ -30,7 +30,13 @@ public class AllocateTnNssi implements Serializable {
private static final long serialVersionUID = -7069801712339914746L;
+ private TnSliceProfile sliceProfile;
+
private List<NetworkSliceInfo> networkSliceInfos;
private List<TransportSliceNetwork> transportSliceNetworks;
+
+ private NsiInfo nsiInfo;
+
+ private String scriptName;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
index 1fa84eee59..3a45119195 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
@@ -32,12 +32,12 @@ public class CnSliceProfile implements Serializable {
private static final long serialVersionUID = 6627071735572539536L;
- @JsonProperty(value = "sNSSAIList", required = true)
+ @JsonProperty(value = "snssaiList", required = true)
private List<String> snssaiList;
private String sliceProfileId;
- @JsonProperty(value = "pLMNIdList", required = true)
+ @JsonProperty(value = "plmnIdList", required = true)
private List<String> plmnIdList;
@JsonProperty(value = "perfReq", required = true)
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java b/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java
index 99a8525974..3bf2ffb8eb 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ConnectionLink.java
@@ -20,33 +20,15 @@
package org.onap.so.beans.nsmf;
+import lombok.Data;
import java.io.Serializable;
-
+@Data
public class ConnectionLink implements Serializable {
+
private static final long serialVersionUID = -1834584960407180427L;
private String transportEndpointA;
private String transportEndpointB;
-
- public static long getSerialVersionUID() {
- return serialVersionUID;
- }
-
- public String getTransportEndpointA() {
- return transportEndpointA;
- }
-
- public void setTransportEndpointA(String transportEndpointA) {
- this.transportEndpointA = transportEndpointA;
- }
-
- public String getTransportEndpointB() {
- return transportEndpointB;
- }
-
- public void setTransportEndpointB(String transportEndpointB) {
- this.transportEndpointB = transportEndpointB;
- }
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java b/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java
index 66bfbdcea9..4fc593268a 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PnfErrorList {
+public class PnfErrorList implements Serializable {
+
+ private static final long serialVersionUID = 1506455363755909867L;
private String pnfId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java
index c71441a80a..ee027bca13 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java
@@ -21,10 +21,13 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ResponseHistory {
+public class ResponseHistory implements Serializable {
+
+ private static final long serialVersionUID = -1005342539496792450L;
private int progress;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
index 9b6df0fa9e..ad6eec1c01 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
@@ -90,7 +90,7 @@ public class SliceProfileAdapter implements Serializable {
}
private Integer str2Code(String area) {
- return area.hashCode() >> 16;
+ return Math.abs(area.hashCode() >> 16);
}
public CnSliceProfile trans2CnProfile() {
@@ -100,6 +100,7 @@ public class SliceProfileAdapter implements Serializable {
cnSliceProfile.setCoverageAreaTAList(Arrays.asList(this.coverageAreaTAList.split("\\|")));
cnSliceProfile.setPlmnIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
+ cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel));
PerfReq perfReq = new PerfReq();
// todo
cnSliceProfile.setPerfReq(perfReq);
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java b/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java
index aa2579edf8..c0dd4250b8 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TransportSliceNetwork.java
@@ -25,6 +25,7 @@ import java.util.List;
@Data
public class TransportSliceNetwork implements Serializable {
+
private static final long serialVersionUID = 809947462399806990L;
private List<ConnectionLink> connectionLinks;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java b/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java
index 6388ca6106..a3330e67b4 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class VnfErrorList {
+public class VnfErrorList implements Serializable {
+
+ private static final long serialVersionUID = -2907819676875489281L;
private String vnfInstanceId;