summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java1
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java1
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java3
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java1
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java1
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java3
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java2
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java45
10 files changed, 35 insertions, 26 deletions
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
index 36fc0fd..8c6ad38 100644
--- 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
@@ -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 CloudRegionDetail implements Serializable {
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 9a98aac..9df333a 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
@@ -17,7 +17,6 @@ package org.onap.aai.esr.entity.aai;
import java.util.ArrayList;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
public class EsrSystemInfoList {
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 59c5110..b1a8c31 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
@@ -17,14 +17,11 @@ package org.onap.aai.esr.externalservice.aai;
import org.glassfish.jersey.client.ClientConfig;
import org.onap.aai.esr.entity.aai.CloudRegionDetail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
public class CloudRegionProxy {
- private static final Logger logger = LoggerFactory.getLogger(CloudRegionProxy.class);
private static ICloudRegion adapterServiceproxy;
private static String transactionId = "9999";
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 2c8a0a2..77b44ba 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
@@ -51,7 +51,6 @@ public interface ICloudRegion {
@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,
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java
index 6686924..f38304d 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java
@@ -50,7 +50,6 @@ public class EmsManager {
/**
* query all ems.
*/
- @Path("")
@GET
@ApiOperation(value = "get all ems ")
@Produces(MediaType.APPLICATION_JSON)
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
index 4a72261..18fd5d9 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
@@ -49,7 +49,6 @@ public class ThirdpatySdncManager {
/**
*query all thirdParty sdnc.
*/
- @Path("")
@GET
@ApiOperation(value = "get all thirdParty sdnc ")
@Produces(MediaType.APPLICATION_JSON)
@@ -131,7 +130,6 @@ public class ThirdpatySdncManager {
*thirdParty sdnc register.
*/
@POST
- @Path("")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@ApiOperation(value = "register a thirdparty sdnc")
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 3534477..8dee4c9 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
@@ -18,7 +18,6 @@ package org.onap.aai.esr.resource;
import com.codahale.metrics.annotation.Timed;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.eclipse.jetty.http.HttpStatus;
@@ -48,7 +47,6 @@ public class VimManager {
/**
* query all VIM.
*/
- @Path("")
@GET
@ApiOperation(value = "get all vim ")
@Produces(MediaType.APPLICATION_JSON)
@@ -128,7 +126,6 @@ public class VimManager {
* register vim .
*/
@POST
- @Path("")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@ApiOperation(value = "create a vim")
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java
index 670bfb2..e088fda 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java
@@ -48,7 +48,6 @@ public class VnfmManager {
/**
* query all vnfm.
*/
- @Path("")
@GET
@ApiOperation(value = "get all vnfm ")
@Produces(MediaType.APPLICATION_JSON)
@@ -130,7 +129,6 @@ public class VnfmManager {
* add vnfm .
*/
@POST
- @Path("")
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
@ApiOperation(value = "create a vnfm")
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 83587af..9952fad 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
@@ -15,7 +15,6 @@
*/
package org.onap.aai.esr.util;
-import java.util.ArrayList;
import org.onap.aai.esr.common.SystemStatus;
import org.onap.aai.esr.common.SystemType;
@@ -31,7 +30,6 @@ public class VimManagerUtil {
public static CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
CloudRegionDetail cloudRegion = new CloudRegionDetail();
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList<EsrSystemInfo> esrSystemInfo = new ArrayList<EsrSystemInfo>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner());
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 9058bc4..260d209 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
@@ -19,7 +19,6 @@ 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;
@@ -55,23 +54,37 @@ public class VimManagerWrapper {
CloudRegionDetail cloudRegion = new CloudRegionDetail();
VimRegisterResponse result = new VimRegisterResponse();
cloudRegion = VimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo);
- String cloud_owner = vimRegisterInfo.getCloudOwner();
- String cloud_region_id = vimRegisterInfo.getCloudRegionId();
-
+ String cloudOwner = vimRegisterInfo.getCloudOwner();
+ String cloudRegionId = vimRegisterInfo.getCloudRegionId();
try {
- CloudRegionProxy.registerVim(cloud_owner, cloud_region_id, cloudRegion);
- result.setCloudOwner(cloud_owner);
- result.setCloudRegionId(cloud_region_id);
+ CloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegion);
+ result.setCloudOwner(cloudOwner);
+ result.setCloudRegionId(cloudRegionId);
return Response.ok(result).build();
} catch (Exception e) {
e.printStackTrace();
return Response.serverError().build();
}
}
+ public Response updateVim(VimRegisterInfo vimRegisterInfo) {
+ LOG.info("Start update VIM, input VIM info is: " + ExtsysUtil.objectToString(vimRegisterInfo));
+ String cloudOwner = vimRegisterInfo.getCloudOwner();
+ String cloudRegionId = vimRegisterInfo.getCloudRegionId();
+ String resourceVersion = getResourceVersion(cloudOwner, cloudRegionId);
+ CloudRegionDetail cloudRegionDetail = new CloudRegionDetail();
+ VimRegisterResponse result = new VimRegisterResponse();
+ cloudRegionDetail = VimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo);
+ cloudRegionDetail.setResouceVersion(resourceVersion);
- public Response updateVim(VimRegisterInfo vim) {
- //TODO
- return Response.ok().build();
+ try {
+ CloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail);
+ result.setCloudOwner(cloudOwner);
+ result.setCloudRegionId(cloudRegionId);
+ return Response.ok(result).build();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return Response.serverError().build();
+ }
}
public Response queryVimListDetails() {
@@ -131,6 +144,18 @@ public class VimManagerWrapper {
return registeredVimInfo;
}
+ private String getResourceVersion(String cloudOwner, String cloudRegionId) {
+ CloudRegionDetail cloudRegionDetail = new CloudRegionDetail();
+ try {
+ String cloudRegionstr = CloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId);
+ cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class);
+ return cloudRegionDetail.getResouceVersion();
+ } catch (Exception error) {
+ LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner +", cloud-region-id = "+ cloudRegionId + error.getMessage());
+ return null;
+ }
+ }
+
public Response delVim(String vimId) {
//TODO
return Response.noContent().build();