diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
11 files changed, 235 insertions, 80 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index 667ac133af..0153b4b3f9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -25,21 +25,20 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; */ public class Constants { - public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest"; - public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse"; - - public static final String INPUT_PARAMETER = "inputParameter"; + public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest"; + public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse"; + public static final String INPUT_PARAMETER = "inputParameter"; + public static final String DELETE_VNF_RESPONSE_PARAM_NAME = "deleteVnfResponse"; - public static final String DOT = "."; - public static final String UNDERSCORE = "_"; - public static final String SPACE = "\\s+"; + public static final String DOT = "."; + public static final String UNDERSCORE = "_"; + public static final String SPACE = "\\s+"; - public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/"; - public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk"; - - public static final String FORWARD_SLASH = "/"; - public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/"; + public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/"; + public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk"; + public static final String FORWARD_SLASH = "/"; + public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/"; - private Constants() {} + private Constants() {} } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java new file mode 100644 index 0000000000..857c5cb6fe --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/EtsiVnfDeleteTask.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; + +import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.vnfmadapter.v1.model.DeleteVnfResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.google.common.base.Optional; + +/** + * + * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech) + */ +@Component +public class EtsiVnfDeleteTask { + + private static final Logger LOGGER = LoggerFactory.getLogger(EtsiVnfDeleteTask.class); + private final ExtractPojosForBB extractPojosForBB; + private final ExceptionBuilder exceptionUtil; + private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider; + + @Autowired + public EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB, + final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) { + this.exceptionUtil = exceptionUtil; + this.extractPojosForBB = extractPojosForBB; + this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider; + } + + /** + * Invoke VNFM adapter to delete the VNF + * + * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} + */ + public void invokeVnfmAdapter(final BuildingBlockExecution execution) { + try { + LOGGER.debug("Executing invokeVnfmAdapter ..."); + final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); + + final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId()); + + if (!response.isPresent()) { + final String errorMessage = "Unexpected error while processing delete request"; + LOGGER.error(errorMessage); + exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage); + } + + final DeleteVnfResponse vnfResponse = response.get(); + + LOGGER.debug("Vnf delete response: {}", vnfResponse); + execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse); + + LOGGER.debug("Finished executing invokeVnfmAdapter ..."); + } catch (final Exception exception) { + LOGGER.error("Unable to invoke delete request", exception); + exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java index 02303ef09d..a76a4bf3c1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java @@ -22,17 +22,19 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; import org.onap.vnfmadapter.v1.model.CreateVnfRequest; import org.onap.vnfmadapter.v1.model.CreateVnfResponse; - +import org.onap.vnfmadapter.v1.model.DeleteVnfResponse; import com.google.common.base.Optional; /** * Provide a service which interacts with VNFM adapter for instantiating, monitoring VNF - * + * * @author waqas.ikram@est.tech */ public interface VnfmAdapterServiceProvider { - Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request); + Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request); + + Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index afdcccfd36..f727423e85 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -25,13 +25,13 @@ import org.onap.so.rest.exceptions.RestProcessingException; import org.onap.so.rest.service.HttpRestServiceProvider; import org.onap.vnfmadapter.v1.model.CreateVnfRequest; import org.onap.vnfmadapter.v1.model.CreateVnfResponse; +import org.onap.vnfmadapter.v1.model.DeleteVnfResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; - import com.google.common.base.Optional; /** @@ -40,50 +40,85 @@ import com.google.common.base.Optional; @Service public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class); + + private final VnfmAdapterUrlProvider urlProvider; + private final HttpRestServiceProvider httpServiceProvider; + + @Autowired + public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider, + final HttpRestServiceProvider httpServiceProvider) { + this.urlProvider = urlProvider; + this.httpServiceProvider = httpServiceProvider; + } + + @Override + public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, + final CreateVnfRequest request) { + try { + final String url = urlProvider.getCreateInstantiateUrl(vnfId); + + final ResponseEntity<CreateVnfResponse> response = + httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class); + + final HttpStatus httpStatus = response.getStatusCode(); + if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) { + LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value()); + return Optional.absent(); + } + + if (!response.hasBody()) { + LOGGER.error("Received response without body: {}", response); + return Optional.absent(); + } + + final CreateVnfResponse createVnfResponse = response.getBody(); - private final VnfmAdapterUrlProvider urlProvider; - private final HttpRestServiceProvider httpServiceProvider; + if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) { + LOGGER.error("Received invalid instantiation response: {}", response); + return Optional.absent(); + } - @Autowired - public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider, - final HttpRestServiceProvider httpServiceProvider) { - this.urlProvider = urlProvider; - this.httpServiceProvider = httpServiceProvider; + return Optional.of(createVnfResponse); + } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { + LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException); + return Optional.absent(); } - @Override - public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, - final CreateVnfRequest request) { - try { - final String url = urlProvider.getCreateInstantiateUrl(vnfId); + } - final ResponseEntity<CreateVnfResponse> response = - httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class); + @Override + public Optional<DeleteVnfResponse> invokeDeleteRequest(final String vnfId) { + try { + final String url = urlProvider.getDeleteUrl(vnfId); + LOGGER.debug("Will send request to vnfm adapter using url: {}", url); - final HttpStatus httpStatus = response.getStatusCode(); - if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) { - LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value()); - return Optional.absent(); - } + final ResponseEntity<DeleteVnfResponse> response = + httpServiceProvider.deleteHttpRequest(url, DeleteVnfResponse.class); - if (!response.hasBody()) { - LOGGER.error("Received response without body: {}", response); - return Optional.absent(); - } + LOGGER.debug("Response received: ", response); - final CreateVnfResponse createVnfResponse = response.getBody(); + final HttpStatus httpStatus = response.getStatusCode(); - if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) { - LOGGER.error("Received invalid instantiation response: {}", response); - return Optional.absent(); - } + if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) { + LOGGER.error("Unable to invoke HTTP DELETE using URL: {}, Response Code: {}", url, httpStatus.value()); + return Optional.absent(); + } - return Optional.of(createVnfResponse); - } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { - LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException); - return Optional.absent(); - } + if (!response.hasBody()) { + LOGGER.error("Received response without body: {}", response); + return Optional.absent(); + } + final DeleteVnfResponse deleteVnfResponse = response.getBody(); + if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) { + LOGGER.error("Received invalid delete response: {}", response); + return Optional.absent(); + } + return Optional.of(deleteVnfResponse); + } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { + LOGGER.error("Unexpected error while processing delete request", httpInvocationException); + return Optional.absent(); } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java index 03ee0712e7..61063fe90e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks; import java.net.URI; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.util.UriComponentsBuilder; @@ -36,23 +35,34 @@ import org.springframework.web.util.UriComponentsBuilder; @Service public class VnfmAdapterUrlProvider { - private final URI baseUri; - - @Autowired - public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) { - this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri(); - } - - /** - * Get VNFM create and instantiate URL - * - * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in - * AAI. - * @return VNFM create and instantiate URL - */ - public String getCreateInstantiateUrl(final String vnfId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString(); - } + private final URI baseUri; + + @Autowired + public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) { + this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri(); + } + + /** + * Get VNFM create and instantiate URL + * + * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in + * AAI. + * @return VNFM create and instantiate URL + */ + public String getCreateInstantiateUrl(final String vnfId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString(); + } + + /** + * Get VNFM delete URL + * + * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in + * AAI. + * @return VNFM delete URL + */ + public String getDeleteUrl(final String vnfId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString(); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java index b11e2caafa..7b86756afa 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java @@ -21,6 +21,7 @@ package org.onap.so.client.sdnc.mapper; import java.net.URI; +import java.util.UUID; import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation; @@ -52,9 +53,13 @@ public class GCTopologyOperationRequestMapper { Configuration vnrConfiguration, GenericVnf voiceVnf, String sdncReqId,URI callbackUri) { + String msoRequestId = UUID.randomUUID().toString(); + if (requestContext != null && requestContext.getMsoRequestId() != null) { + msoRequestId = requestContext.getMsoRequestId(); + } GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation(); GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString()); - GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction); + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction); GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, false); GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = generalTopologyObjectMapper.buildConfigurationInformation(vnrConfiguration,true); GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = generalTopologyObjectMapper.buildGcRequestInformation(voiceVnf,null); @@ -74,11 +79,15 @@ public class GCTopologyOperationRequestMapper { RequestContext requestContext, Configuration vnrConfiguration, String sdncReqId, URI callbackUri) { + String msoRequestId = null; + if (requestContext != null) { + msoRequestId = requestContext.getMsoRequestId(); + } GenericResourceApiGcTopologyOperationInformation req = new GenericResourceApiGcTopologyOperationInformation(); GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId,callbackUri.toString()); GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper - .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, + .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, GenericResourceApiRequestActionEnumeration.DELETEGENERICCONFIGURATIONINSTANCE); GenericResourceApiServiceinformationServiceInformation serviceInformation = new GenericResourceApiServiceinformationServiceInformation(); serviceInformation.setServiceInstanceId(serviceInstance.getServiceInstanceId()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java index b086b8a7ff..756e5b068e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java @@ -60,10 +60,10 @@ public class GeneralTopologyObjectMapper { /* * Build GenericResourceApiRequestinformationRequestInformation */ - public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String sdncReqId, GenericResourceApiRequestActionEnumeration requestAction){ + public GenericResourceApiRequestinformationRequestInformation buildGenericResourceApiRequestinformationRequestInformation(String msoReqId, GenericResourceApiRequestActionEnumeration requestAction){ GenericResourceApiRequestinformationRequestInformation requestInformation = new GenericResourceApiRequestinformationRequestInformation(); - requestInformation.setRequestId(sdncReqId); + requestInformation.setRequestId(msoReqId); requestInformation.setRequestAction(requestAction); requestInformation.setSource("MSO"); return requestInformation; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java index 188a228e5d..aef7e9e044 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java @@ -57,8 +57,12 @@ public class NetworkTopologyOperationRequestMapper { Customer customer, RequestContext requestContext, CloudRegion cloudRegion) { GenericResourceApiNetworkOperationInformation req = new GenericResourceApiNetworkOperationInformation(); String sdncReqId = UUID.randomUUID().toString(); + String msoRequestId = UUID.randomUUID().toString(); + if (requestContext != null && requestContext.getMsoRequestId() != null) { + msoRequestId = requestContext.getMsoRequestId(); + } GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId); - GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, reqAction); + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction); GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network); GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion); @@ -68,7 +72,7 @@ public class NetworkTopologyOperationRequestMapper { req.setServiceInformation(serviceInformation); req.setNetworkInformation(networkInformation); - if (requestContext.getUserParams() != null) { + if (requestContext != null && requestContext.getUserParams() != null) { for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiParam networkInputParameters = new GenericResourceApiParam(); GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java index 505466b22c..cdb4ab96aa 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java @@ -49,9 +49,13 @@ public class ServiceTopologyOperationMapper{ SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction,ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) { String sdncReqId = UUID.randomUUID().toString(); + String msoRequestId = UUID.randomUUID().toString(); + if (requestContext != null && requestContext.getMsoRequestId() != null) { + msoRequestId = requestContext.getMsoRequestId(); + } GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation(); GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId); - GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, resourceAction); + GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction); GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput(); @@ -62,7 +66,7 @@ public class ServiceTopologyOperationMapper{ servOpInput.setServiceInformation(servInfo); servOpInput.setServiceRequestInput(servReqInfo); - if(requestContext.getUserParams()!=null){ + if(requestContext != null && requestContext.getUserParams()!=null){ for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput(); serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index b8c5fad41d..86c718d165 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -96,8 +96,12 @@ public class VfModuleTopologyOperationRequestMapper { } String sdncReqId = UUID.randomUUID().toString(); + String msoRequestId = UUID.randomUUID().toString(); + if (requestContext != null && requestContext.getMsoRequestId() != null) { + msoRequestId = requestContext.getMsoRequestId(); + } - GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, + GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction); GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation); GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index 7de393bb2f..85e5b85529 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -59,11 +59,15 @@ public class VnfTopologyOperationRequestMapper { GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) { String sdncReqId = UUID.randomUUID().toString(); + String msoRequestId = UUID.randomUUID().toString(); + if (requestContext != null && requestContext.getMsoRequestId() != null) { + msoRequestId = requestContext.getMsoRequestId(); + } GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation(); GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper .buildSdncRequestHeader(svcAction, sdncReqId); GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper - .buildGenericResourceApiRequestinformationRequestInformation(sdncReqId, requestAction); + .buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction); GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper .buildServiceInformation(serviceInstance, requestContext, customer, true); GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper @@ -84,7 +88,7 @@ public class VnfTopologyOperationRequestMapper { req.setVnfInformation(vnfInformation); GenericResourceApiParam vnfInputParameters = new GenericResourceApiParam(); - if (requestContext.getUserParams() != null) { + if (requestContext != null && requestContext.getUserParams() != null) { for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); |