diff options
4 files changed, 36 insertions, 4 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 e2ebfef..046a25b 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 @@ -90,4 +90,8 @@ public class ExternalSystemProxy { public static String queryEmsList() throws Exception { return externalSystemproxy.queryEMSList(transactionId, fromAppId, authorization); } + + public static void deleteEms(String emsId, String resourceVersion) throws Exception { + externalSystemproxy.deleteEMS(transactionId, fromAppId, authorization, emsId, resourceVersion); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java index 9d13165..f3ae511 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java @@ -93,8 +93,23 @@ public class EmsManagerWrapper { } public Response delEms(String emsId) { - //TODO - return Response.noContent().build(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = queryEsrEmsDetail(emsId); + String resourceVersion = esrEmsDetail.getResourceVersion(); + if (resourceVersion != null) { + try { + ExternalSystemProxy.deleteEms(emsId, resourceVersion); + return Response.noContent().build(); + } catch (Exception e) { + e.printStackTrace(); + LOG.error("Delete EMS from A&AI failed! EMS ID: " + emsId + "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 EmsRegisterInfo queryEmsDetail(String emsId) { @@ -125,4 +140,17 @@ public class EmsManagerWrapper { } return emsInfoList; } + + private EsrEmsDetail queryEsrEmsDetail (String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); + LOG.info("Response from AAI by query EMS: " + esrEmsStr); + esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + } catch (Exception e) { + e.printStackTrace(); + LOG.error("Query EMS detail failed! EMS ID: " + emsId, e.getMessage()); + } + return esrEmsDetail; + } } 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 4b23fcf..4ecc5c9 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 @@ -130,7 +130,7 @@ public class ThirdpatySdncWrapper { e.printStackTrace(); LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId + "resouce-version:" + resourceVersion, e.getMessage()); - return Response.serverError().build(); + return Response.noContent().build(); } } else { LOG.error("resouce-version is null ! Can not delete resouce from A&AI. "); diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java index d1b3b77..5f6c8db 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java @@ -120,7 +120,7 @@ public class VnfmManagerWrapper { if (resourceVersion != null) { try { ExternalSystemProxy.deleteVnfm(vnfmId, resourceVersion); - return Response.ok().build(); + return Response.noContent().build(); } catch (Exception e) { e.printStackTrace(); LOG.error("Delete VNFM from A&AI failed! VNFM ID: " + vnfmId + "resouce-version:" |