diff options
author | lizi00164331 <li.zi30@zte.com.cn> | 2017-09-16 14:10:55 +0800 |
---|---|---|
committer | lizi00164331 <li.zi30@zte.com.cn> | 2017-09-16 14:10:55 +0800 |
commit | c7951d5bca29746e3ca27bc334add16393587ea9 (patch) | |
tree | 18047b2d12eb0eddb0851e40a93c91967a196648 /esr-mgr | |
parent | 861c24d17f2c1d351f75ef4b4c280b6dcca762e5 (diff) |
Realize the query VNFM detail API.
Change-Id: I65f21581ed57f6435c8dc3be07e4b6fa02ca7b7b
Issue-ID: AAI-311
Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr')
4 files changed, 30 insertions, 7 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java index 02b6fe5..b02afbe 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java @@ -15,9 +15,13 @@ */ package org.onap.aai.esr.entity.aai; +import java.io.Serializable; + import com.google.gson.annotations.SerializedName; -public class EsrSystemInfo { +public class EsrSystemInfo implements Serializable { + + public static final long serialVersionUID = 1L; @SerializedName("esr-system-info-id") private String esrSystemInfoId; diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java index 9df333a..9306b98 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java @@ -15,12 +15,15 @@ */ package org.onap.aai.esr.entity.aai; +import java.io.Serializable; import java.util.ArrayList; import com.google.gson.annotations.SerializedName; -public class EsrSystemInfoList { +public class EsrSystemInfoList implements Serializable { + public static final long serialVersionUID = 1L; + @SerializedName("esr-system-info") private ArrayList<EsrSystemInfo> esrSystemInfo; 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 9550541..2f790cd 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 @@ -22,14 +22,14 @@ import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class ExternalSystemProxy { - private static IExternalSystem adapterServiceproxy; + private static IExternalSystem externalSystemproxy; private static String transactionId = "9999"; private static String fromAppId = "esr-server"; private static String authorization = AaiCommon.getAuthenticationCredentials(); static { ClientConfig config = new ClientConfig(); - adapterServiceproxy = ConsumerFactory.createConsumer(AaiAdapterConfig.getExternalSystemAddr(), + externalSystemproxy = ConsumerFactory.createConsumer(AaiAdapterConfig.getExternalSystemAddr(), config, IExternalSystem.class); } @@ -41,5 +41,7 @@ public class ExternalSystemProxy { esrVnfmDetail); } - + public static String queryVnfmDetail(String vnfmId) throws Exception { + return externalSystemproxy.queryVNFMDetail(transactionId, fromAppId, authorization, vnfmId); + } } 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 7749c26..0b629bd 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 @@ -19,14 +19,19 @@ import java.util.ArrayList; import javax.ws.rs.core.Response; +import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.rest.CommonRegisterResponse; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; +import org.onap.aai.esr.externalservice.aai.CloudRegionProxy; import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; +import org.onap.aai.esr.util.VimManagerUtil; import org.onap.aai.esr.util.VnfmManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class VnfmManagerWrapper { private static VnfmManagerWrapper vnfmManagerWrapper; private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); @@ -70,8 +75,17 @@ public class VnfmManagerWrapper { public Response queryVnfmById(String vnfmId) { VnfmRegisterInfo vnfm = new VnfmRegisterInfo(); - //TODO - return Response.ok(vnfm).build(); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + try { + String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); + LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); + esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); + vnfm = VnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); + return Response.ok(vnfm).build(); + } catch (Exception e) { + e.printStackTrace(); + return Response.serverError().build(); + } } public Response delVnfm(String vnfmId) { |