Realize the data transaction of VIM. 57/11657/1
authorlizi00164331 <li.zi30@zte.com.cn>
Mon, 11 Sep 2017 12:13:35 +0000 (20:13 +0800)
committerlizi00164331 <li.zi30@zte.com.cn>
Mon, 11 Sep 2017 12:13:35 +0000 (20:13 +0800)
Realize the data transaction about VIM between esr and A&AI. Add Enum Type definition of SystemType and SystemStatus. Adjust the entity parameter.

Change-Id: I589244f44977cb4a618b1a2cddc58edd7516ca4e
Issue-ID: AAI-285
Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
19 files changed:
esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java [moved from esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java with 75% similarity]
esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java [moved from esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java with 82% similarity]
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/AuthInfo.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java
esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java [moved from esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java with 91% similarity]
esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java [deleted file]
esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java
esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java [new file with mode: 0644]

@@ -1,5 +1,5 @@
 /**
- * Copyright 2016-2017 ZTE Corporation.
+ * 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.aai.esr.common;
 
-
-public enum ExtSysResuorceType {
-  VIM, SDNC, EMS, VNFM, BASE;
-
-  public static ExtSysResuorceType getType(String type) {
-    return valueOf(type);
-  }
+public enum SystemStatus {
+  normal,abnormal
 }
 
 package org.onap.aai.esr.common;
 
-/**
- * Parameters. <br/>
- * 
- * @author sun qi
- * @version ESR V1
- */
-public enum Parameters {
-  emsId, sdnControllerId, vimId, vnfmId, id
+public enum SystemType {
+  VNFM,EMS_RESOUCE,EMS_PERFORMANCE,EMS_ALARM,thirdparty_SDNC,VIM
 }
index f7663b8..56d76cb 100644 (file)
@@ -39,7 +39,7 @@ public class AuthInfo {
   
   private String sslCassert;
   
-  private String sslInsecure;
+  private Boolean sslInsecure;
   
   private String ipAddress;
   
@@ -50,6 +50,8 @@ public class AuthInfo {
   private String defaultTenant;
   
   private String systemStatus;
+  
+  private String resouceVersion;
 
   public String getEsrSystemInfoId() {
     return esrSystemInfoId;
@@ -139,14 +141,6 @@ public class AuthInfo {
     this.sslCassert = sslCassert;
   }
 
-  public String getSslInsecure() {
-    return sslInsecure;
-  }
-
-  public void setSslInsecure(String sslInsecure) {
-    this.sslInsecure = sslInsecure;
-  }
-
   public String getIpAddress() {
     return ipAddress;
   }
@@ -187,4 +181,20 @@ public class AuthInfo {
     this.systemStatus = systemStatus;
   }
 
+  public Boolean getSslInsecure() {
+    return sslInsecure;
+  }
+
+  public void setSslInsecure(Boolean sslInsecure) {
+    this.sslInsecure = sslInsecure;
+  }
+
+  public String getResouceVersion() {
+    return resouceVersion;
+  }
+
+  public void setResouceVersion(String resouceVersion) {
+    this.resouceVersion = resouceVersion;
+  }
+
 }
index 64e5f4d..49d7f9d 100644 (file)
@@ -33,6 +33,8 @@ public class CloudRegion {
   
   private String cloudExtraInfo;
   
+  private String resouceVersion;
+  
   private EsrSystemInfoList esrSystemInfoList;
 
   public String getCloudOwner() {
@@ -106,4 +108,12 @@ public class CloudRegion {
   public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
     this.esrSystemInfoList = esrSystemInfoList;
   }
+
+  public String getResouceVersion() {
+    return resouceVersion;
+  }
+
+  public void setResouceVersion(String resouceVersion) {
+    this.resouceVersion = resouceVersion;
+  }
 }
index af37abd..3bff6a0 100644 (file)
@@ -24,6 +24,8 @@ public class EsrEms {
   
   private String remotePath;
   
+  private String resouceVersion;
+  
   private EsrSystemInfoList esrSystemInfoList;
 
   public String getEmsId() {
@@ -57,4 +59,12 @@ public class EsrEms {
   public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
     this.esrSystemInfoList = esrSystemInfoList;
   }
+
+  public String getResouceVersion() {
+    return resouceVersion;
+  }
+
+  public void setResouceVersion(String resouceVersion) {
+    this.resouceVersion = resouceVersion;
+  }
 }
index 535e5db..5adef8e 100644 (file)
@@ -17,13 +17,13 @@ package org.onap.aai.esr.entity.aai;
 
 public class EsrSystemInfoList {
 
-  private EsrSystemInfo esrSystemInfoList;
+  private EsrSystemInfo esrSystemInfo;
 
-  public EsrSystemInfo getEsrSystemInfoList() {
-    return esrSystemInfoList;
+  public EsrSystemInfo getEsrSystemInfo() {
+    return esrSystemInfo;
   }
 
-  public void setEsrSystemInfoList(EsrSystemInfo esrSystemInfoList) {
-    this.esrSystemInfoList = esrSystemInfoList;
+  public void setEsrSystemInfo(EsrSystemInfo esrSystemInfo) {
+    this.esrSystemInfo = esrSystemInfo;
   }
 }
index a4fad11..ecb8f10 100644 (file)
@@ -23,6 +23,8 @@ public class EsrThirdpartySdnc {
   
   private String productName;
   
+  private String resouceVersion;
+  
   private EsrSystemInfoList esrSystemInfoList;
 
   public String getThirdpartySdncId() {
@@ -56,4 +58,12 @@ public class EsrThirdpartySdnc {
   public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
     this.esrSystemInfoList = esrSystemInfoList;
   }
+
+  public String getResouceVersion() {
+    return resouceVersion;
+  }
+
+  public void setResouceVersion(String resouceVersion) {
+    this.resouceVersion = resouceVersion;
+  }
 }
index d6b85e6..85f98b5 100644 (file)
@@ -23,6 +23,8 @@ public class EsrVnfm {
   
   private String certificateUrl;
   
+  private String resouceVersion;
+  
   private EsrSystemInfoList esrSystemInfoList;
 
   public String getVnfmId() {
@@ -57,4 +59,12 @@ public class EsrVnfm {
     this.esrSystemInfoList = esrSystemInfoList;
   }
 
+  public String getResouceVersion() {
+    return resouceVersion;
+  }
+
+  public void setResouceVersion(String resouceVersion) {
+    this.resouceVersion = resouceVersion;
+  }
+
 }
@@ -15,7 +15,7 @@
  */
 package org.onap.aai.esr.entity.rest;
 
-public class AuthInfoItem {
+public class VimAuthInfo {
   
   private String cloudDomain;
   
@@ -27,7 +27,7 @@ public class AuthInfoItem {
   
   private String sslCacert;
 
-  private String sslInsecure;
+  private Boolean sslInsecure;
 
   public String getCloudDomain() {
     return cloudDomain;
@@ -69,11 +69,12 @@ public class AuthInfoItem {
     this.sslCacert = sslCacert;
   }
 
-  public String getSslInsecure() {
+  public Boolean getSslInsecure() {
     return sslInsecure;
   }
 
-  public void setSslInsecure(String sslInsecure) {
+  public void setSslInsecure(Boolean sslInsecure) {
     this.sslInsecure = sslInsecure;
   }
+
 }
index 409282a..e5fc132 100644 (file)
@@ -33,7 +33,7 @@ public class VimRegisterInfo {
   
   private String cloudExtraInfo;
   
-  private AuthInfoItem authInfoItem;
+  private VimAuthInfo vimAuthInfo;
 
   public String getCloudOwner() {
     return cloudOwner;
@@ -99,12 +99,13 @@ public class VimRegisterInfo {
     this.cloudExtraInfo = cloudExtraInfo;
   }
 
-  public AuthInfoItem getAuthInfoItem() {
-    return authInfoItem;
+  public VimAuthInfo getVimAuthInfo() {
+    return vimAuthInfo;
   }
 
-  public void setAuthInfoItem(AuthInfoItem authInfoItem) {
-    this.authInfoItem = authInfoItem;
+  public void setVimAuthInfo(VimAuthInfo vimAuthInfo) {
+    this.vimAuthInfo = vimAuthInfo;
   }
 
+
 }
index 1ecd6d1..b257d79 100644 (file)
@@ -25,7 +25,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
 import org.glassfish.jersey.client.ClientResponse;
-import org.onap.aai.esr.externalservice.entity.CloudRegion;
+import org.onap.aai.esr.entity.aai.CloudRegion;
 
 import retrofit2.http.Header;
 import retrofit2.http.Headers;
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java
deleted file mode 100644 (file)
index f4fcf20..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.externalservice.entity;
-
-import java.util.ArrayList;
-
-public class CloudRegion {
-
-  // required 
-  private String cloudOwner;
-  //required 
-  private String cloudRegionId;
-  //required 
-  private String cloudType;
-  //required 
-  private String cloudRegionVersion;
-  //  not required
-  private String ownerDefinedType;
-  //not required
-  private String cloudZone;
-  //not required
-  private String complexName;
-  //not required
-  private String cloudExtraInfo;
-  
-  private ArrayList<EsrSystemInfo> esrSystemInfos;
-
-  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 ArrayList<EsrSystemInfo> getEsrSystemInfos() {
-    return esrSystemInfos;
-  }
-
-  public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) {
-    this.esrSystemInfos = esrSystemInfos;
-  }
-}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java
deleted file mode 100644 (file)
index a11b5d4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.externalservice.entity;
-
-import java.util.ArrayList;
-
-public class EsrEms {
-  private String emsId;
-  
-  private Boolean passive;
-  
-  private String remotePath;
-  
-  private ArrayList<EsrSystemInfo> esrSystemInfos;
-
-  public String getEmsId() {
-    return emsId;
-  }
-
-  public void setEmsId(String emsId) {
-    this.emsId = emsId;
-  }
-
-  public Boolean getPassive() {
-    return passive;
-  }
-
-  public void setPassive(Boolean passive) {
-    this.passive = passive;
-  }
-
-  public String getRemotePath() {
-    return remotePath;
-  }
-
-  public void setRemotePath(String remotePath) {
-    this.remotePath = remotePath;
-  }
-
-  public ArrayList<EsrSystemInfo> getEsrSystemInfos() {
-    return esrSystemInfos;
-  }
-
-  public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) {
-    this.esrSystemInfos = esrSystemInfos;
-  }
-}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java
deleted file mode 100644 (file)
index 12bb2bc..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * 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.externalservice.entity;
-
-public class EsrSystemInfo {
-
-  private String esrSystemInfoId;
-  
-  private String systemName;
-  
-  private String type;
-  
-  private String vendor;
-  
-  private String version;
-  
-  private String serviceUrl;
-  
-  private String userName;
-  
-  private String password;
-  
-  private String systemType;
-  
-  private String protocal;
-  
-  private String sslCacert;
-  
-  private Boolean sslInsecure;
-  
-  private Boolean ipAddress;
-  
-  private Boolean port;
-  
-  private Boolean cloudDomain;
-  
-  private Boolean defaultTenant;
-
-  public String getEsrSystemInfoId() {
-    return esrSystemInfoId;
-  }
-
-  public void setEsrSystemInfoId(String esrSystemInfoId) {
-    this.esrSystemInfoId = esrSystemInfoId;
-  }
-
-  public String getSystemName() {
-    return systemName;
-  }
-
-  public void setSystemName(String systemName) {
-    this.systemName = systemName;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getVendor() {
-    return vendor;
-  }
-
-  public void setVendor(String vendor) {
-    this.vendor = vendor;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public void setVersion(String version) {
-    this.version = version;
-  }
-
-  public String getServiceUrl() {
-    return serviceUrl;
-  }
-
-  public void setServiceUrl(String serviceUrl) {
-    this.serviceUrl = serviceUrl;
-  }
-
-  public String getUserName() {
-    return userName;
-  }
-
-  public void setUserName(String userName) {
-    this.userName = userName;
-  }
-
-  public String getPassword() {
-    return password;
-  }
-
-  public void setPassword(String password) {
-    this.password = password;
-  }
-
-  public String getSystemType() {
-    return systemType;
-  }
-
-  public void setSystemType(String systemType) {
-    this.systemType = systemType;
-  }
-
-  public String getProtocal() {
-    return protocal;
-  }
-
-  public void setProtocal(String protocal) {
-    this.protocal = protocal;
-  }
-
-  public String getSslCacert() {
-    return sslCacert;
-  }
-
-  public void setSslCacert(String sslCacert) {
-    this.sslCacert = sslCacert;
-  }
-
-  public Boolean getSslInsecure() {
-    return sslInsecure;
-  }
-
-  public void setSslInsecure(Boolean sslInsecure) {
-    this.sslInsecure = sslInsecure;
-  }
-
-  public Boolean getIpAddress() {
-    return ipAddress;
-  }
-
-  public void setIpAddress(Boolean ipAddress) {
-    this.ipAddress = ipAddress;
-  }
-
-  public Boolean getPort() {
-    return port;
-  }
-
-  public void setPort(Boolean port) {
-    this.port = port;
-  }
-
-  public Boolean getCloudDomain() {
-    return cloudDomain;
-  }
-
-  public void setCloudDomain(Boolean cloudDomain) {
-    this.cloudDomain = cloudDomain;
-  }
-
-  public Boolean getDefaultTenant() {
-    return defaultTenant;
-  }
-
-  public void setDefaultTenant(Boolean defaultTenant) {
-    this.defaultTenant = defaultTenant;
-  }
-  
-}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java
deleted file mode 100644 (file)
index 068e288..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.externalservice.entity;
-
-public class EsrThirdpartySdnc {
-
-  private String thirdpartySdncId;
-  
-  private String location;
-  
-  private String productName;
-
-  public String getThirdpartySdncId() {
-    return thirdpartySdncId;
-  }
-
-  public void setThirdpartySdncId(String thirdpartySdncId) {
-    this.thirdpartySdncId = thirdpartySdncId;
-  }
-
-  public String getLocation() {
-    return location;
-  }
-
-  public void setLocation(String location) {
-    this.location = location;
-  }
-
-  public String getProductName() {
-    return productName;
-  }
-
-  public void setProductName(String productName) {
-    this.productName = productName;
-  }
-  
-}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java
deleted file mode 100644 (file)
index 05d1789..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.externalservice.entity;
-
-import java.util.ArrayList;
-
-public class EsrVnfm {
-
-  private String vnfmId;
-  
-  private String vimId;
-  
-  private String certificateUrl;
-  
-  private ArrayList<EsrSystemInfo> esrSystemInfos;
-
-  public String getVnfmId() {
-    return vnfmId;
-  }
-
-  public void setVnfmId(String vnfmId) {
-    this.vnfmId = vnfmId;
-  }
-
-  public String getVimId() {
-    return vimId;
-  }
-
-  public void setVimId(String vimId) {
-    this.vimId = vimId;
-  }
-
-  public String getCertificateUrl() {
-    return certificateUrl;
-  }
-
-  public void setCertificateUrl(String certificateUrl) {
-    this.certificateUrl = certificateUrl;
-  }
-
-  public ArrayList<EsrSystemInfo> getEsrSystemInfos() {
-    return esrSystemInfos;
-  }
-
-  public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) {
-    this.esrSystemInfos = esrSystemInfos;
-  }
-  
-}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java
deleted file mode 100644 (file)
index f79f584..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright 2016-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.externalservice.entity;
-
-
-public class ServiceNode {
-  
-  private String ip;
-  
-  private String port;
-  
-  private int ttl;
-
-  public String getIp() {
-    return ip;
-  }
-
-  public void setIp(String ip) {
-    this.ip = ip;
-  }
-
-  public String getPort() {
-    return port;
-  }
-
-  public void setPort(String port) {
-    this.port = port;
-  }
-
-  public int getTtl() {
-    return ttl;
-  }
-
-  public void setTtl(int ttl) {
-    this.ttl = ttl;
-  }
-  
-  
-}
index 2d120de..8127053 100644 (file)
@@ -21,9 +21,14 @@ import com.google.gson.Gson;
 //import org.slf4j.LoggerFactory;
 
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.UUID;
 
+import org.onap.aai.esr.entity.aai.AuthInfo;
+import org.onap.aai.esr.entity.aai.EsrSystemInfo;
+import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
+
 public class ExtsysUtil {
 //  private final static Logger logger = LoggerFactory.getLogger(ExtsysUtil.class);
 
@@ -51,4 +56,14 @@ public class ExtsysUtil {
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     return sdf.format(new Date());
   }
+  
+  public static EsrSystemInfoList getEsrSystemInfoList(AuthInfo authInfo) {
+    EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+    EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
+    ArrayList<AuthInfo> authInfos = new ArrayList<AuthInfo>();
+    authInfos.add(authInfo);
+    esrSystemInfo.setEsrSystemInfo(authInfos);
+    esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);
+    return esrSystemInfoList;
+  }
 }
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
new file mode 100644 (file)
index 0000000..caad565
--- /dev/null
@@ -0,0 +1,91 @@
+/**
+ * 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.util;
+
+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.AuthInfo;
+import org.onap.aai.esr.entity.aai.CloudRegion;
+import org.onap.aai.esr.entity.aai.EsrSystemInfo;
+import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
+import org.onap.aai.esr.entity.rest.VimAuthInfo;
+import org.onap.aai.esr.entity.rest.VimRegisterInfo;
+
+
+public class VimManagerUtil {
+  
+  public static CloudRegion vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
+    CloudRegion cloudRegion = new CloudRegion();
+    EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList();
+    AuthInfo authInfo = new AuthInfo();
+    
+    cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner());
+    cloudRegion.setCloudRegionId(vimRegisterInfo.getCloudRegionId());
+    cloudRegion.setCloudType(vimRegisterInfo.getCloudType());
+    cloudRegion.setCloudRegionVersion(vimRegisterInfo.getCloudRegionVersion());
+    cloudRegion.setCloudZone(vimRegisterInfo.getCloudZone());
+    cloudRegion.setComplexName(vimRegisterInfo.getComplexName());
+    cloudRegion.setOwnerDefinedType(vimRegisterInfo.getOwnerDefinedType());
+    cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo());
+    
+    authInfo = vimAuthInfo2AuthInfo(vimRegisterInfo.getVimAuthInfo());
+    esrSystemInfo = ExtsysUtil.getEsrSystemInfoList(authInfo);
+    cloudRegion.setEsrSystemInfoList(esrSystemInfo);
+    return cloudRegion;
+  }
+
+  private static AuthInfo vimAuthInfo2AuthInfo(VimAuthInfo vimAuthInfo) {
+    AuthInfo authInfo = new AuthInfo();
+    authInfo.setCloudDomain(vimAuthInfo.getCloudDomain());
+    authInfo.setUserName(vimAuthInfo.getUserName());
+    authInfo.setPassword(vimAuthInfo.getPassword());
+    authInfo.setServiceUrl(vimAuthInfo.getAuthUrl());
+    authInfo.setSslCassert(vimAuthInfo.getSslCacert());
+    authInfo.setSslInsecure(vimAuthInfo.getSslInsecure());
+    authInfo.setEsrSystemInfoId(ExtsysUtil.generateId());
+    authInfo.setSystemType(SystemType.VIM.toString());
+    authInfo.setSystemStatus(SystemStatus.normal.toString());
+    return authInfo;
+  }
+  
+  private static VimAuthInfo authInfo2VimAuthInfo(AuthInfo authInfo) {
+    VimAuthInfo vimAuthInfo = new VimAuthInfo();
+    vimAuthInfo.setAuthUrl(authInfo.getServiceUrl());
+    vimAuthInfo.setCloudDomain(authInfo.getCloudDomain());
+    vimAuthInfo.setPassword(authInfo.getPassword());
+    vimAuthInfo.setSslCacert(authInfo.getSslCassert());
+    vimAuthInfo.setSslInsecure(authInfo.getSslInsecure());
+    vimAuthInfo.setUserName(authInfo.getUserName());
+    return vimAuthInfo;
+  }
+  
+  public static VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegion cloudRegion) {
+    VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
+    VimAuthInfo vimAuthInfo = new VimAuthInfo();
+    vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().getEsrSystemInfo().get(0));
+    vimRegisterInfo.setVimAuthInfo(vimAuthInfo);
+    vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo());
+    vimRegisterInfo.setCloudOwner(cloudRegion.getCloudOwner());
+    vimRegisterInfo.setCloudRegionId(cloudRegion.getCloudRegionId());
+    vimRegisterInfo.setCloudType(cloudRegion.getCloudType());
+    vimRegisterInfo.setCloudZone(cloudRegion.getCloudZone());
+    vimRegisterInfo.setComplexName(cloudRegion.getComplexName());
+    vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType());
+    return vimRegisterInfo;
+  }
+}