diff options
author | Enbo Wang <wangenbo@huawei.com> | 2020-09-30 14:36:24 +0800 |
---|---|---|
committer | Enbo Wang <wangenbo@huawei.com> | 2020-10-08 22:54:16 +0800 |
commit | 3b3c6a1911fc242de332241c6f42062772444d46 (patch) | |
tree | 55aedb810a86f484b60c6460b1935db355ebcdae /adapters/mso-nssmf-adapter/src | |
parent | 3db16a3cab82a7155cb6be35ed1adb0890df4a4f (diff) |
Update response processing for DoAllocateNSSI(RAN)
Issue-ID: SO-3274
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Change-Id: I252c54f2d653ac5ed4738f0ea1e7de440f9affd5
Diffstat (limited to 'adapters/mso-nssmf-adapter/src')
3 files changed, 26 insertions, 4 deletions
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 97a4c5e889..2ccd88a358 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 @@ -141,7 +141,9 @@ public abstract class BaseNssmfManager implements NssmfManager { public RestResponse queryJobStatus(NssmfAdapterNBIRequest jobReq, String jobId) throws ApplicationException { this.params.clear(); this.params.put("jobId", jobId); - this.params.put("responseId", jobReq.getResponseId()); + if (jobReq.getResponseId() != null) { + this.params.put("responseId", jobReq.getResponseId()); + } this.urlHandler(); /** 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 d8a9088a42..0d0d896370 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 @@ -127,8 +127,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager { return restUtil.send(nssmfUrl, this.httpMethod, content, header); } - private void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, RestResponse rsp) - throws ApplicationException { + protected void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, + RestResponse rsp) throws ApplicationException { switch (fromString(rspDesc.getStatus())) { case STARTED: diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java index bc7a3d0bb7..8e5793d559 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java @@ -30,6 +30,8 @@ import org.onap.so.adapters.nssmf.util.NssmfAdapterUtil; import org.onap.so.beans.nsmf.DeAllocateNssi; import org.onap.so.beans.nsmf.NssiResponse; import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest; +import org.onap.so.beans.nsmf.ResponseDescriptor; +import org.onap.so.beans.nsmf.JobStatusResponse; import org.onap.so.db.request.beans.ResourceOperationStatus; import java.util.HashMap; import java.util.Map; @@ -72,7 +74,7 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager { restResponse = returnRsp; ResourceOperationStatus status = - new ResourceOperationStatus(serviceInfo.getNsiId(), nssiId, serviceInfo.getServiceUuid()); + new ResourceOperationStatus(serviceInfo.getNsiId(), resp.getJobId(), serviceInfo.getServiceUuid()); status.setResourceInstanceID(nssiId); updateDbStatus(status, restResponse.getStatus(), JobStatus.FINISHED, @@ -111,6 +113,24 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager { } @Override + protected RestResponse doQueryJobStatus(ResourceOperationStatus status) throws ApplicationException { + ResponseDescriptor responseDescriptor = new ResponseDescriptor(); + responseDescriptor.setStatus(JobStatus.FINISHED.toString()); + responseDescriptor.setProgress(100); + + JobStatusResponse jobStatusResponse = new JobStatusResponse(); + jobStatusResponse.setResponseDescriptor(responseDescriptor); + + RestResponse restResponse = new RestResponse(); + restResponse.setStatus(200); + restResponse.setResponseContent(marshal(jobStatusResponse)); + + updateRequestDbJobStatus(responseDescriptor, status, restResponse); + + return restResponse; + } + + @Override protected SelectionType doQueryNSSISelectionCapability() { return SelectionType.NSSMF; } |