summaryrefslogtreecommitdiffstats
path: root/esr-mgr
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-09-15 16:10:47 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-09-15 16:10:47 +0800
commit31613a6b0099d38a8006ef0426e8e9fcaf046256 (patch)
tree79f7f8d62a91ca611e94c63bf8a5da2fc28d28b4 /esr-mgr
parent9fccad8f53ef43026a8632bfb6eabc32849a8c46 (diff)
Realize the function of query VIM list.
Realize the function of query VIM list information. Adjust the Bean class name. Change-Id: I37f3fc0b2f6d9a0972d017c7bf4677c5c28810ea Issue-ID: AAI-301 Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr')
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java12
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java137
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java37
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java (renamed from esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java)2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java (renamed from esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java)2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java (renamed from esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java)2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java8
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java12
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/RegisterVimProvider.java12
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java8
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java8
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java8
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java8
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java53
15 files changed, 263 insertions, 48 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java
index e037177..fe1ea4c 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java
@@ -17,7 +17,6 @@ package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
public class CloudRegion implements Serializable {
@@ -50,9 +49,6 @@ public class CloudRegion implements Serializable {
@SerializedName("resouce-version")
private String resouceVersion;
-
- @SerializedName("esr-system-info-list")
- private EsrSystemInfoList esrSystemInfoList;
public String getCloudOwner() {
return cloudOwner;
@@ -126,12 +122,8 @@ public class CloudRegion implements Serializable {
this.resouceVersion = resouceVersion;
}
- public EsrSystemInfoList getEsrSystemInfoList() {
- return esrSystemInfoList;
- }
-
- public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
- this.esrSystemInfoList = esrSystemInfoList;
+ public static long getSerialversionuid() {
+ return serialVersionUID;
}
}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java
new file mode 100644
index 0000000..36fc0fd
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java
@@ -0,0 +1,137 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.gson.annotations.SerializedName;
+
+public class CloudRegionDetail implements Serializable {
+
+ public static final long serialVersionUID = 1L;
+
+ @SerializedName("cloud-owner")
+ private String cloudOwner;
+
+ @SerializedName("cloud-region-id")
+ private String cloudRegionId;
+
+ @SerializedName("cloud-type")
+ private String cloudType;
+
+ @SerializedName("cloud-region-version")
+ private String cloudRegionVersion;
+
+ @SerializedName("owner-defined-type")
+ private String ownerDefinedType;
+
+ @SerializedName("cloud-zone")
+ private String cloudZone;
+
+ @SerializedName("complex-name")
+ private String complexName;
+
+ @SerializedName("cloud-extra-info")
+ private String cloudExtraInfo;
+
+ @SerializedName("resouce-version")
+ private String resouceVersion;
+
+ @SerializedName("esr-system-info-list")
+ private EsrSystemInfoList esrSystemInfoList;
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getCloudRegionId() {
+ return cloudRegionId;
+ }
+
+ public void setCloudRegionId(String cloudRegionId) {
+ this.cloudRegionId = cloudRegionId;
+ }
+
+ public String getCloudType() {
+ return cloudType;
+ }
+
+ public void setCloudType(String cloudType) {
+ this.cloudType = cloudType;
+ }
+
+ public String getCloudRegionVersion() {
+ return cloudRegionVersion;
+ }
+
+ public void setCloudRegionVersion(String cloudRegionVersion) {
+ this.cloudRegionVersion = cloudRegionVersion;
+ }
+
+ public String getOwnerDefinedType() {
+ return ownerDefinedType;
+ }
+
+ public void setOwnerDefinedType(String ownerDefinedType) {
+ this.ownerDefinedType = ownerDefinedType;
+ }
+
+ public String getCloudZone() {
+ return cloudZone;
+ }
+
+ public void setCloudZone(String cloudZone) {
+ this.cloudZone = cloudZone;
+ }
+
+ public String getComplexName() {
+ return complexName;
+ }
+
+ public void setComplexName(String complexName) {
+ this.complexName = complexName;
+ }
+
+ public String getCloudExtraInfo() {
+ return cloudExtraInfo;
+ }
+
+ public void setCloudExtraInfo(String cloudExtraInfo) {
+ this.cloudExtraInfo = cloudExtraInfo;
+ }
+
+ public String getResouceVersion() {
+ return resouceVersion;
+ }
+
+ public void setResouceVersion(String resouceVersion) {
+ this.resouceVersion = resouceVersion;
+ }
+
+ public EsrSystemInfoList getEsrSystemInfoList() {
+ return esrSystemInfoList;
+ }
+
+ public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
+ this.esrSystemInfoList = esrSystemInfoList;
+ }
+
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java
new file mode 100644
index 0000000..aef7bca
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import com.google.gson.annotations.SerializedName;
+
+public class CloudRegionList implements Serializable {
+
+ public static final long serialVersionUID = 1L;
+
+ @SerializedName("cloud-region")
+ private ArrayList<CloudRegion> cloudRegion;
+
+ public ArrayList<CloudRegion> getCloudRegion() {
+ return cloudRegion;
+ }
+
+ public void setCloudRegion(ArrayList<CloudRegion> cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java
index e8c402e..c43572a 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
-public class EsrEms {
+public class EsrEmsDetail {
private String emsId;
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java
index ecb8f10..cd173f4 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java
@@ -15,7 +15,7 @@
*/
package org.onap.aai.esr.entity.aai;
-public class EsrThirdpartySdnc {
+public class EsrThirdpartySdncDetail {
private String thirdpartySdncId;
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java
index 85f98b5..ca2fe8f 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java
@@ -15,7 +15,7 @@
*/
package org.onap.aai.esr.entity.aai;
-public class EsrVnfm {
+public class EsrVnfmDetail {
private String vnfmId;
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java
index 5c2bb33..59c5110 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java
@@ -16,7 +16,7 @@
package org.onap.aai.esr.externalservice.aai;
import org.glassfish.jersey.client.ClientConfig;
-import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,7 +37,7 @@ public class CloudRegionProxy {
}
- public static void registerVim(String cloudOwner, String cloudRegionId, CloudRegion cloudRegion)
+ public static void registerVim(String cloudOwner, String cloudRegionId, CloudRegionDetail cloudRegion)
throws Exception {
ClientConfig config = new ClientConfig(new RegisterVimProvider());
ICloudRegion registerVimServiceproxy = ConsumerFactory
@@ -50,4 +50,8 @@ public class CloudRegionProxy {
return adapterServiceproxy.queryVIMDetail(transactionId, fromAppId, authorization, cloud_owner,
cloud_region_id);
}
+
+ public static String qureyVimList() throws Exception {
+ return adapterServiceproxy.queryVIMList(transactionId, fromAppId, authorization);
+ }
}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java
index 5a5d15c..2c8a0a2 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java
@@ -24,7 +24,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegionDetail;
@Path("/cloud-regions")
@@ -38,7 +38,7 @@ public interface ICloudRegion {
@HeaderParam("X-FromAppId") String fromApp,
@HeaderParam("Authorization") String authorization,
@PathParam("cloud_owner") String cloud_owner,
- @PathParam("cloud_region_id") String cloud_region_id, CloudRegion cloudRegion) throws Exception;
+ @PathParam("cloud_region_id") String cloud_region_id, CloudRegionDetail cloudRegion) throws Exception;
@GET
@Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all")
@@ -49,5 +49,13 @@ public interface ICloudRegion {
@HeaderParam("Authorization") String authorization,
@PathParam("cloud_owner") String cloud_owner,
@PathParam("cloud_region_id") String cloud_region_id) throws Exception;
+
+ @GET
+ @Path("/")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public String queryVIMList(@HeaderParam("X-TransactionId") String transactionId,
+ @HeaderParam("X-FromAppId") String fromApp,
+ @HeaderParam("Authorization") String authorization) throws Exception;
}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/RegisterVimProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/RegisterVimProvider.java
index 5c6d645..a070e18 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/RegisterVimProvider.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/RegisterVimProvider.java
@@ -25,32 +25,32 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
-import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
-public class RegisterVimProvider implements MessageBodyWriter<CloudRegion>{
+public class RegisterVimProvider implements MessageBodyWriter<CloudRegionDetail>{
private static final Logger logger = LoggerFactory.getLogger(RegisterVimProvider.class);
@Override
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations,
MediaType mediaType) {
- return CloudRegion.class.isAssignableFrom(type);
+ return CloudRegionDetail.class.isAssignableFrom(type);
}
@Override
- public long getSize(CloudRegion t, Class<?> type, Type genericType,
+ public long getSize(CloudRegionDetail t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType) {
return -1;
}
@Override
- public void writeTo(CloudRegion t, Class<?> type, Type genericType,
+ public void writeTo(CloudRegionDetail t, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
- String json = new Gson().toJson(t, CloudRegion.class);
+ String json = new Gson().toJson(t, CloudRegionDetail.class);
logger.info("the param to createNetworkByAdapter input is:" + json);
entityStream.write(json.getBytes("UTF-8"));
}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java
index e44cddb..3534477 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java
@@ -61,7 +61,7 @@ public class VimManager {
response = String.class)})
@Timed
public Response queryVimList() {
- return VimManagerWrapper.getInstance().queryVimList();
+ return VimManagerWrapper.getInstance().queryVimListDetails();
}
/**
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java
index b48f76c..1a861f5 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java
@@ -19,15 +19,15 @@ import java.util.ArrayList;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
-import org.onap.aai.esr.entity.aai.EsrEms;
+import org.onap.aai.esr.entity.aai.EsrEmsDetail;
import org.onap.aai.esr.entity.rest.AlarmAddr;
import org.onap.aai.esr.entity.rest.EmsRegisterInfo;
import org.onap.aai.esr.entity.rest.FtpAddr;
public class EmsManagerUtil {
- public static EsrEms emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) {
- EsrEms esrEms = new EsrEms();
+ public static EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) {
+ EsrEmsDetail esrEms = new EsrEmsDetail();
esrEms.setEmsId(ExtsysUtil.generateId());
ArrayList<EsrSystemInfo> authInfos = new ArrayList<EsrSystemInfo>();
authInfos = getAuthInfosFromRegisterData(emsRegisterInfo);
@@ -87,7 +87,7 @@ public class EmsManagerUtil {
return authInfo;
}
- public static EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEms esrEms) {
+ public static EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEmsDetail esrEms) {
EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo();
ArrayList<EsrSystemInfo> esrSystemInfo = new ArrayList<EsrSystemInfo>();
EsrSystemInfo authInfo = new EsrSystemInfo();
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java
index a9075e3..b361527 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
-import org.onap.aai.esr.entity.aai.EsrThirdpartySdnc;
+import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;
import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
public class ThirdpartySdncManagerUtil {
- public EsrThirdpartySdnc sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) {
- EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc();
+ public EsrThirdpartySdncDetail sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) {
+ EsrThirdpartySdncDetail esrThirdpartySdnc = new EsrThirdpartySdncDetail();
sdncRegisterInfo.setThirdpartySdncId(ExtsysUtil.generateId());
esrThirdpartySdnc.setThirdpartySdncId(sdncRegisterInfo.getThirdpartySdncId());
esrThirdpartySdnc.setLocation(sdncRegisterInfo.getLocation());
@@ -53,7 +53,7 @@ public class ThirdpartySdncManagerUtil {
return esrSystemInfoList;
}
- public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdnc esrSdnc) {
+ public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdncDetail esrSdnc) {
ThirdpartySdncRegisterInfo registerSdncInfo = new ThirdpartySdncRegisterInfo();
EsrSystemInfo esrSystemInfo = esrSdnc.getEsrSystemInfoList().getEsrSystemInfo().get(0);
registerSdncInfo.setThirdpartySdncId(esrSdnc.getThirdpartySdncId());
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java
index 681b288..83587af 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import org.onap.aai.esr.common.SystemStatus;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
-import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegionDetail;
import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
import org.onap.aai.esr.entity.rest.VimAuthInfo;
import org.onap.aai.esr.entity.rest.VimRegisterInfo;
@@ -28,8 +28,8 @@ import org.onap.aai.esr.entity.rest.VimRegisterInfo;
public class VimManagerUtil {
- public static CloudRegion vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
- CloudRegion cloudRegion = new CloudRegion();
+ public static CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
+ CloudRegionDetail cloudRegion = new CloudRegionDetail();
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
ArrayList<EsrSystemInfo> esrSystemInfo = new ArrayList<EsrSystemInfo>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
@@ -74,7 +74,7 @@ public class VimManagerUtil {
return vimAuthInfo;
}
- public static VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegion cloudRegion) {
+ public static VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) {
VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
VimAuthInfo vimAuthInfo = new VimAuthInfo();
vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0));
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java
index 409a07c..2079cb2 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java
@@ -18,13 +18,13 @@ package org.onap.aai.esr.util;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
-import org.onap.aai.esr.entity.aai.EsrVnfm;
+import org.onap.aai.esr.entity.aai.EsrVnfmDetail;
import org.onap.aai.esr.entity.rest.VnfmRegisterInfo;
public class VnfmManagerUtil {
- public EsrVnfm vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) {
- EsrVnfm esrVnfm = new EsrVnfm();
+ public EsrVnfmDetail vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) {
+ EsrVnfmDetail esrVnfm = new EsrVnfmDetail();
EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList();
EsrSystemInfo authInfo = new EsrSystemInfo();
esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl());
@@ -55,7 +55,7 @@ public class VnfmManagerUtil {
return authInfo;
}
- public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfm esrVnfm) {
+ public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfmDetail esrVnfm) {
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
EsrSystemInfo authInfo = new EsrSystemInfo();
vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId());
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java
index b20116c..9058bc4 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java
@@ -20,6 +20,8 @@ import java.util.ArrayList;
import javax.ws.rs.core.Response;
import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegionDetail;
+import org.onap.aai.esr.entity.aai.CloudRegionList;
import org.onap.aai.esr.entity.rest.VimRegisterInfo;
import org.onap.aai.esr.entity.rest.VimRegisterResponse;
import org.onap.aai.esr.externalservice.aai.CloudRegionProxy;
@@ -50,7 +52,7 @@ public class VimManagerWrapper {
public Response registerVim(VimRegisterInfo vimRegisterInfo) {
LOG.info("Start register VIM, input VIM info is: " + ExtsysUtil.objectToString(vimRegisterInfo));
- CloudRegion cloudRegion = new CloudRegion();
+ CloudRegionDetail cloudRegion = new CloudRegionDetail();
VimRegisterResponse result = new VimRegisterResponse();
cloudRegion = VimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo);
String cloud_owner = vimRegisterInfo.getCloudOwner();
@@ -72,20 +74,29 @@ public class VimManagerWrapper {
return Response.ok().build();
}
- public Response queryVimList() {
- //TODO
- ArrayList<VimRegisterInfo> vimList = new ArrayList<VimRegisterInfo>();
- return Response.ok(vimList).build();
+ public Response queryVimListDetails() {
+ ArrayList<VimRegisterInfo> vimRegisterInfos = new ArrayList<VimRegisterInfo>();
+ CloudRegionList cloudRegionList = new CloudRegionList();
+ try {
+ String aaiVimList = CloudRegionProxy.qureyVimList();
+ cloudRegionList = new Gson().fromJson(aaiVimList, CloudRegionList.class);
+ vimRegisterInfos = getVimDetailList(cloudRegionList);
+ return Response.ok(vimRegisterInfos).build();
+ } catch (Exception error) {
+ LOG.error("Query vim list details failed !" + error.getMessage());
+ return Response.serverError().build();
+ }
+
}
public Response queryVimById(String cloudOwner, String cloudRegionId) {
VimRegisterInfo vim = new VimRegisterInfo();
- CloudRegion cloudRegion = new CloudRegion();
+ CloudRegionDetail cloudRegionDetail = new CloudRegionDetail();
try {
String cloudRegionstr = CloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId);
LOG.info("Response from AAI by query VIM: " + cloudRegionstr);
- cloudRegion = new Gson().fromJson(cloudRegionstr, CloudRegion.class);
- vim = VimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegion);
+ cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class);
+ vim = VimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail);
return Response.ok(vim).build();
} catch (Exception e) {
e.printStackTrace();
@@ -94,6 +105,32 @@ public class VimManagerWrapper {
}
+ private ArrayList<VimRegisterInfo> getVimDetailList(CloudRegionList cloudRegionList) {
+ ArrayList<VimRegisterInfo> vimRegisterInfos = new ArrayList<VimRegisterInfo>();
+ VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
+ int cloudRegionNum = cloudRegionList.getCloudRegion().size();
+ for (int i=0; i<cloudRegionNum; i++) {
+ String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner();
+ String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId();
+ vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId);
+ vimRegisterInfos.add(vimRegisterInfo);
+ }
+ return vimRegisterInfos;
+ }
+
+ private VimRegisterInfo getVimDetail(String cloudOwner, String cloudRegionId) {
+ CloudRegionDetail cloudRegionDetail = new CloudRegionDetail();
+ VimRegisterInfo registeredVimInfo = new VimRegisterInfo();
+ try {
+ String cloudRegionstr = CloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId);
+ cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class);
+ registeredVimInfo = VimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail);
+ } catch (Exception error) {
+ LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner +", cloud-region-id = "+ cloudRegionId + error.getMessage());
+ }
+ return registeredVimInfo;
+ }
+
public Response delVim(String vimId) {
//TODO
return Response.noContent().build();