From 80df263c114a5b1496f0f168f01d39006c319e00 Mon Sep 17 00:00:00 2001 From: lizi00164331 Date: Mon, 18 Sep 2017 15:56:58 +0800 Subject: [PATCH] Realize the delete thirdparty SDNC API. Change-Id: I76f64f200c1287424b8561f96942bb44fd6fc739 Issue-ID: AAI-319 Signed-off-by: lizi00164331 --- .../esr/externalservice/aai/ExternalSystemProxy.java | 4 ++++ .../onap/aai/esr/wrapper/ThirdpatySdncWrapper.java | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java index 01d8ac3..e7f5d4b 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java @@ -69,4 +69,8 @@ public class ExternalSystemProxy { public static String querySdncList() throws Exception { return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization); } + + public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws Exception { + externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java index e5f9966..4b23fcf 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java @@ -119,8 +119,23 @@ public class ThirdpatySdncWrapper { } public Response delThirdpartySdnc(String thirdpartySdncId) { - //TODO - return Response.noContent().build(); + EsrThirdpartySdncDetail thirdpartySdncDetail = new EsrThirdpartySdncDetail(); + thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId); + String resourceVersion = thirdpartySdncDetail.getResourceVersion(); + if (resourceVersion != null) { + try { + ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion); + return Response.ok().build(); + } catch (Exception e) { + e.printStackTrace(); + LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId + "resouce-version:" + + resourceVersion, e.getMessage()); + return Response.serverError().build(); + } + } else { + LOG.error("resouce-version is null ! Can not delete resouce from A&AI. "); + return Response.serverError().build(); + } } private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) { -- 2.16.6