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>
/**
- * 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
}
private String sslCassert;
- private String sslInsecure;
+ private Boolean sslInsecure;
private String ipAddress;
private String defaultTenant;
private String systemStatus;
+
+ private String resouceVersion;
public String getEsrSystemInfoId() {
return esrSystemInfoId;
this.sslCassert = sslCassert;
}
- public String getSslInsecure() {
- return sslInsecure;
- }
-
- public void setSslInsecure(String sslInsecure) {
- this.sslInsecure = sslInsecure;
- }
-
public String getIpAddress() {
return ipAddress;
}
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;
+ }
+
}
private String cloudExtraInfo;
+ private String resouceVersion;
+
private EsrSystemInfoList esrSystemInfoList;
public String getCloudOwner() {
public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
this.esrSystemInfoList = esrSystemInfoList;
}
+
+ public String getResouceVersion() {
+ return resouceVersion;
+ }
+
+ public void setResouceVersion(String resouceVersion) {
+ this.resouceVersion = resouceVersion;
+ }
}
private String remotePath;
+ private String resouceVersion;
+
private EsrSystemInfoList esrSystemInfoList;
public String getEmsId() {
public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
this.esrSystemInfoList = esrSystemInfoList;
}
+
+ public String getResouceVersion() {
+ return resouceVersion;
+ }
+
+ public void setResouceVersion(String resouceVersion) {
+ this.resouceVersion = resouceVersion;
+ }
}
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;
}
}
private String productName;
+ private String resouceVersion;
+
private EsrSystemInfoList esrSystemInfoList;
public String getThirdpartySdncId() {
public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) {
this.esrSystemInfoList = esrSystemInfoList;
}
+
+ public String getResouceVersion() {
+ return resouceVersion;
+ }
+
+ public void setResouceVersion(String resouceVersion) {
+ this.resouceVersion = resouceVersion;
+ }
}
private String certificateUrl;
+ private String resouceVersion;
+
private EsrSystemInfoList esrSystemInfoList;
public String getVnfmId() {
this.esrSystemInfoList = esrSystemInfoList;
}
+ public String getResouceVersion() {
+ return resouceVersion;
+ }
+
+ public void setResouceVersion(String resouceVersion) {
+ this.resouceVersion = resouceVersion;
+ }
+
}
*/
package org.onap.aai.esr.entity.rest;
-public class AuthInfoItem {
+public class VimAuthInfo {
private String cloudDomain;
private String sslCacert;
- private String sslInsecure;
+ private Boolean sslInsecure;
public String getCloudDomain() {
return cloudDomain;
this.sslCacert = sslCacert;
}
- public String getSslInsecure() {
+ public Boolean getSslInsecure() {
return sslInsecure;
}
- public void setSslInsecure(String sslInsecure) {
+ public void setSslInsecure(Boolean sslInsecure) {
this.sslInsecure = sslInsecure;
}
+
}
private String cloudExtraInfo;
- private AuthInfoItem authInfoItem;
+ private VimAuthInfo vimAuthInfo;
public String getCloudOwner() {
return cloudOwner;
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;
}
+
}
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;
+++ /dev/null
-/**
- * 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;
- }
-}
+++ /dev/null
-/**
- * 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;
- }
-}
+++ /dev/null
-/**
- * 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;
- }
-
-}
+++ /dev/null
-/**
- * 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;
- }
-
-}
+++ /dev/null
-/**
- * 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;
- }
-
-}
+++ /dev/null
-/**
- * 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;
- }
-
-
-}
//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);
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;
+ }
}
--- /dev/null
+/**
+ * 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;
+ }
+}