From 01e155b7a914f2b411bc7d1acefe0d6c72011369 Mon Sep 17 00:00:00 2001 From: Vodafone Date: Wed, 20 Mar 2019 19:07:53 +0530 Subject: Support for SO to ExtAPI Change-Id: I5789ceb1fd4bd22d3b5ca706e55efe1bf4a3f51a Issue-ID: SO-1421 Co-authored-by: gopal.sabhadiya@vodafone.com Signed-off-by: Vodafone --- .../groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy | 4 ++++ .../groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy | 1 + .../infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 918bcdd4cc..64567a349e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -143,12 +143,14 @@ class ExternalAPIUtil { String uuid = utils.getRequestID() logger.debug( "Generated uuid is: " + uuid) logger.debug( "URL to be used is: " + url) + logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL) client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid) client.addAdditionalHeader("Accept", MediaType.APPLICATION_JSON) + client.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl")) apiResponse = client.get() @@ -179,11 +181,13 @@ class ExternalAPIUtil { String uuid = utils.getRequestID() logger.debug( "Generated uuid is: " + uuid) logger.debug( "URL to be used is: " + url) + logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") httpClient.addAdditionalHeader("X-TransactionId", uuid) + httpClient.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl")) apiResponse = httpClient.post(payload) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy index db11cb6044..837bc77f19 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -146,6 +146,7 @@ class ExternalAPIUtilTest { DelegateExecution delegateExecution = mock(DelegateExecution.class) given(delegateExecution.getVariable("URN_externalapi_auth")).willReturn("value_externalapi_auth") given(delegateExecution.getVariable("URN_mso_msoKey")).willReturn("value_mso_msoKey") + given(delegateExecution.getVariable("SPPartnerUrl")).willReturn("http://LocalExtAPIURL:8080") return delegateExecution } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index c8b48c6703..1578f0f7c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -347,8 +347,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso logger.info(" ***** Started prepare3rdONAPRequest *****") String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") - String extAPIPath = sppartnerUrl + '/serviceOrder' + String extAPIPath = UrnPropertiesReader.getVariable("extapi.endpoint", execution) + '/serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) + execution.setVariable("SPPartnerUrl",sppartnerUrl) // ExternalAPI message format String externalId = execution.getVariable("resourceName") -- cgit 1.2.3-korg