diff options
author | hetengjiao <hetengjiao@chinamobile.com> | 2020-05-13 09:47:41 +0800 |
---|---|---|
committer | HE TENGJIAO <hetengjiao@chinamobile.com> | 2020-05-13 10:30:31 +0000 |
commit | bd190c64e89ffbcbfa7b02d9140650c08d555ef9 (patch) | |
tree | 253999482e92231411d98be3b29b4497da87b6cc /bpmn/MSOCommonBPMN/src/main/groovy/org/onap | |
parent | e19e22cceef71e01f64f83eec9c438f42a81e412 (diff) |
Change bpmn for NSMF to adpte the interface OOF
Issue-ID: SO-2919
Change-Id: I07619e47b4e15f12326f83f5ca3b716fd15871a6
Signed-off-by: hetengjiao <hetengjiao@chinamobile.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org/onap')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 40d76af0ba..8f4dbf7ed0 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -24,8 +24,6 @@ package org.onap.so.bpmn.common.scripts import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.util.OofInfraUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.HomingSolution @@ -37,26 +35,12 @@ import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.domain.Subscriber import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.logging.filter.base.ONAPComponents; -import org.springframework.http.HttpEntity -import org.springframework.http.HttpHeaders -import org.springframework.http.HttpMethod -import org.springframework.http.ResponseEntity -import org.springframework.http.client.BufferingClientHttpRequestFactory -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory -import org.springframework.web.client.RestTemplate -import org.springframework.web.util.UriComponentsBuilder import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.core.MediaType -import javax.ws.rs.core.Response import javax.ws.rs.core.UriBuilder -import javax.xml.ws.http.HTTPException import static org.onap.so.bpmn.common.scripts.GenericUtils.* @@ -330,7 +314,7 @@ class OofUtils { logger.debug( "Completed Building OOF Request") return request } catch (Exception ex) { - logger.debug( "buildRequest Exception: " + ex) + logger.debug( "buildRequest Exception: " + ex) } } @@ -548,10 +532,41 @@ class OofUtils { " \"callbackUrl\": \"${callbackUrl}\"\n" + " },\n") response.append(" \"serviceProfile\": {\n" + - " \"serviceProfileParameters\": \n") + " \"serviceProfileParameters\": ") response.append(json); response.append("\n }\n") response.append("\n}\n") return response.toString() } + + public String buildSelectNSIRequest(String requestId, String nstInfo, Map<String, Object> profileInfo){ + + def transactionId = requestId + logger.debug( "transactionId is: " + transactionId) + String callbackUrl = "http://0.0.0.0:9000/callback/" + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(profileInfo); + StringBuilder response = new StringBuilder(); + response.append( + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"timeout\": 600,\n" + + " \"callbackUrl\": \"${callbackUrl}\"\n" + + " },\n" + + " \"serviceInfo\": {\n" + + " \"serviceInstanceId\": \"\",\n" + + " \"serviceName\": \"\"\n" + + " },\n" + + " \"NSTInfoList\": [\n") + response.append(nstInfo); + response.append("\n ],\n") + response.append("\n \"serviceProfile\": \n") + response.append(json); + response.append("\n }\n") + return response.toString() + } + } |