summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/Complex.java34
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/ComplexList.java36
-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/resource/VimManager.java17
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java19
5 files changed, 112 insertions, 2 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/Complex.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/Complex.java
new file mode 100644
index 0000000..0a543bb
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/Complex.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2018 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.google.gson.annotations.SerializedName;
+
+public class Complex implements Serializable {
+ public static final long serialVersionUID = 1L;
+
+ @SerializedName("physical-location-id")
+ private String physicalLocationId;
+
+ public String getPhysicalLocationId() {
+ return physicalLocationId;
+ }
+
+ public void setPhysicalLocationId(String physicalLocationId) {
+ this.physicalLocationId = physicalLocationId;
+ }
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/ComplexList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/ComplexList.java
new file mode 100644
index 0000000..d8cd678
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/ComplexList.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2018 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.List;
+import com.google.gson.annotations.SerializedName;
+
+public class ComplexList implements Serializable {
+ public static final long serialVersionUID = 1L;
+
+ @SerializedName("complex")
+ private List<Complex> complex;
+
+ public List<Complex> getComplex() {
+ return complex;
+ }
+
+ public void setComplex(List<Complex> complex) {
+ this.complex = complex;
+ }
+
+}
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 a145288..bcfedb3 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
@@ -72,4 +72,12 @@ public class CloudRegionProxy {
throw new ExtsysException("Delete cloud region from A&AI failed.", e);
}
}
+
+ public String qureyComplexes() throws ExtsysException {
+ try {
+ return adapterServiceproxy.queryComplexList(transactionId, fromAppId, authorization);
+ } catch (Exception e) {
+ throw new ExtsysException("Query complexes from A&AI failed.", e);
+ }
+ }
}
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 a122c47..b3adcbf 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
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 ZTE Corporation.
+ * Copyright 2016-2018 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -140,4 +140,19 @@ public class VimManager {
LOGGER.info("start add vim" + " info:" + extsysUtil.objectToString(vim));
return VimManagerWrapper.getInstance().registerVim(vim);
}
+
+ @GET
+ @Path("/complexes")
+ @ApiOperation(value = "get all complexes ")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiResponses(value = {
+ @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class),
+ @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415,
+ message = "Unprocessable MicroServiceInfo Entity ", response = String.class),
+ @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error",
+ response = String.class)})
+ @Timed
+ public Response queryComplexList() {
+ return VimManagerWrapper.getInstance().queryComplexes();
+ }
}
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 bc7e872..7545b01 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
@@ -1,5 +1,5 @@
/**
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017-2018 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import java.util.List;
import javax.ws.rs.core.Response;
import org.onap.aai.esr.entity.aai.CloudRegionDetail;
import org.onap.aai.esr.entity.aai.CloudRegionList;
+import org.onap.aai.esr.entity.aai.ComplexList;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.rest.VimRegisterInfo;
import org.onap.aai.esr.entity.rest.VimRegisterResponse;
@@ -214,4 +215,20 @@ public class VimManagerWrapper {
}
return cloudRegionDetail;
}
+
+ public Response queryComplexes() {
+ ComplexList complexList = new ComplexList();
+ List<String> complexId = new ArrayList<>();
+ try {
+ String complexesString = cloudRegionProxy.qureyComplexes();
+ LOG.info("The complex query result is: " + complexesString);
+ complexList = new Gson().fromJson(complexesString, ComplexList.class);
+ for (int i=0; i<complexList.getComplex().size(); i++) {
+ complexId.add(complexList.getComplex().get(i).getPhysicalLocationId());
+ }
+ } catch (ExtsysException e) {
+ LOG.error("Query vim details by ID failed !", e);
+ }
+ return Response.ok(complexId).build();
+ }
}