From c8cd23a64ef20436bac38923f6dc7f77e7b95c08 Mon Sep 17 00:00:00 2001 From: sujitsatapathy Date: Wed, 9 Sep 2020 10:18:15 +0000 Subject: Preparing the request payload (action = delete) for calling SO macro flow code changes for delete action. Issue-ID: EXTAPI-448 Change-Id: I6bb9786660f6760c15008132e2c254e7f9b89654 Signed-off-by: sujitsatapathy --- .../org/onap/nbi/apis/serviceorder/SoClient.java | 27 ++++++++++++++++++++++ .../serviceorder/workflow/PostSoProcessor.java | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java index 8e58c39..e0e4bb5 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java @@ -194,6 +194,33 @@ public class SoClient { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } + } + //Delete Macro + + public ResponseEntity callMacroDeleteServiceInstance(MSOPayload msoPayload, + String serviceId) { + + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Calling SO Macro DeleteServiceInstance with msoPayload : " + msoPayload.toString()); + } + + String url = deleteSoUrl + serviceId; + + try { + ResponseEntity response = restTemplate.exchange(url, HttpMethod.DELETE, + new HttpEntity<>(msoPayload, buildRequestHeader()), CreateMacroServiceInstanceResponse.class); + + logMacroResponsePost(url, response); + return response; + + } catch (BackendFunctionalException e) { + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); + return new ResponseEntity<>(e.getHttpStatus()); + } catch (ResourceAccessException e) { + LOGGER.error(ERROR_ON_CALLING + url + " ," + e); + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } public ResponseEntity callE2EDeleteServiceInstance(String globalSubscriberId, diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java index 4568b80..c356bdd 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java @@ -226,8 +226,8 @@ public class PostSoProcessor { response = soClient.callMacroCreateServiceInstance(msoMacroPayload); break; case DELETE: - // response = soClient.callDeleteServiceInstance(msoPayload, - // serviceOrderItem.getService().getId()); + response = soClient.callMacroDeleteServiceInstance(msoMacroPayload, + serviceOrderItem.getService().getId()); break; case MODIFY: if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) { -- cgit 1.2.3-korg