summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-09-18 15:14:04 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-09-18 15:14:04 +0800
commitcab18110a636691b277ab94a5d6e202c275a8dfc (patch)
tree9a7c84778b192b46db3e92c30838d24e89b55132
parenta4771e502b3385e1cfc314e79deba7aca0c828c0 (diff)
Realize query thirdparty sdnc detail API
Change-Id: I3bd27d083cb6243c91039648ea0fb158c81ea8e5 Issue-ID: AAI-316 Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java4
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java26
2 files changed, 28 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 cebab2c..eda2eb2 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
@@ -61,4 +61,8 @@ public class ExternalSystemProxy {
registerVnfmServiceproxy.registerThirdpartySdnc(transactionId, fromAppId, authorization, thirdpartySdncId,
esrSdncDetail);
}
+
+ public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws Exception{
+ return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, thirdpartySdncId);
+ }
}
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 9bc61ad..f9246f7 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
@@ -27,6 +27,8 @@ import org.onap.aai.esr.util.ThirdpartySdncManagerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.gson.Gson;
+
public class ThirdpatySdncWrapper {
private static ThirdpatySdncWrapper thirdpatySdncWrapper;
@@ -73,12 +75,32 @@ public class ThirdpatySdncWrapper {
public Response queryThirdpartySdncById(String thirdpartySdncId) {
ThirdpartySdncRegisterInfo thirdpartySdnc = new ThirdpartySdncRegisterInfo();
- //TODO
- return Response.ok(thirdpartySdnc).build();
+ thirdpartySdnc = querySdncDetail(thirdpartySdncId);
+ if(thirdpartySdnc != null) {
+ return Response.ok(thirdpartySdnc).build();
+ } else {
+ return Response.serverError().build();
+ }
}
public Response delThirdpartySdnc(String thirdpartySdncId) {
//TODO
return Response.noContent().build();
}
+
+ private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) {
+ ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo();
+ EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail();
+ try {
+ String esrSdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId);
+ LOG.info("Response from AAI by query thirdparty SDNC: " + esrSdncStr);
+ esrSdncDetail = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class);
+ sdncRegisterInfo = ThirdpartySdncManagerUtil.esrSdnc2SdncRegisterInfo(esrSdncDetail);
+ return sdncRegisterInfo;
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOG.error("Query VNFM detail failed! thirdpaty SDNC ID: " + sdncId, e.getMessage());
+ return null;
+ }
+ }
}