From 0f4c91c98e9fe5e403c110a85375778b7fad04fb Mon Sep 17 00:00:00 2001 From: lizi00164331 Date: Mon, 11 Sep 2017 20:13:35 +0800 Subject: [PATCH] Realize the data transaction of VIM. 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 --- .../{ExtSysResuorceType.java => SystemStatus.java} | 12 +- .../common/{Parameters.java => SystemType.java} | 10 +- .../java/org/onap/aai/esr/entity/aai/AuthInfo.java | 28 ++-- .../org/onap/aai/esr/entity/aai/CloudRegion.java | 10 ++ .../java/org/onap/aai/esr/entity/aai/EsrEms.java | 10 ++ .../onap/aai/esr/entity/aai/EsrSystemInfoList.java | 10 +- .../onap/aai/esr/entity/aai/EsrThirdpartySdnc.java | 10 ++ .../java/org/onap/aai/esr/entity/aai/EsrVnfm.java | 10 ++ .../rest/{AuthInfoItem.java => VimAuthInfo.java} | 9 +- .../onap/aai/esr/entity/rest/VimRegisterInfo.java | 11 +- .../aai/esr/externalservice/aai/IEsrVimRest.java | 2 +- .../esr/externalservice/entity/CloudRegion.java | 112 ------------- .../aai/esr/externalservice/entity/EsrEms.java | 60 ------- .../esr/externalservice/entity/EsrSystemInfo.java | 180 --------------------- .../externalservice/entity/EsrThirdpartySdnc.java | 50 ------ .../aai/esr/externalservice/entity/EsrVnfm.java | 62 ------- .../esr/externalservice/entity/ServiceNode.java | 52 ------ .../java/org/onap/aai/esr/util/ExtsysUtil.java | 15 ++ .../java/org/onap/aai/esr/util/VimManagerUtil.java | 91 +++++++++++ 19 files changed, 187 insertions(+), 557 deletions(-) rename esr-mgr/src/main/java/org/onap/aai/esr/common/{ExtSysResuorceType.java => SystemStatus.java} (75%) rename esr-mgr/src/main/java/org/onap/aai/esr/common/{Parameters.java => SystemType.java} (82%) rename esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/{AuthInfoItem.java => VimAuthInfo.java} (91%) delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java create mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java similarity index 75% rename from esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java rename to esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java index 650cca8..26ce92f 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java @@ -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. @@ -13,14 +13,8 @@ * 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 } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java similarity index 82% rename from esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java rename to esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java index 0e80e24..c075865 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java @@ -16,12 +16,6 @@ package org.onap.aai.esr.common; -/** - * Parameters.
- * - * @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 } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/AuthInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/AuthInfo.java index f7663b8..56d76cb 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/AuthInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/AuthInfo.java @@ -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; + } + } 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 64e5f4d..49d7f9d 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 @@ -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; + } } 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/EsrEms.java index af37abd..3bff6a0 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/EsrEms.java @@ -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; + } } 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 535e5db..5adef8e 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,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; } } 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/EsrThirdpartySdnc.java index a4fad11..ecb8f10 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/EsrThirdpartySdnc.java @@ -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; + } } 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/EsrVnfm.java index d6b85e6..85f98b5 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/EsrVnfm.java @@ -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; + } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java similarity index 91% rename from esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java rename to esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java index 4e9948a..c0dd349 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java @@ -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; } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java index 409282a..e5fc132 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java @@ -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; } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java index 1ecd6d1..b257d79 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java @@ -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 index f4fcf20..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java +++ /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 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 getEsrSystemInfos() { - return esrSystemInfos; - } - - public void setEsrSystemInfos(ArrayList 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 index a11b5d4..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java +++ /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 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 getEsrSystemInfos() { - return esrSystemInfos; - } - - public void setEsrSystemInfos(ArrayList 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 index 12bb2bc..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java +++ /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 index 068e288..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java +++ /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 index 05d1789..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java +++ /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 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 getEsrSystemInfos() { - return esrSystemInfos; - } - - public void setEsrSystemInfos(ArrayList 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 index f79f584..0000000 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java +++ /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; - } - - -} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java index 2d120de..8127053 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java @@ -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 authInfos = new ArrayList(); + 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 index 0000000..caad565 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java @@ -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; + } +} -- 2.16.6