aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy33
4 files changed, 44 insertions, 19 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;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 88014e7b54..3e834fa7bb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusResponse
import org.onap.so.beans.nsmf.NssiResponse
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ResponseDescriptor
@@ -17,7 +18,6 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
class DoAllocateNSSI extends AbstractServiceTaskProcessor {
@@ -34,7 +34,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles"
- private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s"
+ private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s"
@Override
void preProcessRequest(DelegateExecution execution) {
@@ -64,11 +64,12 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL,
objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String respBody = responseEntity.getBody()
- NssiResponse result = objectMapper.readValue(respBody, NssiResponse.class)
- //todo: if success
- //todo:
+
+ if (response != null) {
+ NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class)
+ execution.setVariable("nssiAllocateResult", nssiResponse)
+ }
+
execution.setVariable("serviceInfo", nbiRequest.getServiceInfo())
execution.setVariable("esrInfo", nbiRequest.getEsrInfo())
}
@@ -96,13 +97,14 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
String response =
nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String result = responseEntity.getBody()
- //todoï¼›if success
- ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class)
+ if (response != null) {
+ JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class)
+ execution.setVariable("nssiAllocateStatus", jobStatusResponse)
- //todo: handle status
- execution.setVariable("nssiAllocateResult", responseDescriptor)
+ if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+ execution.setVariable("jobFinished", true)
+ }
+ }
}
void prepareUpdateOrchestrationTask(DelegateExecution execution) {
@@ -111,10 +113,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor
+ JobStatusResponse jobStatusResponse = execution.getVariable("nssiAllocateStatus") as JobStatusResponse
+ ResponseDescriptor response = jobStatusResponse.getResponseDescriptor()
SubnetType subnetType = execution.getVariable("subnetType") as SubnetType
-
SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
sliceTaskInfo.progress = response.getProgress()
sliceTaskInfo.status = response.getStatus()
@@ -127,6 +129,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("sliceTaskInfo", sliceTaskInfo)
+
logger.debug("Finish prepareUpdateOrchestrationTask progress")
}