diff options
author | Lizi <li.zi30@zte.com.cn> | 2018-01-11 03:29:08 +0000 |
---|---|---|
committer | Lizi <li.zi30@zte.com.cn> | 2018-01-11 03:29:24 +0000 |
commit | ed26992f976741031237ead3a5dc0565d4318b05 (patch) | |
tree | fb88683a32e2dfaf4030febbd9779c749a67c128 /esr-mgr/src/main | |
parent | f73ad41f58f1f60d00d42a8bc5fc2502a46d62dd (diff) |
Fix the java code style issue.
Change-Id: Ic4e307ff6bfede6e505b2d758b7f174532b2335b
Issue-ID: AAI-622
Signed-off-by: Lizi <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr/src/main')
59 files changed, 3232 insertions, 3353 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java index e1db108..5b1f6cd 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java @@ -26,47 +26,46 @@ import org.onap.aai.esr.resource.VnfmManager; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import io.dropwizard.Application; import io.dropwizard.setup.Environment; public class ExtsysApp extends Application<ExtsysAppConfiguration> { - private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class); - - public static void main(String[] args) throws Exception { - new ExtsysApp().run(args); - } + private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class); + + public static void main(String[] args) throws Exception { + new ExtsysApp().run(args); + } - @Override - public String getName() { - return "ONAP-ESR"; - } + @Override + public String getName() { + return "ONAP-ESR"; + } - @Override - public void run(ExtsysAppConfiguration configuration, Environment environment) { - LOGGER.info("Start to initialize esr."); - MsbConfig.setMsbServerAddr(configuration.getMsbServerAddr()); - MsbConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp()); - MsbConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort()); - environment.jersey().register(new EmsManager()); - environment.jersey().register(new ThirdpartySdncManager()); - environment.jersey().register(new VimManager()); - environment.jersey().register(new VnfmManager()); - environment.jersey().register(new ServiceTest()); - if (configuration.getRegistByHand().equals("true")){ - String MSB_IP=configuration.getMsbDiscoveryIp(); - Integer MSB_Port= Integer.valueOf(configuration.getMsbDiscoveryPort()); - MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port); - MsbHelper helper = new MsbHelper(msbClient); - try { - helper.registerMsb(); - LOGGER.info("Register esr-server to msb by java-sdk finished"); - } catch (Exception e) { - LOGGER.error("Register esr-server to msb by java-sdk failed", e); - } + @Override + public void run(ExtsysAppConfiguration configuration, Environment environment) { + LOGGER.info("Start to initialize esr."); + MsbConfig.setMsbServerAddr(configuration.getMsbServerAddr()); + MsbConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp()); + MsbConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort()); + environment.jersey().register(new EmsManager()); + environment.jersey().register(new ThirdpartySdncManager()); + environment.jersey().register(new VimManager()); + environment.jersey().register(new VnfmManager()); + environment.jersey().register(new ServiceTest()); + if (configuration.getRegistByHand().equals("true")) { + String MSB_IP = configuration.getMsbDiscoveryIp(); + Integer MSB_Port = Integer.valueOf(configuration.getMsbDiscoveryPort()); + MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port); + MsbHelper helper = new MsbHelper(msbClient); + try { + helper.registerMsb(); + LOGGER.info("Register esr-server to msb by java-sdk finished"); + } catch (Exception e) { + LOGGER.error("Register esr-server to msb by java-sdk failed", e); + } + } + LOGGER.info("Initialize extsys finished."); } - LOGGER.info("Initialize extsys finished."); - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java index 0ac6d7a..dd0a136 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java @@ -20,100 +20,99 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.Configuration; import org.hibernate.validator.constraints.NotEmpty; import org.jvnet.hk2.annotations.Service; - - import javax.validation.Valid; @Service public class ExtsysAppConfiguration extends Configuration { - @NotEmpty - private String template; - - @NotEmpty - private String defaultName = "ONAP-A&AI-ESR"; - - @NotEmpty - private String msbDiscoveryIp; - - @NotEmpty - private String msbDiscoveryPort; - - @NotEmpty - private String registByHand; - - @NotEmpty - private String msbServerAddr; - - @Valid - private String serviceIp; - - @JsonProperty - public String getTemplate() { - return template; - } - - @JsonProperty - public void setTemplate(String template) { - this.template = template; - } - - @JsonProperty - public String getDefaultName() { - return defaultName; - } - - @JsonProperty - public void setDefaultName(String name) { - this.defaultName = name; - } - - @JsonProperty - public String getMsbDiscoveryIp() { - return msbDiscoveryIp; - } - - @JsonProperty - public void setMsbDiscoveryIp(String discoveryIp) { - this.msbDiscoveryIp = discoveryIp; - } - - @JsonProperty - public String getMsbServerAddr() { - return msbServerAddr; - } - - @JsonProperty - public void setMsbServerAddr(String msbServerAddr) { - this.msbServerAddr = msbServerAddr; - } - @JsonProperty - public String getServiceIp() { - return serviceIp; - } - - @JsonProperty - public void setServiceIp(String serviceIp) { - this.serviceIp = serviceIp; - } - - @JsonProperty - public String getRegistByHand() { - return registByHand; - } - - @JsonProperty - public void setRegistByHand(String registByHand) { - this.registByHand = registByHand; - } - - @JsonProperty - public void setMsbDiscoveryPort(String msbDiscoveryPort) { - this.msbDiscoveryPort = msbDiscoveryPort; - } - - @JsonProperty - public String getMsbDiscoveryPort() { - return msbDiscoveryPort; - } + @NotEmpty + private String template; + + @NotEmpty + private String defaultName = "ONAP-A&AI-ESR"; + + @NotEmpty + private String msbDiscoveryIp; + + @NotEmpty + private String msbDiscoveryPort; + + @NotEmpty + private String registByHand; + + @NotEmpty + private String msbServerAddr; + + @Valid + private String serviceIp; + + @JsonProperty + public String getTemplate() { + return template; + } + + @JsonProperty + public void setTemplate(String template) { + this.template = template; + } + + @JsonProperty + public String getDefaultName() { + return defaultName; + } + + @JsonProperty + public void setDefaultName(String name) { + this.defaultName = name; + } + + @JsonProperty + public String getMsbDiscoveryIp() { + return msbDiscoveryIp; + } + + @JsonProperty + public void setMsbDiscoveryIp(String discoveryIp) { + this.msbDiscoveryIp = discoveryIp; + } + + @JsonProperty + public String getMsbServerAddr() { + return msbServerAddr; + } + + @JsonProperty + public void setMsbServerAddr(String msbServerAddr) { + this.msbServerAddr = msbServerAddr; + } + + @JsonProperty + public String getServiceIp() { + return serviceIp; + } + + @JsonProperty + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } + + @JsonProperty + public String getRegistByHand() { + return registByHand; + } + + @JsonProperty + public void setRegistByHand(String registByHand) { + this.registByHand = registByHand; + } + + @JsonProperty + public void setMsbDiscoveryPort(String msbDiscoveryPort) { + this.msbDiscoveryPort = msbDiscoveryPort; + } + + @JsonProperty + public String getMsbDiscoveryPort() { + return msbDiscoveryPort; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java index 3826bf8..fb39f37 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java @@ -20,13 +20,13 @@ import org.onap.aai.esr.ExtsysAppConfiguration; public class Config { - private static ExtsysAppConfiguration configration; + private static ExtsysAppConfiguration configration; - public static ExtsysAppConfiguration getConfigration() { - return configration; - } + public static ExtsysAppConfiguration getConfigration() { + return configration; + } - public static void setConfigration(ExtsysAppConfiguration config) { - configration = config; - } + public static void setConfigration(ExtsysAppConfiguration config) { + configration = config; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java index 86ff1b0..e2fb682 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java @@ -17,64 +17,64 @@ package org.onap.aai.esr.common; public class MsbConfig { - - protected static String msbServerAddr; - - protected static String cloudInfrastructureAddr; - - protected static String externalSystemAddr; - - protected static String multiCloudAddr; - - protected static String msbDiscoveryIp; - - protected static String msbDiscoveryPort; - - public static void setCloudInfrastructureAddr(String address){ - cloudInfrastructureAddr = address; - } - - public static String getCloudInfrastructureAddr(){ - return msbServerAddr + "/api/aai-cloudInfrastructure/v11"; - } - - public static String getExternalSystemAddr() { - return msbServerAddr + "/api/aai-externalSystem/v11"; - } - - public static void setExternalSystemAddr(String Addr) { - externalSystemAddr = Addr; - } - - public static void setMultiCloudAddr(String address){ - multiCloudAddr = address; - } - - public static String getMultiCloudAddr(){ - return msbServerAddr + "/api/multicloud/v0"; - } - - public static String getMsbDiscoveryIp() { - return msbDiscoveryIp; - } - - public static void setMsbDiscoveryIp(String discoveryIp) { - msbDiscoveryIp = discoveryIp; - } - - public static String getMsbDiscoveryPort() { - return msbDiscoveryPort; - } - - public static void setMsbDiscoveryPort(String discoveryPort) { - msbDiscoveryPort = discoveryPort; - } - - public static String getMsbServerAddr() { - return msbServerAddr; - } - - public static void setMsbServerAddr(String msbServerAddr) { - MsbConfig.msbServerAddr = msbServerAddr; - } + + protected static String msbServerAddr; + + protected static String cloudInfrastructureAddr; + + protected static String externalSystemAddr; + + protected static String multiCloudAddr; + + protected static String msbDiscoveryIp; + + protected static String msbDiscoveryPort; + + public static void setCloudInfrastructureAddr(String address) { + cloudInfrastructureAddr = address; + } + + public static String getCloudInfrastructureAddr() { + return msbServerAddr + "/api/aai-cloudInfrastructure/v11"; + } + + public static String getExternalSystemAddr() { + return msbServerAddr + "/api/aai-externalSystem/v11"; + } + + public static void setExternalSystemAddr(String Addr) { + externalSystemAddr = Addr; + } + + public static void setMultiCloudAddr(String address) { + multiCloudAddr = address; + } + + public static String getMultiCloudAddr() { + return msbServerAddr + "/api/multicloud/v0"; + } + + public static String getMsbDiscoveryIp() { + return msbDiscoveryIp; + } + + public static void setMsbDiscoveryIp(String discoveryIp) { + msbDiscoveryIp = discoveryIp; + } + + public static String getMsbDiscoveryPort() { + return msbDiscoveryPort; + } + + public static void setMsbDiscoveryPort(String discoveryPort) { + msbDiscoveryPort = discoveryPort; + } + + public static String getMsbServerAddr() { + return msbServerAddr; + } + + public static void setMsbServerAddr(String msbServerAddr) { + MsbConfig.msbServerAddr = msbServerAddr; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java index 26ce92f..c96884a 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java @@ -16,5 +16,5 @@ package org.onap.aai.esr.common; public enum SystemStatus { - normal,abnormal + normal, abnormal } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java index c075865..c637c5e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java @@ -17,5 +17,5 @@ package org.onap.aai.esr.common; public enum SystemType { - VNFM,EMS_RESOUCE,EMS_PERFORMANCE,EMS_ALARM,thirdparty_SDNC,VIM + VNFM, EMS_RESOUCE, EMS_PERFORMANCE, EMS_ALARM, thirdparty_SDNC, VIM } 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 b6db29f..afe28ed 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 @@ -16,114 +16,113 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class CloudRegion implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-type") - private String cloudType; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("owner-defined-type") - private String ownerDefinedType; - - @SerializedName("cloud-zone") - private String cloudZone; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("cloud-extra-info") - private String cloudExtraInfo; - - @SerializedName("resource-version") - private String resourceVersion; - - 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 String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-owner") + private String cloudOwner; + + @SerializedName("cloud-region-id") + private String cloudRegionId; + + @SerializedName("cloud-type") + private String cloudType; + + @SerializedName("cloud-region-version") + private String cloudRegionVersion; + + @SerializedName("owner-defined-type") + private String ownerDefinedType; + + @SerializedName("cloud-zone") + private String cloudZone; + + @SerializedName("complex-name") + private String complexName; + + @SerializedName("cloud-extra-info") + private String cloudExtraInfo; + + @SerializedName("resource-version") + private String resourceVersion; + + 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 String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } } 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 9f44386..4f14c25 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 @@ -16,121 +16,120 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class CloudRegionDetail implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-type") - private String cloudType; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("owner-defined-type") - private String ownerDefinedType; - - @SerializedName("cloud-zone") - private String cloudZone; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("cloud-extra-info") - private String cloudExtraInfo; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - 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 String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-owner") + private String cloudOwner; + + @SerializedName("cloud-region-id") + private String cloudRegionId; + + @SerializedName("cloud-type") + private String cloudType; + + @SerializedName("cloud-region-version") + private String cloudRegionVersion; + + @SerializedName("owner-defined-type") + private String ownerDefinedType; + + @SerializedName("cloud-zone") + private String cloudZone; + + @SerializedName("complex-name") + private String complexName; + + @SerializedName("cloud-extra-info") + private String cloudExtraInfo; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + 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 String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java index c6815d2..890cad5 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class CloudRegionList implements Serializable { - - public static final long serialVersionUID = 1L; - @SerializedName("cloud-region") - private List<CloudRegion> cloudRegion; + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-region") + private List<CloudRegion> cloudRegion; - public List<CloudRegion> getCloudRegion() { - return cloudRegion; - } + public List<CloudRegion> getCloudRegion() { + return cloudRegion; + } - public void setCloudRegion(List<CloudRegion> cloudRegion) { - this.cloudRegion = cloudRegion; - } + public void setCloudRegion(List<CloudRegion> cloudRegion) { + this.cloudRegion = cloudRegion; + } } 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 d50af6b..1a347e2 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 @@ -16,32 +16,31 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrEms implements Serializable { - -public static final long serialVersionUID = 1L; - - @SerializedName("ems-id") - private String emsId; - - @SerializedName("resource-version") - private String resourceVersion; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("ems-id") + private String emsId; + + @SerializedName("resource-version") + private String resourceVersion; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java index 139c0e2..24b1aa9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java @@ -16,43 +16,42 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrEmsDetail implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("ems-id") - private String emsId; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public static final long serialVersionUID = 1L; + + @SerializedName("ems-id") + private String emsId; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java index 8d4dc69..ffb661f 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrEmsList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-ems") - private List<EsrEms> esrEms; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-ems") + private List<EsrEms> esrEms; - public List<EsrEms> getEsrEms() { - return esrEms; - } + public List<EsrEms> getEsrEms() { + return esrEms; + } - public void setEsrEms(List<EsrEms> esrEms) { - this.esrEms = esrEms; - } + public void setEsrEms(List<EsrEms> esrEms) { + this.esrEms = esrEms; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java index b02afbe..4faae16 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java @@ -16,231 +16,230 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrSystemInfo implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("esr-system-info-id") - private String esrSystemInfoId; - - @SerializedName("system-name") - private String systemName; - - @SerializedName("type") - private String type; - - @SerializedName("vendor") - private String vendor; - - @SerializedName("version") - private String version; - - @SerializedName("service-url") - private String serviceUrl; - - @SerializedName("user-name") - private String userName; - - @SerializedName("password") - private String password; - - @SerializedName("system-type") - private String systemType; - - @SerializedName("protocol") - private String protocol; - - @SerializedName("ssl-cassert") - private String sslCassert; - - @SerializedName("ssl-insecure") - private Boolean sslInsecure; - - @SerializedName("ip-address") - private String ipAddress; - - @SerializedName("port") - private String port; - - @SerializedName("cloud-domain") - private String cloudDomain; - - @SerializedName("default-tenant") - private String defaultTenant; - - @SerializedName("passive") - private Boolean passive; - - @SerializedName("remote-path") - private String remotePath; - - @SerializedName("system-status") - private String systemStatus; - - @SerializedName("resource-version") - private String resourceVersion; - - 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 getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getSslCassert() { - return sslCassert; - } - - public void setSslCassert(String sslCassert) { - this.sslCassert = sslCassert; - } - - public Boolean getSslInsecure() { - return sslInsecure; - } - - public void setSslInsecure(Boolean sslInsecure) { - this.sslInsecure = sslInsecure; - } - - public String getIpAddress() { - return ipAddress; - } - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } + public static final long serialVersionUID = 1L; + + @SerializedName("esr-system-info-id") + private String esrSystemInfoId; + + @SerializedName("system-name") + private String systemName; + + @SerializedName("type") + private String type; + + @SerializedName("vendor") + private String vendor; + + @SerializedName("version") + private String version; + + @SerializedName("service-url") + private String serviceUrl; + + @SerializedName("user-name") + private String userName; + + @SerializedName("password") + private String password; + + @SerializedName("system-type") + private String systemType; + + @SerializedName("protocol") + private String protocol; + + @SerializedName("ssl-cassert") + private String sslCassert; + + @SerializedName("ssl-insecure") + private Boolean sslInsecure; + + @SerializedName("ip-address") + private String ipAddress; + + @SerializedName("port") + private String port; + + @SerializedName("cloud-domain") + private String cloudDomain; + + @SerializedName("default-tenant") + private String defaultTenant; + + @SerializedName("passive") + private Boolean passive; + + @SerializedName("remote-path") + private String remotePath; + + @SerializedName("system-status") + private String systemStatus; + + @SerializedName("resource-version") + private String resourceVersion; + + 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 getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getSslCassert() { + return sslCassert; + } + + public void setSslCassert(String sslCassert) { + this.sslCassert = sslCassert; + } + + public Boolean getSslInsecure() { + return sslInsecure; + } + + public void setSslInsecure(Boolean sslInsecure) { + this.sslInsecure = sslInsecure; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } - public String getPort() { - return port; - } + public String getPort() { + return port; + } - public void setPort(String port) { - this.port = port; - } + public void setPort(String port) { + this.port = port; + } - public String getCloudDomain() { - return cloudDomain; - } + public String getCloudDomain() { + return cloudDomain; + } - public void setCloudDomain(String cloudDomain) { - this.cloudDomain = cloudDomain; - } + public void setCloudDomain(String cloudDomain) { + this.cloudDomain = cloudDomain; + } - public String getDefaultTenant() { - return defaultTenant; - } + public String getDefaultTenant() { + return defaultTenant; + } - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } - public Boolean getPassive() { - return passive; - } + public Boolean getPassive() { + return passive; + } - public void setPassive(Boolean passive) { - this.passive = passive; - } + public void setPassive(Boolean passive) { + this.passive = passive; + } - public String getRemotePath() { - return remotePath; - } + public String getRemotePath() { + return remotePath; + } - public void setRemotePath(String remotePath) { - this.remotePath = remotePath; - } + public void setRemotePath(String remotePath) { + this.remotePath = remotePath; + } - public String getSystemStatus() { - return systemStatus; - } + public String getSystemStatus() { + return systemStatus; + } - public void setSystemStatus(String systemStatus) { - this.systemStatus = systemStatus; - } + public void setSystemStatus(String systemStatus) { + this.systemStatus = systemStatus; + } - public String getResouceVersion() { - return resourceVersion; - } + public String getResouceVersion() { + return resourceVersion; + } - public void setResouceVersion(String resouceVersion) { - this.resourceVersion = resouceVersion; - } + public void setResouceVersion(String resouceVersion) { + this.resourceVersion = 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 dd06c53..452cf73 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,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrSystemInfoList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-system-info") - private List<EsrSystemInfo> esrSystemInfo; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-system-info") + private List<EsrSystemInfo> esrSystemInfo; - public List<EsrSystemInfo> getEsrSystemInfo() { - return esrSystemInfo; - } + public List<EsrSystemInfo> getEsrSystemInfo() { + return esrSystemInfo; + } - public void setEsrSystemInfo(List<EsrSystemInfo> esrSystemInfo) { - this.esrSystemInfo = esrSystemInfo; - } + public void setEsrSystemInfo(List<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 89e1ffd..c478d54 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 @@ -16,53 +16,52 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdnc implements Serializable { -public static final long serialVersionUID = 1L; - - @SerializedName("thirdparty-sdnc-id") - private String thirdpartySdncId; - - @SerializedName("location") - private String location; + public static final long serialVersionUID = 1L; + + @SerializedName("thirdparty-sdnc-id") + private String thirdpartySdncId; + + @SerializedName("location") + private String location; + + @SerializedName("product-name") + private String productName; - @SerializedName("product-name") - private String productName; - - @SerializedName("resource-version") - private String resourceVersion; + @SerializedName("resource-version") + private String resourceVersion; - public String getThirdpartySdncId() { - return thirdpartySdncId; - } + public String getThirdpartySdncId() { + return thirdpartySdncId; + } - public void setThirdpartySdncId(String thirdpartySdncId) { - this.thirdpartySdncId = thirdpartySdncId; - } + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } - public String getLocation() { - return location; - } + public String getLocation() { + return location; + } - public void setLocation(String location) { - this.location = location; - } + public void setLocation(String location) { + this.location = location; + } - public String getProductName() { - return productName; - } + public String getProductName() { + return productName; + } - public void setProductName(String productName) { - this.productName = productName; - } + public void setProductName(String productName) { + this.productName = productName; + } - public String getResourceVersion() { - return resourceVersion; - } + public String getResourceVersion() { + return resourceVersion; + } - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java index 8f3dd0f..90bd29b 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java @@ -16,65 +16,64 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdncDetail implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("thirdparty-sdnc-id") - private String thirdpartySdncId; - - @SerializedName("location") - private String location; - - @SerializedName("product-name") - private String productName; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - 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; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public static final long serialVersionUID = 1L; + + @SerializedName("thirdparty-sdnc-id") + private String thirdpartySdncId; + + @SerializedName("location") + private String location; + + @SerializedName("product-name") + private String productName; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + 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; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java index 0d4d100..ed247d2 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdncList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-thirdparty-sdnc") - private List<EsrThirdpartySdnc> esrThirdpartySdnc; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-thirdparty-sdnc") + private List<EsrThirdpartySdnc> esrThirdpartySdnc; - public List<EsrThirdpartySdnc> getEsrThirdpartySdnc() { - return esrThirdpartySdnc; - } + public List<EsrThirdpartySdnc> getEsrThirdpartySdnc() { + return esrThirdpartySdnc; + } - public void setEsrThirdpartySdnc(List<EsrThirdpartySdnc> esrThirdpartySdnc) { - this.esrThirdpartySdnc = esrThirdpartySdnc; - } + public void setEsrThirdpartySdnc(List<EsrThirdpartySdnc> esrThirdpartySdnc) { + this.esrThirdpartySdnc = esrThirdpartySdnc; + } } 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 73fbc8c..c1d24d9 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 @@ -16,58 +16,57 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrVnfm implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("vnfm-id") - private String vnfmId; - - @SerializedName("vim-id") - private String vimId; - - @SerializedName("certificate-id") - private String certificateUrl; - - @SerializedName("resource-version") - private String resourceVersion; - - 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 String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } + public static final long serialVersionUID = 1L; + + @SerializedName("vnfm-id") + private String vnfmId; + + @SerializedName("vim-id") + private String vimId; + + @SerializedName("certificate-id") + private String certificateUrl; + + @SerializedName("resource-version") + private String resourceVersion; + + 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 String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java index eab70cd..7c0a3ba 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java @@ -16,66 +16,65 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrVnfmDetail implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("vnfm-id") - private String vnfmId; - - @SerializedName("vim-id") - private String vimId; - - @SerializedName("certificate-url") - private String certificateUrl; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - 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 EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("vnfm-id") + private String vnfmId; + + @SerializedName("vim-id") + private String vimId; + + @SerializedName("certificate-url") + private String certificateUrl; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + 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 EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java index eec0a07..d17ea04 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java @@ -17,22 +17,21 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrVnfmList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-vnfm") - private List<EsrVnfm> esrVnfm; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-vnfm") + private List<EsrVnfm> esrVnfm; - public List<EsrVnfm> getEsrVnfm() { - return esrVnfm; - } + public List<EsrVnfm> getEsrVnfm() { + return esrVnfm; + } - public void setEsrVnfm(List<EsrVnfm> esrVnfm) { - this.esrVnfm = esrVnfm; - } + public void setEsrVnfm(List<EsrVnfm> esrVnfm) { + this.esrVnfm = esrVnfm; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java index d777db3..39b8cbe 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java @@ -17,43 +17,43 @@ package org.onap.aai.esr.entity.rest; public class AlarmAddr { - private String ip; - - private String port; - - private String user; - - private String password; - - 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 String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } + private String ip; + + private String port; + + private String user; + + private String password; + + 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 String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java index 88f38cc..2cc2501 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java @@ -16,15 +16,15 @@ package org.onap.aai.esr.entity.rest; public class CommonRegisterResponse { - - private String id; - public String getId() { - return id; - } + private String id; - public void setId(String id) { - this.id = id; - } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java index 5f9c2b0..745a48e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java @@ -18,74 +18,74 @@ package org.onap.aai.esr.entity.rest; public class EmsRegisterInfo { - private String emsId; - - private String name; - - private String vendor; - - private String version; - - private FtpAddr resourceAddr; - - private FtpAddr performanceAddr; - - private AlarmAddr alarmAddr; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - 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 FtpAddr getResourceAddr() { - return resourceAddr; - } - - public void setResourceAddr(FtpAddr resourceAddr) { - this.resourceAddr = resourceAddr; - } - - public FtpAddr getPerformanceAddr() { - return performanceAddr; - } - - public void setPerformanceAddr(FtpAddr performanceAddr) { - this.performanceAddr = performanceAddr; - } - - public AlarmAddr getAlarmAddr() { - return alarmAddr; - } - - public void setAlarmAddr(AlarmAddr alarmAddr) { - this.alarmAddr = alarmAddr; - } + private String emsId; + + private String name; + + private String vendor; + + private String version; + + private FtpAddr resourceAddr; + + private FtpAddr performanceAddr; + + private AlarmAddr alarmAddr; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + 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 FtpAddr getResourceAddr() { + return resourceAddr; + } + + public void setResourceAddr(FtpAddr resourceAddr) { + this.resourceAddr = resourceAddr; + } + + public FtpAddr getPerformanceAddr() { + return performanceAddr; + } + + public void setPerformanceAddr(FtpAddr performanceAddr) { + this.performanceAddr = performanceAddr; + } + + public AlarmAddr getAlarmAddr() { + return alarmAddr; + } + + public void setAlarmAddr(AlarmAddr alarmAddr) { + this.alarmAddr = alarmAddr; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java index 598d6ed..f393972 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java @@ -16,74 +16,74 @@ package org.onap.aai.esr.entity.rest; public class FtpAddr { - - private String ftptype; - - private String ip; - - private String port; - - private String user; - - private String password; - - private String remotepath; - - private Boolean passive; - - public String getFtptype() { - return ftptype; - } - - public void setFtptype(String ftptype) { - this.ftptype = ftptype; - } - - 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 String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getRemotepath() { - return remotepath; - } - - public void setRemotepath(String remotepath) { - this.remotepath = remotepath; - } - - public Boolean getPassive() { - return passive; - } - - public void setPassive(Boolean passive) { - this.passive = passive; - } + + private String ftptype; + + private String ip; + + private String port; + + private String user; + + private String password; + + private String remotepath; + + private Boolean passive; + + public String getFtptype() { + return ftptype; + } + + public void setFtptype(String ftptype) { + this.ftptype = ftptype; + } + + 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 String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRemotepath() { + return remotepath; + } + + public void setRemotepath(String remotepath) { + this.remotepath = remotepath; + } + + public Boolean getPassive() { + return passive; + } + + public void setPassive(Boolean passive) { + this.passive = passive; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java index 667f0cf..30f39e9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java @@ -17,118 +17,118 @@ package org.onap.aai.esr.entity.rest; public class ThirdpartySdncRegisterInfo { - private String thirdpartySdncId; - - private String name; - - private String vendor; - - private String version; - - private String type; - - private String location; - - private String url; - - private String userName; - - private String password; - - private String productName; - - private String protocol; - - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - 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 getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public ThirdpartySdncRegisterInfo() { - - } - - public String getThirdpartySdncId() { - return thirdpartySdncId; - } - - public void setThirdpartySdncId(String thirdpartySdncId) { - this.thirdpartySdncId = thirdpartySdncId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - 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 getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } + private String thirdpartySdncId; + + private String name; + + private String vendor; + + private String version; + + private String type; + + private String location; + + private String url; + + private String userName; + + private String password; + + private String productName; + + private String protocol; + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + 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 getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public ThirdpartySdncRegisterInfo() { + + } + + public String getThirdpartySdncId() { + return thirdpartySdncId; + } + + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + 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 getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java index 4bd251f..c2ce6b3 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java @@ -16,75 +16,75 @@ package org.onap.aai.esr.entity.rest; public class VimAuthInfo { - - private String cloudDomain; - - private String userName; - - private String password; - - private String authUrl; - - private String defaultTenant; - - private String sslCacert; - - private Boolean sslInsecure; - - public String getCloudDomain() { - return cloudDomain; - } - - public void setCloudDomain(String cloudDomain) { - this.cloudDomain = cloudDomain; - } - - 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 getAuthUrl() { - return authUrl; - } - - public void setAuthUrl(String authUrl) { - this.authUrl = authUrl; - } - - 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 String getDefaultTenant() { - return defaultTenant; - } - - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + + private String cloudDomain; + + private String userName; + + private String password; + + private String authUrl; + + private String defaultTenant; + + private String sslCacert; + + private Boolean sslInsecure; + + public String getCloudDomain() { + return cloudDomain; + } + + public void setCloudDomain(String cloudDomain) { + this.cloudDomain = cloudDomain; + } + + 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 getAuthUrl() { + return authUrl; + } + + public void setAuthUrl(String authUrl) { + this.authUrl = authUrl; + } + + 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 String getDefaultTenant() { + return defaultTenant; + } + + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } } 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 1441f79..0074490 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 @@ -20,104 +20,104 @@ import java.util.List; public class VimRegisterInfo { - private String cloudOwner; + private String cloudOwner; - private String cloudRegionId; + private String cloudRegionId; - private String cloudType; + private String cloudType; - private String cloudRegionVersion; + private String cloudRegionVersion; - private String ownerDefinedType; + private String ownerDefinedType; - private String cloudZone; - - private String complexName; - - private String cloudExtraInfo; - - private String status; - - private List<VimAuthInfo> vimAuthInfos; + private String cloudZone; - public String getCloudOwner() { - return cloudOwner; - } + private String complexName; - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } + private String cloudExtraInfo; - public String getCloudRegionId() { - return cloudRegionId; - } + private String status; - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } + private List<VimAuthInfo> vimAuthInfos; - public String getCloudType() { - return cloudType; - } + public String getCloudOwner() { + return cloudOwner; + } - public void setCloudType(String cloudType) { - this.cloudType = cloudType; - } + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } - public String getCloudRegionVersion() { - return cloudRegionVersion; - } + public String getCloudRegionId() { + return cloudRegionId; + } - public void setCloudRegionVersion(String cloudRegionVersion) { - this.cloudRegionVersion = cloudRegionVersion; - } + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } - public String getOwnerDefinedType() { - return ownerDefinedType; - } + public String getCloudType() { + return cloudType; + } - public void setOwnerDefinedType(String ownerDefinedType) { - this.ownerDefinedType = ownerDefinedType; - } + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } - public String getCloudZone() { - return cloudZone; - } + public String getCloudRegionVersion() { + return cloudRegionVersion; + } - public void setCloudZone(String cloudZone) { - this.cloudZone = cloudZone; - } + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } - public String getComplexName() { - return complexName; - } + public String getOwnerDefinedType() { + return ownerDefinedType; + } - public void setComplexName(String complexName) { - this.complexName = complexName; - } + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } - public String getCloudExtraInfo() { - return cloudExtraInfo; - } + public String getCloudZone() { + return cloudZone; + } - public void setCloudExtraInfo(String cloudExtraInfo) { - this.cloudExtraInfo = cloudExtraInfo; - } + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } - public List<VimAuthInfo> getVimAuthInfos() { - return vimAuthInfos; - } + public String getComplexName() { + return complexName; + } - public void setVimAuthInfos(List<VimAuthInfo> vimAuthInfos) { - this.vimAuthInfos = vimAuthInfos; - } + public void setComplexName(String complexName) { + this.complexName = complexName; + } - public String getStatus() { - return status; - } + public String getCloudExtraInfo() { + return cloudExtraInfo; + } - public void setStatus(String status) { - this.status = status; - } + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public List<VimAuthInfo> getVimAuthInfos() { + return vimAuthInfos; + } + + public void setVimAuthInfos(List<VimAuthInfo> vimAuthInfos) { + this.vimAuthInfos = vimAuthInfos; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java index f12a2bc..c2d8bce 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java @@ -16,25 +16,25 @@ package org.onap.aai.esr.entity.rest; public class VimRegisterResponse { - - private String cloudOwner; - - private String cloudRegionId; - - 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; - } + + private String cloudOwner; + + private String cloudRegionId; + + 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; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java index b3f6737..5f91faa 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java @@ -15,106 +15,106 @@ */ package org.onap.aai.esr.entity.rest; -public class VnfmRegisterInfo{ - - private String vnfmId; - - private String name; - - private String type; - - private String vimId; - - private String vendor; - - private String version; - - private String certificateUrl; - - private String url; - - private String userName; - - private String password; - - public String getVnfmId() { - return vnfmId; - } - - public void setVnfmId(String vnfmId) { - this.vnfmId = vnfmId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getVimId() { - return vimId; - } - - public void setVimId(String vimId) { - this.vimId = vimId; - } - - 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 getCertificateUrl() { - return certificateUrl; - } - - public void setCertificateUrl(String certificateUrl) { - this.certificateUrl = certificateUrl; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - 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 class VnfmRegisterInfo { + + private String vnfmId; + + private String name; + + private String type; + + private String vimId; + + private String vendor; + + private String version; + + private String certificateUrl; + + private String url; + + private String userName; + + private String password; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + 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 getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + 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; + } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java index 57ad6f2..b6f3593 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java @@ -21,14 +21,14 @@ import javax.ws.rs.core.Response; public class ExceptionUtil { - private static final int EXCEPTION_CODE = 498; + private static final int EXCEPTION_CODE = 498; - private ExceptionUtil() { + private ExceptionUtil() { - } + } - public static WebApplicationException buildExceptionResponse(String message) { - Response response = Response.status(EXCEPTION_CODE).entity(message).type(MediaType.TEXT_PLAIN).build(); - return new WebApplicationException(response); - } + public static WebApplicationException buildExceptionResponse(String message) { + Response response = Response.status(EXCEPTION_CODE).entity(message).type(MediaType.TEXT_PLAIN).build(); + return new WebApplicationException(response); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java index 9561934..15231b9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java @@ -17,35 +17,35 @@ package org.onap.aai.esr.exception; public class ExtsysException extends Exception { - private static final long serialVersionUID = 1L; - private String errorCode; - private String errorMsg; - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public ExtsysException() { - super(); - } - - public ExtsysException(String msg, Exception e) { - super(msg, e); - } - - public ExtsysException(String msg) { - super(msg); - } + private static final long serialVersionUID = 1L; + private String errorCode; + private String errorMsg; + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public ExtsysException() { + super(); + } + + public ExtsysException(String msg, Exception e) { + super(msg, e); + } + + public ExtsysException(String msg) { + super(msg); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java index ab5e030..d28d5e5 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java @@ -17,13 +17,12 @@ package org.onap.aai.esr.externalservice.aai; public class AaiCommon { - private static String AAI_AUTHENTICATION_USER = "AAI"; - private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; - - public static String getAuthenticationCredentials() { - String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" - + AAI_AUTHENTICATION_PAASWORD; - return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()); - } - + private static String AAI_AUTHENTICATION_USER = "AAI"; + private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; + + public static String getAuthenticationCredentials() { + String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" + AAI_AUTHENTICATION_PAASWORD; + return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()); + } + } 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 57e6920..a145288 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 @@ -19,59 +19,57 @@ import org.glassfish.jersey.client.ClientConfig; import org.onap.aai.esr.common.MsbConfig; import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class CloudRegionProxy { - private static ICloudRegion adapterServiceproxy; + private static ICloudRegion adapterServiceproxy; - private static String transactionId = "9999"; - private static String fromAppId = "esr-server"; - private static String authorization = AaiCommon.getAuthenticationCredentials(); - static { - ClientConfig config = new ClientConfig(); - adapterServiceproxy = ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), - config, ICloudRegion.class); - } + private static String transactionId = "9999"; + private static String fromAppId = "esr-server"; + private static String authorization = AaiCommon.getAuthenticationCredentials(); + static { + ClientConfig config = new ClientConfig(); + adapterServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); + } - public void registerVim(String cloudOwner, String cloudRegionId, - CloudRegionDetail cloudRegion) throws ExtsysException { - ClientConfig config = new ClientConfig(new VimRegisterProvider()); - ICloudRegion registerVimServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); - try { - registerVimServiceproxy.registerVIMService(transactionId, fromAppId, authorization, cloudOwner, - cloudRegionId, cloudRegion); - } catch (Exception e) { - throw new ExtsysException("PUT cloud region to A&AI failed.", e); + public void registerVim(String cloudOwner, String cloudRegionId, CloudRegionDetail cloudRegion) + throws ExtsysException { + ClientConfig config = new ClientConfig(new VimRegisterProvider()); + ICloudRegion registerVimServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); + try { + registerVimServiceproxy.registerVIMService(transactionId, fromAppId, authorization, cloudOwner, + cloudRegionId, cloudRegion); + } catch (Exception e) { + throw new ExtsysException("PUT cloud region to A&AI failed.", e); + } } - } - public String queryVimDetail(String cloud_owner, String cloud_region_id) throws ExtsysException { - try { - return adapterServiceproxy.queryVIMDetail(transactionId, fromAppId, authorization, cloud_owner, - cloud_region_id); - } catch (Exception e) { - throw new ExtsysException("Query cloud region detail from A&AI failed.", e); + public String queryVimDetail(String cloud_owner, String cloud_region_id) throws ExtsysException { + try { + return adapterServiceproxy.queryVIMDetail(transactionId, fromAppId, authorization, cloud_owner, + cloud_region_id); + } catch (Exception e) { + throw new ExtsysException("Query cloud region detail from A&AI failed.", e); + } } - } - public String qureyVimList() throws ExtsysException { - try { - return adapterServiceproxy.queryVIMList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query cloud region list from A&AI failed.", e); + public String qureyVimList() throws ExtsysException { + try { + return adapterServiceproxy.queryVIMList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query cloud region list from A&AI failed.", e); + } } - } - public void deleteVim(String cloud_owner, String cloud_region_id, String resourceVersion) throws ExtsysException - { - try { - adapterServiceproxy.deleteVim(transactionId, fromAppId, authorization, cloud_owner, - cloud_region_id, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete cloud region from A&AI failed.", e); + public void deleteVim(String cloud_owner, String cloud_region_id, String resourceVersion) throws ExtsysException { + try { + adapterServiceproxy.deleteVim(transactionId, fromAppId, authorization, cloud_owner, cloud_region_id, + resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete cloud region from A&AI failed.", e); + } } - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java index 61ad8a5..2ab58ab 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class EmsRegisterProvider implements MessageBodyWriter<EsrEmsDetail>{ - - private static final Logger logger = LoggerFactory.getLogger(EmsRegisterProvider.class); - - @Override - public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrEmsDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrEmsDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrEmsDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrEmsDetail.class); - logger.info("the param to register EMS input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class EmsRegisterProvider implements MessageBodyWriter<EsrEmsDetail> { + + private static final Logger logger = LoggerFactory.getLogger(EmsRegisterProvider.class); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrEmsDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrEmsDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrEmsDetail t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrEmsDetail.class); + logger.info("the param to register EMS input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java index e6addce..0361747 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java @@ -21,189 +21,166 @@ import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class ExternalSystemProxy { - public static boolean isTest = false; - private static IExternalSystem externalSystemproxy; - private static String transactionId = "9999"; - private static String fromAppId = "esr-server"; - private static String authorization = AaiCommon.getAuthenticationCredentials(); - static { - ClientConfig config = new ClientConfig(); - externalSystemproxy = ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), - config, IExternalSystem.class); - } - - public static void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) - throws ExtsysException { - if (isTest) { - - } else { - ClientConfig config = new ClientConfig(new VnfmRegisterProvider()); - IExternalSystem registerVnfmServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerVnfmServiceproxy.registerVNFM(transactionId, fromAppId, authorization, vnfmId, - esrVnfmDetail); - } catch (Exception e) { - throw new ExtsysException("PUT VNFM to A&AI failed.", e); - } - } - } - - public static String queryVnfmDetail(String vnfmId) throws ExtsysException { - if(isTest) { - String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," - + "\"vim-id\":\"987654\"," - + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"qwerty\"," - + "\"system-name\":\"ONAP VNFM\"," - + "\"type\":\"vnfm\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://10.11.22.33:8000\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"VNFM\"}]}}"; - return esrVnfmDetailStr; - } - try { - return externalSystemproxy.queryVNFMDetail(transactionId, fromAppId, authorization, vnfmId); - } catch (Exception e) { - throw new ExtsysException("Query VNFM detail from A&AI failed.", e); + public static boolean isTest = false; + private static IExternalSystem externalSystemproxy; + private static String transactionId = "9999"; + private static String fromAppId = "esr-server"; + private static String authorization = AaiCommon.getAuthenticationCredentials(); + static { + ClientConfig config = new ClientConfig(); + externalSystemproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); } - } - - public static String queryVnfmList() throws ExtsysException { - if(isTest) { - String vnfmListStr = "{\"esr-vnfm\": " - + "[{\"vnfm-id\": \"123456\"," - + "\"vim-id\": \"987654\"," - + "\"certificate-url\": \"http://11.22.33.44:5000/v3\"," - + "\"resource-version\": \"1\"}]}"; - return vnfmListStr; - } - try { - return externalSystemproxy.queryVNFMList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query VNFM list from A&AI failed.", e); + + public static void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException { + if (isTest) { + + } else { + ClientConfig config = new ClientConfig(new VnfmRegisterProvider()); + IExternalSystem registerVnfmServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerVnfmServiceproxy.registerVNFM(transactionId, fromAppId, authorization, vnfmId, esrVnfmDetail); + } catch (Exception e) { + throw new ExtsysException("PUT VNFM to A&AI failed.", e); + } + } } - } - - public static void deleteVnfm(String vnfmId, String resourceVersion) throws ExtsysException { - if(!isTest) { - try { - externalSystemproxy.deleteVNFM(transactionId, fromAppId, authorization, vnfmId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete VNFM from A&AI failed.", e); - } + + public static String queryVnfmDetail(String vnfmId) throws ExtsysException { + if (isTest) { + String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," + "\"vim-id\":\"987654\"," + + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," + "\"esr-system-info-list\":{" + + "\"esr-system-info\":[{" + "\"esr-system-info-id\":\"qwerty\"," + "\"system-name\":\"ONAP VNFM\"," + + "\"type\":\"vnfm\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + + "\"service-url\":\"http://10.11.22.33:8000\"," + "\"user-name\":\"onap\"," + + "\"password\":\"987654\"," + "\"system-type\":\"VNFM\"}]}}"; + return esrVnfmDetailStr; + } + try { + return externalSystemproxy.queryVNFMDetail(transactionId, fromAppId, authorization, vnfmId); + } catch (Exception e) { + throw new ExtsysException("Query VNFM detail from A&AI failed.", e); + } } - } - - public static void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) throws ExtsysException { - if(!isTest) { - ClientConfig config = new ClientConfig(new ThirdpartySdncRegisterProvider()); - IExternalSystem registerSdncServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerSdncServiceproxy.registerThirdpartySdnc(transactionId, fromAppId, authorization, thirdpartySdncId, - esrSdncDetail); - } catch (Exception e) { - throw new ExtsysException("PUT thirdparty SDNC to A&AI failed.", e); - } + + public static String queryVnfmList() throws ExtsysException { + if (isTest) { + String vnfmListStr = "{\"esr-vnfm\": " + "[{\"vnfm-id\": \"123456\"," + "\"vim-id\": \"987654\"," + + "\"certificate-url\": \"http://11.22.33.44:5000/v3\"," + "\"resource-version\": \"1\"}]}"; + return vnfmListStr; + } + try { + return externalSystemproxy.queryVNFMList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query VNFM list from A&AI failed.", e); + } } - } - - public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws ExtsysException { - if(isTest) { - String sdncDetail = "{\"thirdparty-sdnc-id\":\"123456\"," - + "\"location\":\"edge\"," - + "\"product-name\":\"thirdparty SDNC\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"987654\"," - + "\"system-name\":\"SDNC_TEST\"," - + "\"type\":\"SDNC\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://127.0.0.1:8000\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"123987\"," - + "\"system-type\":\"thirdparty_SDNC\"," - + "\"protocol\":\"protocol\"}]}}"; - return sdncDetail; + + public static void deleteVnfm(String vnfmId, String resourceVersion) throws ExtsysException { + if (!isTest) { + try { + externalSystemproxy.deleteVNFM(transactionId, fromAppId, authorization, vnfmId, resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete VNFM from A&AI failed.", e); + } + } } - try { - return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, thirdpartySdncId); - } catch (Exception e) { - throw new ExtsysException("Query thirdparty SDNC detail from A&AI failed.", e); + + public static void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) + throws ExtsysException { + if (!isTest) { + ClientConfig config = new ClientConfig(new ThirdpartySdncRegisterProvider()); + IExternalSystem registerSdncServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerSdncServiceproxy.registerThirdpartySdnc(transactionId, fromAppId, authorization, + thirdpartySdncId, esrSdncDetail); + } catch (Exception e) { + throw new ExtsysException("PUT thirdparty SDNC to A&AI failed.", e); + } + } } - } - - public static String querySdncList() throws ExtsysException { - if(isTest) { - String sdncList = "{\"esr-thirdparty-sdnc\": " - + "[{\"thirdparty-sdnc-id\": \"123456\"," - + "\"location\": \"edge\"," - + "\"product-name\": \"thirdparty SDNC\"," - + "\"resource-version\": \"1\"}]}"; - return sdncList; + + public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws ExtsysException { + if (isTest) { + String sdncDetail = "{\"thirdparty-sdnc-id\":\"123456\"," + "\"location\":\"edge\"," + + "\"product-name\":\"thirdparty SDNC\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"987654\"," + "\"system-name\":\"SDNC_TEST\"," + "\"type\":\"SDNC\"," + + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + "\"service-url\":\"http://127.0.0.1:8000\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"123987\"," + "\"system-type\":\"thirdparty_SDNC\"," + + "\"protocol\":\"protocol\"}]}}"; + return sdncDetail; + } + try { + return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, + thirdpartySdncId); + } catch (Exception e) { + throw new ExtsysException("Query thirdparty SDNC detail from A&AI failed.", e); + } } - try { - return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query thirdparty SDNC list from A&AI failed.", e); + + public static String querySdncList() throws ExtsysException { + if (isTest) { + String sdncList = + "{\"esr-thirdparty-sdnc\": " + "[{\"thirdparty-sdnc-id\": \"123456\"," + "\"location\": \"edge\"," + + "\"product-name\": \"thirdparty SDNC\"," + "\"resource-version\": \"1\"}]}"; + return sdncList; + } + try { + return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query thirdparty SDNC list from A&AI failed.", e); + } } - } - - public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws ExtsysException { - if(!isTest) { - try { - externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e); - } + + public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws ExtsysException { + if (!isTest) { + try { + externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, + resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e); + } + } } - } - - public static void registerEms(String emsId, EsrEmsDetail emsDetail) throws ExtsysException { - ClientConfig config = new ClientConfig(new EmsRegisterProvider()); - IExternalSystem registerEmsServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerEmsServiceproxy.registerEMS(transactionId, fromAppId, authorization, emsId, - emsDetail); - } catch (Exception e) { - throw new ExtsysException("PUT EMS to A&AI failed.", e); + + public static void registerEms(String emsId, EsrEmsDetail emsDetail) throws ExtsysException { + ClientConfig config = new ClientConfig(new EmsRegisterProvider()); + IExternalSystem registerEmsServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerEmsServiceproxy.registerEMS(transactionId, fromAppId, authorization, emsId, emsDetail); + } catch (Exception e) { + throw new ExtsysException("PUT EMS to A&AI failed.", e); + } } - } - - public static String queryEmsDetail(String emsId) throws ExtsysException { - try { - return externalSystemproxy.queryEMSDetail(transactionId, fromAppId, authorization, emsId); - } catch (Exception e) { - throw new ExtsysException("Query EMS detail from A&AI failed.", e); + + public static String queryEmsDetail(String emsId) throws ExtsysException { + try { + return externalSystemproxy.queryEMSDetail(transactionId, fromAppId, authorization, emsId); + } catch (Exception e) { + throw new ExtsysException("Query EMS detail from A&AI failed.", e); + } } - } - - public static String queryEmsList() throws ExtsysException { - try { - return externalSystemproxy.queryEMSList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query EMS list from A&AI failed.", e); + + public static String queryEmsList() throws ExtsysException { + try { + return externalSystemproxy.queryEMSList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query EMS list from A&AI failed.", e); + } } - } - - public static void deleteEms(String emsId, String resourceVersion) throws ExtsysException { - try { - externalSystemproxy.deleteEMS(transactionId, fromAppId, authorization, emsId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete EMS from A&AI failed.", e); + + public static void deleteEms(String emsId, String resourceVersion) throws ExtsysException { + try { + externalSystemproxy.deleteEMS(transactionId, fromAppId, authorization, emsId, resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete EMS from A&AI failed.", e); + } } - } } 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 8f38619..43b9837 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 @@ -25,7 +25,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.exception.ExtsysException; @@ -33,41 +32,37 @@ import org.onap.aai.esr.exception.ExtsysException; @Path("/cloud-regions") public interface ICloudRegion { - @PUT - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerVIMService(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, CloudRegionDetail cloudRegion) throws ExtsysException; + @PUT + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerVIMService(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id, + CloudRegionDetail cloudRegion) throws ExtsysException; + + @GET + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVIMDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id) + throws ExtsysException; - @GET - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVIMDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id) throws ExtsysException; - - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVIMList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVIMList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @DELETE - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteVim(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @DELETE + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteVim(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id, + @QueryParam("resource-version") String resourceVersion) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java index 037b077..c066654 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java @@ -25,7 +25,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; @@ -34,111 +33,103 @@ import org.onap.aai.esr.exception.ExtsysException; @Path("/") public interface IExternalSystem { - @PUT - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerVNFM(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("vnfm_id") String vnfmId, - EsrVnfmDetail esrVnfmDetail) throws ExtsysException; + @PUT + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerVNFM(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException; + + @GET + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVNFMDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId) throws ExtsysException; - @GET - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVNFMDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("vnfm_id") String vnfmId) - throws ExtsysException; + @GET + @Path("/esr-vnfm-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVNFMList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @GET - @Path("/esr-vnfm-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVNFMList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @DELETE + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteVNFM(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId, @QueryParam("resource-version") String resourceVersion) + throws ExtsysException; - @DELETE - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteVNFM(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("vnfm_id") String vnfmId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @PUT + @Path("/esr-ems-list/esr-ems/{ems_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerEMS(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId, EsrEmsDetail esrEmsDetail) throws ExtsysException; - @PUT - @Path("/esr-ems-list/esr-ems/{ems_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerEMS(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("ems_id") String emsId, - EsrEmsDetail esrEmsDetail) throws ExtsysException; + @GET + @Path("/esr-ems-list/esr-ems/{ems_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryEMSDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId) throws ExtsysException; - @GET - @Path("/esr-ems-list/esr-ems/{ems_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryEMSDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("ems_id") String emsId) - throws ExtsysException; + @GET + @Path("/esr-ems-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryEMSList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @GET - @Path("/esr-ems-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryEMSList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @DELETE + @Path("/esr-ems-list/esr-ems/{ems_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteEMS(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId, @QueryParam("resource-version") String resourceVersion) + throws ExtsysException; - @DELETE - @Path("/esr-ems-list/esr-ems/{ems_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteEMS(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("ems_id") String emsId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; - - @PUT - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, - EsrThirdpartySdncDetail esrThirdpartySdncDetail) throws ExtsysException; + @PUT + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, EsrThirdpartySdncDetail esrThirdpartySdncDetail) + throws ExtsysException; - @GET - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryThirdpartySdncDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("thirdparty-sdnc-id") String thirdpartySdncId) - throws ExtsysException; + @GET + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryThirdpartySdncDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId) throws ExtsysException; - @GET - @Path("/esr-thirdparty-sdnc-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryThirdpartySdncList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @GET + @Path("/esr-thirdparty-sdnc-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryThirdpartySdncList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @DELETE - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @DELETE + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, + @QueryParam("resource-version") String resourceVersion) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java index 61964fc..d4c4bc4 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class ThirdpartySdncRegisterProvider implements MessageBodyWriter<EsrThirdpartySdncDetail>{ - - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrThirdpartySdncDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrThirdpartySdncDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrThirdpartySdncDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrThirdpartySdncDetail.class); - logger.info("the param to register VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class ThirdpartySdncRegisterProvider implements MessageBodyWriter<EsrThirdpartySdncDetail> { + + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrThirdpartySdncDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrThirdpartySdncDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrThirdpartySdncDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrThirdpartySdncDetail.class); + logger.info("the param to register VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java index 58a0c72..59b2253 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java @@ -19,39 +19,35 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VimRegisterProvider implements MessageBodyWriter<CloudRegionDetail>{ - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return CloudRegionDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(CloudRegionDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(CloudRegionDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, CloudRegionDetail.class); - logger.info("the param to register VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VimRegisterProvider implements MessageBodyWriter<CloudRegionDetail> { + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return CloudRegionDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(CloudRegionDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(CloudRegionDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, CloudRegionDetail.class); + logger.info("the param to register VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java index d72b073..26709d7 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VnfmRegisterProvider implements MessageBodyWriter<EsrVnfmDetail>{ - - private static final Logger logger = LoggerFactory.getLogger(VnfmRegisterProvider.class); - - @Override - public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrVnfmDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrVnfmDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrVnfmDetail t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrVnfmDetail.class); - logger.info("the param to register VNFM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VnfmRegisterProvider implements MessageBodyWriter<EsrVnfmDetail> { + + private static final Logger logger = LoggerFactory.getLogger(VnfmRegisterProvider.class); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrVnfmDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrVnfmDetail t, Class<?> type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrVnfmDetail t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrVnfmDetail.class); + logger.info("the param to register VNFM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java index 6c7bb31..8d5ead6 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java @@ -21,16 +21,15 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.exception.ExtsysException; @Path("/") public interface IVimManage { - @POST - @Path("/{cloud_owner}_{cloud_region_id}/registry") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void updateVIM(@PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, Tenant tenant) throws ExtsysException; + @POST + @Path("/{cloud_owner}_{cloud_region_id}/registry") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void updateVIM(@PathParam("cloud_owner") String cloud_owner, + @PathParam("cloud_region_id") String cloud_region_id, Tenant tenant) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java index 947480f..2937862 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java @@ -16,20 +16,19 @@ package org.onap.aai.esr.externalservice.cloud; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class Tenant implements Serializable { - public static final long serialVersionUID = 1L; + public static final long serialVersionUID = 1L; - @SerializedName("defaultTenant") - private String defaultTenant; + @SerializedName("defaultTenant") + private String defaultTenant; - public String getDefaultTenant() { - return defaultTenant; - } + public String getDefaultTenant() { + return defaultTenant; + } - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java index a976937..8d4aabd 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java @@ -18,20 +18,18 @@ package org.onap.aai.esr.externalservice.cloud; import org.glassfish.jersey.client.ClientConfig; import org.onap.aai.esr.common.MsbConfig; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class VimManagerProxy { - - public static void updateVim(String cloudOwner, String cloudRegionId, - Tenant tenant) throws ExtsysException { - ClientConfig config = new ClientConfig(new VimUpdateProvider()); - IVimManage updateVimServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getMultiCloudAddr(), config, IVimManage.class); - try { - updateVimServiceproxy.updateVIM(cloudOwner, cloudRegionId, tenant); - } catch (Exception e) { - throw new ExtsysException("Update cloud region to A&AI by Multi-Cloud failed.", e); + + public static void updateVim(String cloudOwner, String cloudRegionId, Tenant tenant) throws ExtsysException { + ClientConfig config = new ClientConfig(new VimUpdateProvider()); + IVimManage updateVimServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getMultiCloudAddr(), config, IVimManage.class); + try { + updateVimServiceproxy.updateVIM(cloudOwner, cloudRegionId, tenant); + } catch (Exception e) { + throw new ExtsysException("Update cloud region to A&AI by Multi-Cloud failed.", e); + } } - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java index 9526ac7..1a05993 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java @@ -19,39 +19,34 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.externalservice.aai.VimRegisterProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VimUpdateProvider implements MessageBodyWriter<Tenant>{ - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return Tenant.class.isAssignableFrom(type); - } - - @Override - public long getSize(Tenant t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(Tenant t, Class<?> type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, Tenant.class); - logger.info("the param to update VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VimUpdateProvider implements MessageBodyWriter<Tenant> { + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return Tenant.class.isAssignableFrom(type); + } + + @Override + public long getSize(Tenant t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(Tenant t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, Tenant.class); + logger.info("the param to update VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java index 5f0d6b9..7452937 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java @@ -18,39 +18,38 @@ package org.onap.aai.esr.externalservice.msb; import java.net.InetAddress; import java.util.HashSet; import java.util.Set; - import org.onap.msb.sdk.discovery.entity.MicroServiceInfo; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.onap.msb.sdk.discovery.entity.Node; public class MsbHelper { - private MSBServiceClient msbClient; + private MSBServiceClient msbClient; + + public MsbHelper(MSBServiceClient msbClient) { + super(); + this.msbClient = msbClient; + } - public MsbHelper(MSBServiceClient msbClient) { - super(); - this.msbClient = msbClient; - } + public void registerMsb() throws Exception { - public void registerMsb() throws Exception { + MicroServiceInfo msinfo = new MicroServiceInfo(); - MicroServiceInfo msinfo = new MicroServiceInfo(); + msinfo.setServiceName("aai-esr-server"); + msinfo.setVersion("v1"); + msinfo.setUrl("/api/aai-esr-server/v1"); + msinfo.setProtocol("REST"); + msinfo.setVisualRange("0|1"); - msinfo.setServiceName("aai-esr-server"); - msinfo.setVersion("v1"); - msinfo.setUrl("/api/aai-esr-server/v1"); - msinfo.setProtocol("REST"); - msinfo.setVisualRange("0|1"); - - Set<Node> nodes = new HashSet<>(); - Node node1 = new Node(); - node1.setIp(InetAddress.getLocalHost().getHostAddress()); - node1.setPort("9518"); - nodes.add(node1); - msinfo.setNodes(nodes); - msbClient.registerMicroServiceInfo(msinfo, false); - } + Set<Node> nodes = new HashSet<>(); + Node node1 = new Node(); + node1.setIp(InetAddress.getLocalHost().getHostAddress()); + node1.setPort("9518"); + nodes.add(node1); + msinfo.setNodes(nodes); + msbClient.registerMicroServiceInfo(msinfo, false); + } } 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 11fba23..3c18353 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 @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.EmsManagerWrapper; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import org.slf4j.LoggerFactory; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,107 +44,102 @@ import javax.ws.rs.core.Response; @Api(tags = {" ems Management "}) public class EmsManager { - private static final Logger LOGGER = LoggerFactory.getLogger(EmsManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EmsManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all ems. + */ + @GET + @ApiOperation(value = "get all ems ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryEmsList() { + LOGGER.info("start query all ems!"); + return EmsManagerWrapper.getInstance().queryEmsList(); + } + + /** + * query ems info by id. + */ + @Path("/{emsId}") + @GET + @ApiOperation(value = "get ems by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryemsById(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start query ems by id." + emsId); + return EmsManagerWrapper.getInstance().queryEmsById(emsId); + } + + /** + * delete ems by id. + */ + @Path("/{emsId}") + @DELETE + @ApiOperation(value = "delete a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delems(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start delete ems .id:" + emsId); + return EmsManagerWrapper.getInstance().delEms(emsId); + } + + /** + * update ems by id. + */ + @PUT + @Path("/{emsId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems, + @ApiParam(value = "ems id", required = true) @PathParam("emsId") String emsId) { + LOGGER.info("start update ems .id:" + emsId + " info:" + extsysUtil.objectToString(ems)); + return EmsManagerWrapper.getInstance().updateEms(ems, emsId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all ems. - */ - @GET - @ApiOperation(value = "get all ems ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryEmsList() { - LOGGER.info("start query all ems!"); - return EmsManagerWrapper.getInstance().queryEmsList(); - } - - /** - * query ems info by id. - */ - @Path("/{emsId}") - @GET - @ApiOperation(value = "get ems by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryemsById(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { - LOGGER.info("start query ems by id." + emsId); - return EmsManagerWrapper.getInstance().queryEmsById(emsId); - } - - /** - * delete ems by id. - */ - @Path("/{emsId}") - @DELETE - @ApiOperation(value = "delete a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delems(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { - LOGGER.info("start delete ems .id:" + emsId); - return EmsManagerWrapper.getInstance().delEms(emsId); - } - - /** - * update ems by id. - */ - @PUT - @Path("/{emsId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems, - @ApiParam(value = "ems id", required = true) @PathParam("emsId") String emsId) { - LOGGER.info("start update ems .id:" + emsId + " info:" + extsysUtil.objectToString(ems)); - return EmsManagerWrapper.getInstance().updateEms(ems, emsId); - } - - /** - * register ems. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems) { - LOGGER.info("start add ems" + " info:" + extsysUtil.objectToString(ems)); - return EmsManagerWrapper.getInstance().registerEms(ems); - } + /** + * register ems. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems) { + LOGGER.info("start add ems" + " info:" + extsysUtil.objectToString(ems)); + return EmsManagerWrapper.getInstance().registerEms(ems); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java index d92d40b..cee2dc6 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java @@ -20,11 +20,8 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.eclipse.jetty.http.HttpStatus; - import com.codahale.metrics.annotation.Timed; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; @@ -34,18 +31,17 @@ import io.swagger.annotations.ApiResponses; @Api(tags = {" service test "}) public class ServiceTest { - @GET - @ApiOperation(value = " service test ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryEmsList() { - return Response.ok("hello world !").build(); - } + @GET + @ApiOperation(value = " service test ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryEmsList() { + return Response.ok("hello world !").build(); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java index 93edffb..b633b8c 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.ThirdpartySdncWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,106 +44,106 @@ import javax.ws.rs.core.Response; @Api(tags = {"ThirdParty sdnc Management "}) public class ThirdpartySdncManager { - private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpartySdncManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpartySdncManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all thirdParty sdnc. + */ + @GET + @ApiOperation(value = "get all thirdParty sdnc ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncList() { + LOGGER.info("start query all thirdParty sdnc!"); + return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncList(); + } + + /** + * query thirdParty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @GET + @ApiOperation(value = "get thirdParty sdnc by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncById( + @ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start query thirdparty sdnc by id." + thirdPartySdncId); + return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncById(thirdPartySdncId); + } + + /** + * delete thirdparty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @DELETE + @ApiOperation(value = "delete a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delThirdpartySdnc( + @ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start delete thirdparty sdnc .id:" + thirdPartySdncId); + return ThirdpartySdncWrapper.getInstance().delThirdpartySdnc(thirdPartySdncId); + } + + /** + * update thirdParty sdnc by id. + */ + @PUT + @Path("/{thirdPartySdncId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a thirdParty Sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateThirdpartySdnc( + @ApiParam(value = "thirdpartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc, + @ApiParam(value = "sdnc id", required = true) @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start update sdnc .id:" + thirdPartySdncId + " info:" + extsysUtil.objectToString(thirdPartySdnc)); + return ThirdpartySdncWrapper.getInstance().updateThirdpartySdnc(thirdPartySdnc, thirdPartySdncId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - /** - *query all thirdParty sdnc. - */ - @GET - @ApiOperation(value = "get all thirdParty sdnc ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryThirdpartySdncList() { - LOGGER.info("start query all thirdParty sdnc!"); - return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncList(); - } - - /** - *query thirdParty sdnc by id. - */ - @Path("/{thirdPartySdncId}") - @GET - @ApiOperation(value = "get thirdParty sdnc by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryThirdpartySdncById(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start query thirdparty sdnc by id." + thirdPartySdncId); - return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncById(thirdPartySdncId); - } - - /** - *delete thirdparty sdnc by id. - */ - @Path("/{thirdPartySdncId}") - @DELETE - @ApiOperation(value = "delete a thirdparty sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delThirdpartySdnc(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start delete thirdparty sdnc .id:" + thirdPartySdncId); - return ThirdpartySdncWrapper.getInstance().delThirdpartySdnc(thirdPartySdncId); - } - - /** - *update thirdParty sdnc by id. - */ - @PUT - @Path("/{thirdPartySdncId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a thirdParty Sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateThirdpartySdnc(@ApiParam(value = "thirdpartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc, - @ApiParam(value = "sdnc id", required = true) @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start update sdnc .id:" + thirdPartySdncId + " info:" + extsysUtil.objectToString(thirdPartySdnc)); - return ThirdpartySdncWrapper.getInstance().updateThirdpartySdnc(thirdPartySdnc, thirdPartySdncId); - } - - /** - *thirdParty sdnc register. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "register a thirdparty sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerThirdpatySdnc(@ApiParam(value = "thirdPartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc) { - LOGGER.info("start register sdnc" + " info:" + extsysUtil.objectToString(thirdPartySdnc)); - return ThirdpartySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc); - } + /** + * thirdParty sdnc register. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "register a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerThirdpatySdnc( + @ApiParam(value = "thirdPartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc) { + LOGGER.info("start register sdnc" + " info:" + extsysUtil.objectToString(thirdPartySdnc)); + return ThirdpartySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc); + } } 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 aa7d34d..b408f62 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 @@ -21,14 +21,12 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VimRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.VimManagerWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -45,105 +43,103 @@ import javax.ws.rs.core.Response; @Api(tags = {" vim Management "}) public class VimManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VimManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VimManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all VIM. + */ + @GET + @ApiOperation(value = "get all vim ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimList() { + return VimManagerWrapper.getInstance().queryVimListDetails(); + } + + /** + * query vim by id. + */ + @Path("/{cloudOwner}/{cloudRegionId}") + @GET + @ApiOperation(value = "get vim by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimById(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId) { + LOGGER.info("start query vim by cloud owner and cloud region id." + cloudOwner + "," + cloudRegionId); + return VimManagerWrapper.getInstance().queryVimById(cloudOwner, cloudRegionId); + } + + /** + * delete vim by id. + */ + @Path("/{cloudOwner}/{cloudRegionId}") + @DELETE + @ApiOperation(value = "delete a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delvim(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId) { + LOGGER.info("start delete cloud-owner :" + cloudOwner + ", cloud-region-id: " + cloudRegionId); + return VimManagerWrapper.getInstance().delVim(cloudOwner, cloudRegionId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all VIM. - */ - @GET - @ApiOperation(value = "get all vim ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVimList() { - return VimManagerWrapper.getInstance().queryVimListDetails(); - } + /** + * update vim by id. + */ + @PUT + @Path("/{cloudOwner}/{cloudRegionId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "update a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updatevims(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId, VimRegisterInfo vim) { + LOGGER.info("start update vim info:" + extsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().updateVim(cloudOwner, cloudRegionId, vim); + } - /** - * query vim by id. - */ - @Path("/{cloudOwner}/{cloudRegionId}") - @GET - @ApiOperation(value = "get vim by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVimById(@PathParam("cloudOwner") String cloudOwner, @PathParam("cloudRegionId") String cloudRegionId) { - LOGGER.info("start query vim by cloud owner and cloud region id." + cloudOwner +"," + cloudRegionId); - return VimManagerWrapper.getInstance().queryVimById(cloudOwner, cloudRegionId); - } - - /** - * delete vim by id. - */ - @Path("/{cloudOwner}/{cloudRegionId}") - @DELETE - @ApiOperation(value = "delete a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delvim(@PathParam("cloudOwner") String cloudOwner,@PathParam("cloudRegionId") String cloudRegionId) { - LOGGER.info("start delete cloud-owner :" + cloudOwner +", cloud-region-id: " + cloudRegionId); - return VimManagerWrapper.getInstance().delVim(cloudOwner, cloudRegionId); - } - - /** - * update vim by id. - */ - @PUT - @Path("/{cloudOwner}/{cloudRegionId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "update a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updatevims(@PathParam("cloudOwner") String cloudOwner, @PathParam("cloudRegionId") String cloudRegionId, VimRegisterInfo vim) { - LOGGER.info("start update vim info:" + extsysUtil.objectToString(vim)); - return VimManagerWrapper.getInstance().updateVim(cloudOwner, cloudRegionId, vim); - } - - /** - * register vim . - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerVims(VimRegisterInfo vim) { - LOGGER.info("start add vim" + " info:" + extsysUtil.objectToString(vim)); - return VimManagerWrapper.getInstance().registerVim(vim); - } + /** + * register vim . + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVims(VimRegisterInfo vim) { + LOGGER.info("start add vim" + " info:" + extsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().registerVim(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 893b5b5..f86fd57 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 @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.VnfmManagerWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,106 +44,101 @@ import javax.ws.rs.core.Response; @Api(tags = {" vnfm Management "}) public class VnfmManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VnfmManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VnfmManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all vnfm. + */ + @GET + @ApiOperation(value = "get all vnfm ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmList() { + LOGGER.info("start query all vnfm!"); + return VnfmManagerWrapper.getInstance().queryVnfmList(); + } + + /** + * query vnfm by id. + */ + @Path("/{vnfmId}") + @GET + @ApiOperation(value = "get vnfm by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmById(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start query vnfm by id." + vnfmId); + return VnfmManagerWrapper.getInstance().queryVnfmById(vnfmId); + } + + /** + * delete vnfm by id. + */ + @Path("/{vnfmId}") + @DELETE + @ApiOperation(value = "delete a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delVnfm(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start delete vnfm .id:" + vnfmId); + return VnfmManagerWrapper.getInstance().delVnfm(vnfmId); + } + + /** + * update vnfm by id. + */ + @PUT + @Path("/{vnfmId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm, + @ApiParam(value = "vnfm id", required = true) @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start update vnfm .id:" + vnfmId + " info:" + extsysUtil.objectToString(vnfm)); + return VnfmManagerWrapper.getInstance().updateVnfm(vnfm, vnfmId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all vnfm. - */ - @GET - @ApiOperation(value = "get all vnfm ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVnfmList() { - LOGGER.info("start query all vnfm!"); - return VnfmManagerWrapper.getInstance().queryVnfmList(); - } - - /** - * query vnfm by id. - */ - @Path("/{vnfmId}") - @GET - @ApiOperation(value = "get vnfm by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVnfmById(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start query vnfm by id." + vnfmId); - return VnfmManagerWrapper.getInstance().queryVnfmById(vnfmId); - } - - /** - * delete vnfm by id. - */ - @Path("/{vnfmId}") - @DELETE - @ApiOperation(value = "delete a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delVnfm(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start delete vnfm .id:" + vnfmId); - return VnfmManagerWrapper.getInstance().delVnfm(vnfmId); - } - - /** - * update vnfm by id. - */ - @PUT - @Path("/{vnfmId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm, - @ApiParam(value = "vnfm id", required = true) @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start update vnfm .id:" + vnfmId + " info:" + extsysUtil.objectToString(vnfm)); - return VnfmManagerWrapper.getInstance().updateVnfm(vnfm, vnfmId); - } - - /** - * add vnfm . - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm) { - return VnfmManagerWrapper.getInstance().registerVnfm(vnfm); - } + /** + * add vnfm . + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm) { + return VnfmManagerWrapper.getInstance().registerVnfm(vnfm); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java index 404b118..4b6aca4 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java @@ -17,7 +17,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrEmsDetail; @@ -26,111 +25,112 @@ import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.entity.rest.FtpAddr; public class EmsManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) { - EsrEmsDetail esrEms = new EsrEmsDetail(); - esrEms.setEmsId(extsysUtil.generateId()); - List<EsrSystemInfo> authInfos = getAuthInfosFromRegisterData(emsRegisterInfo); - esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos)); - return esrEms; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) { + EsrEmsDetail esrEms = new EsrEmsDetail(); + esrEms.setEmsId(extsysUtil.generateId()); + List<EsrSystemInfo> authInfos = getAuthInfosFromRegisterData(emsRegisterInfo); + esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos)); + return esrEms; + } + + private List<EsrSystemInfo> getAuthInfosFromRegisterData(EmsRegisterInfo emsRegisterInfo) { + List<EsrSystemInfo> authInfos = new ArrayList<>(); + EsrSystemInfo resouceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_RESOUCE.toString()); + EsrSystemInfo performanceAuthInfo = + getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_PERFORMANCE.toString()); + EsrSystemInfo alarmAuthInfo = getAuthInfoFromAlarmAddr(emsRegisterInfo); + authInfos.add(resouceAuthInfo); + authInfos.add(performanceAuthInfo); + authInfos.add(alarmAuthInfo); + return authInfos; + } + + private EsrSystemInfo getAuthInfoFromFtpAddr(EmsRegisterInfo emsRegisterInfo, String systemType) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + FtpAddr ftpAddr = new FtpAddr(); + if (systemType.equals(SystemType.EMS_RESOUCE.toString())) { + ftpAddr = emsRegisterInfo.getResourceAddr(); + } else if (systemType.equals(SystemType.EMS_PERFORMANCE.toString())) { + ftpAddr = emsRegisterInfo.getPerformanceAddr(); + } + authInfo.setType(ftpAddr.getFtptype()); + authInfo.setIpAddress(ftpAddr.getIp()); + authInfo.setPort(ftpAddr.getPort()); + authInfo.setUserName(ftpAddr.getUser()); + authInfo.setPassword(ftpAddr.getPassword()); + authInfo.setRemotePath(ftpAddr.getRemotepath()); + authInfo.setPassive(ftpAddr.getPassive()); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setSystemType(systemType); + authInfo.setSystemName(emsRegisterInfo.getName()); + authInfo.setVendor(emsRegisterInfo.getVendor()); + authInfo.setVersion(emsRegisterInfo.getVersion()); + return authInfo; + } - private List<EsrSystemInfo> getAuthInfosFromRegisterData(EmsRegisterInfo emsRegisterInfo) { - List<EsrSystemInfo> authInfos = new ArrayList<>(); - EsrSystemInfo resouceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_RESOUCE.toString()); - EsrSystemInfo performanceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_PERFORMANCE.toString()); - EsrSystemInfo alarmAuthInfo = getAuthInfoFromAlarmAddr(emsRegisterInfo); - authInfos.add(resouceAuthInfo); - authInfos.add(performanceAuthInfo); - authInfos.add(alarmAuthInfo); - return authInfos; - } - - private EsrSystemInfo getAuthInfoFromFtpAddr(EmsRegisterInfo emsRegisterInfo, String systemType) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - FtpAddr ftpAddr = new FtpAddr(); - if(systemType.equals(SystemType.EMS_RESOUCE.toString())) { - ftpAddr = emsRegisterInfo.getResourceAddr(); - } else if(systemType.equals(SystemType.EMS_PERFORMANCE.toString())) { - ftpAddr = emsRegisterInfo.getPerformanceAddr(); + private EsrSystemInfo getAuthInfoFromAlarmAddr(EmsRegisterInfo emsRegisterInfo) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + AlarmAddr alarmAddr = emsRegisterInfo.getAlarmAddr(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setIpAddress(alarmAddr.getIp()); + authInfo.setPort(alarmAddr.getPort()); + authInfo.setUserName(alarmAddr.getUser()); + authInfo.setPassword(alarmAddr.getPassword()); + authInfo.setSystemType(SystemType.EMS_ALARM.toString()); + authInfo.setSystemName(emsRegisterInfo.getName()); + authInfo.setVendor(emsRegisterInfo.getVendor()); + authInfo.setVersion(emsRegisterInfo.getVersion()); + return authInfo; } - authInfo.setType(ftpAddr.getFtptype()); - authInfo.setIpAddress(ftpAddr.getIp()); - authInfo.setPort(ftpAddr.getPort()); - authInfo.setUserName(ftpAddr.getUser()); - authInfo.setPassword(ftpAddr.getPassword()); - authInfo.setRemotePath(ftpAddr.getRemotepath()); - authInfo.setPassive(ftpAddr.getPassive()); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setSystemType(systemType); - authInfo.setSystemName(emsRegisterInfo.getName()); - authInfo.setVendor(emsRegisterInfo.getVendor()); - authInfo.setVersion(emsRegisterInfo.getVersion()); - return authInfo; - } - - private EsrSystemInfo getAuthInfoFromAlarmAddr(EmsRegisterInfo emsRegisterInfo) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - AlarmAddr alarmAddr = emsRegisterInfo.getAlarmAddr(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setIpAddress(alarmAddr.getIp()); - authInfo.setPort(alarmAddr.getPort()); - authInfo.setUserName(alarmAddr.getUser()); - authInfo.setPassword(alarmAddr.getPassword()); - authInfo.setSystemType(SystemType.EMS_ALARM.toString()); - authInfo.setSystemName(emsRegisterInfo.getName()); - authInfo.setVendor(emsRegisterInfo.getVendor()); - authInfo.setVersion(emsRegisterInfo.getVersion()); - return authInfo; - } - - public EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEmsDetail esrEms) { - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - List<EsrSystemInfo> esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo(); - emsRegisterInfo.setEmsId(esrEms.getEmsId()); - - for(int i=0; i<esrSystemInfo.size(); i++) { - authInfo = esrSystemInfo.get(i); - if(authInfo.getSystemType().equals(SystemType.EMS_RESOUCE.toString())){ - FtpAddr resourceAddr = new FtpAddr(); - resourceAddr = getFtpAddrFromAuthInfo(authInfo); - emsRegisterInfo.setResourceAddr(resourceAddr); - } else if(authInfo.getSystemType().equals(SystemType.EMS_PERFORMANCE.toString())) { - FtpAddr performanceAddr = new FtpAddr(); - performanceAddr = getFtpAddrFromAuthInfo(authInfo); - emsRegisterInfo.setPerformanceAddr(performanceAddr); - } else if(authInfo.getSystemType().equals(SystemType.EMS_ALARM.toString())) { + + public EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEmsDetail esrEms) { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + List<EsrSystemInfo> esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo(); + emsRegisterInfo.setEmsId(esrEms.getEmsId()); + + for (int i = 0; i < esrSystemInfo.size(); i++) { + authInfo = esrSystemInfo.get(i); + if (authInfo.getSystemType().equals(SystemType.EMS_RESOUCE.toString())) { + FtpAddr resourceAddr = new FtpAddr(); + resourceAddr = getFtpAddrFromAuthInfo(authInfo); + emsRegisterInfo.setResourceAddr(resourceAddr); + } else if (authInfo.getSystemType().equals(SystemType.EMS_PERFORMANCE.toString())) { + FtpAddr performanceAddr = new FtpAddr(); + performanceAddr = getFtpAddrFromAuthInfo(authInfo); + emsRegisterInfo.setPerformanceAddr(performanceAddr); + } else if (authInfo.getSystemType().equals(SystemType.EMS_ALARM.toString())) { + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr = getAlarmAddrFromAuthInfo(authInfo); + emsRegisterInfo.setAlarmAddr(alarmAddr); + } + } + emsRegisterInfo.setName(authInfo.getSystemName()); + emsRegisterInfo.setVendor(authInfo.getVendor()); + emsRegisterInfo.setVersion(authInfo.getVersion()); + return emsRegisterInfo; + } + + private FtpAddr getFtpAddrFromAuthInfo(EsrSystemInfo authInfo) { + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setFtptype(authInfo.getType()); + ftpAddr.setIp(authInfo.getIpAddress()); + ftpAddr.setPassive(authInfo.getPassive()); + ftpAddr.setPassword(authInfo.getPassword()); + ftpAddr.setPort(authInfo.getPort()); + ftpAddr.setRemotepath(authInfo.getRemotePath()); + ftpAddr.setUser(authInfo.getUserName()); + return ftpAddr; + } + + private AlarmAddr getAlarmAddrFromAuthInfo(EsrSystemInfo authInfo) { AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr = getAlarmAddrFromAuthInfo(authInfo); - emsRegisterInfo.setAlarmAddr(alarmAddr); - } + alarmAddr.setIp(authInfo.getIpAddress()); + alarmAddr.setPassword(authInfo.getPassword()); + alarmAddr.setPort(authInfo.getPort()); + alarmAddr.setUser(authInfo.getUserName()); + return alarmAddr; } - emsRegisterInfo.setName(authInfo.getSystemName()); - emsRegisterInfo.setVendor(authInfo.getVendor()); - emsRegisterInfo.setVersion(authInfo.getVersion()); - return emsRegisterInfo; - } - - private FtpAddr getFtpAddrFromAuthInfo(EsrSystemInfo authInfo) { - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setFtptype(authInfo.getType()); - ftpAddr.setIp(authInfo.getIpAddress()); - ftpAddr.setPassive(authInfo.getPassive()); - ftpAddr.setPassword(authInfo.getPassword()); - ftpAddr.setPort(authInfo.getPort()); - ftpAddr.setRemotepath(authInfo.getRemotePath()); - ftpAddr.setUser(authInfo.getUserName()); - return ftpAddr; - } - - private AlarmAddr getAlarmAddrFromAuthInfo(EsrSystemInfo authInfo) { - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setIp(authInfo.getIpAddress()); - alarmAddr.setPassword(authInfo.getPassword()); - alarmAddr.setPort(authInfo.getPort()); - alarmAddr.setUser(authInfo.getUserName()); - return alarmAddr; - } } 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 c3814e3..3bd0177 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 @@ -16,7 +16,6 @@ package org.onap.aai.esr.util; import com.google.gson.Gson; - import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -25,33 +24,33 @@ import org.onap.aai.esr.entity.aai.EsrSystemInfoList; public class ExtsysUtil { - public String generateId() { - return UUID.randomUUID().toString(); - } + public String generateId() { + return UUID.randomUUID().toString(); + } - /** - * change object to str. - */ - public String objectToString(Object obj) { - Gson gson = new Gson(); - if (obj != null) { - return gson.toJson(obj); - } else { - return null; + /** + * change object to str. + */ + public String objectToString(Object obj) { + Gson gson = new Gson(); + if (obj != null) { + return gson.toJson(obj); + } else { + return null; + } } - } - public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List<EsrSystemInfo> esrSystemInfo = new ArrayList<>(); - esrSystemInfo.add(esrSystemInfoObj); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - return esrSystemInfoList; - } - - public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(List<EsrSystemInfo> esrSystemInfo) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);; - return esrSystemInfoList; - } + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List<EsrSystemInfo> esrSystemInfo = new ArrayList<>(); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + return esrSystemInfoList; + } + + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(List<EsrSystemInfo> esrSystemInfo) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);; + return esrSystemInfoList; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java index 2a01ddc..19448af 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java @@ -17,7 +17,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrSystemInfoList; @@ -25,51 +24,51 @@ import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; public class ThirdpartySdncManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrThirdpartySdncDetail sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) { - EsrThirdpartySdncDetail esrThirdpartySdnc = new EsrThirdpartySdncDetail(); - sdncRegisterInfo.setThirdpartySdncId(extsysUtil.generateId()); - esrThirdpartySdnc.setThirdpartySdncId(sdncRegisterInfo.getThirdpartySdncId()); - esrThirdpartySdnc.setLocation(sdncRegisterInfo.getLocation()); - esrThirdpartySdnc.setProductName(sdncRegisterInfo.getProductName()); - esrThirdpartySdnc.setEsrSystemInfoList(getEsrSystemInfoList(sdncRegisterInfo)); - return esrThirdpartySdnc; - } - - private EsrSystemInfoList getEsrSystemInfoList(ThirdpartySdncRegisterInfo sdncRegisterInfo) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List<EsrSystemInfo> esrSystemInfo = new ArrayList<>(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setVersion(sdncRegisterInfo.getVersion()); - authInfo.setSystemName(sdncRegisterInfo.getName()); - authInfo.setServiceUrl(sdncRegisterInfo.getUrl()); - authInfo.setVendor(sdncRegisterInfo.getVendor()); - authInfo.setType(sdncRegisterInfo.getType()); - authInfo.setUserName(sdncRegisterInfo.getUserName()); - authInfo.setPassword(sdncRegisterInfo.getPassword()); - authInfo.setProtocol(sdncRegisterInfo.getProtocol()); - authInfo.setSystemType(SystemType.thirdparty_SDNC.toString()); - esrSystemInfo.add(authInfo); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - return esrSystemInfoList; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public EsrThirdpartySdncDetail sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) { + EsrThirdpartySdncDetail esrThirdpartySdnc = new EsrThirdpartySdncDetail(); + sdncRegisterInfo.setThirdpartySdncId(extsysUtil.generateId()); + esrThirdpartySdnc.setThirdpartySdncId(sdncRegisterInfo.getThirdpartySdncId()); + esrThirdpartySdnc.setLocation(sdncRegisterInfo.getLocation()); + esrThirdpartySdnc.setProductName(sdncRegisterInfo.getProductName()); + esrThirdpartySdnc.setEsrSystemInfoList(getEsrSystemInfoList(sdncRegisterInfo)); + return esrThirdpartySdnc; + } + + private EsrSystemInfoList getEsrSystemInfoList(ThirdpartySdncRegisterInfo sdncRegisterInfo) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List<EsrSystemInfo> esrSystemInfo = new ArrayList<>(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setVersion(sdncRegisterInfo.getVersion()); + authInfo.setSystemName(sdncRegisterInfo.getName()); + authInfo.setServiceUrl(sdncRegisterInfo.getUrl()); + authInfo.setVendor(sdncRegisterInfo.getVendor()); + authInfo.setType(sdncRegisterInfo.getType()); + authInfo.setUserName(sdncRegisterInfo.getUserName()); + authInfo.setPassword(sdncRegisterInfo.getPassword()); + authInfo.setProtocol(sdncRegisterInfo.getProtocol()); + authInfo.setSystemType(SystemType.thirdparty_SDNC.toString()); + esrSystemInfo.add(authInfo); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + return esrSystemInfoList; + } - public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdncDetail esrSdnc) { - ThirdpartySdncRegisterInfo registerSdncInfo = new ThirdpartySdncRegisterInfo(); - EsrSystemInfo esrSystemInfo = esrSdnc.getEsrSystemInfoList().getEsrSystemInfo().get(0); - registerSdncInfo.setThirdpartySdncId(esrSdnc.getThirdpartySdncId()); - registerSdncInfo.setLocation(esrSdnc.getLocation()); - registerSdncInfo.setProductName(esrSdnc.getProductName()); - registerSdncInfo.setName(esrSystemInfo.getSystemName()); - registerSdncInfo.setPassword(esrSystemInfo.getPassword()); - registerSdncInfo.setProtocol(esrSystemInfo.getProtocol()); - registerSdncInfo.setType(esrSystemInfo.getType()); - registerSdncInfo.setUrl(esrSystemInfo.getServiceUrl()); - registerSdncInfo.setUserName(esrSystemInfo.getUserName()); - registerSdncInfo.setVendor(esrSystemInfo.getVendor()); - registerSdncInfo.setVersion(esrSystemInfo.getVersion()); - return registerSdncInfo; - } + public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdncDetail esrSdnc) { + ThirdpartySdncRegisterInfo registerSdncInfo = new ThirdpartySdncRegisterInfo(); + EsrSystemInfo esrSystemInfo = esrSdnc.getEsrSystemInfoList().getEsrSystemInfo().get(0); + registerSdncInfo.setThirdpartySdncId(esrSdnc.getThirdpartySdncId()); + registerSdncInfo.setLocation(esrSdnc.getLocation()); + registerSdncInfo.setProductName(esrSdnc.getProductName()); + registerSdncInfo.setName(esrSystemInfo.getSystemName()); + registerSdncInfo.setPassword(esrSystemInfo.getPassword()); + registerSdncInfo.setProtocol(esrSystemInfo.getProtocol()); + registerSdncInfo.setType(esrSystemInfo.getType()); + registerSdncInfo.setUrl(esrSystemInfo.getServiceUrl()); + registerSdncInfo.setUserName(esrSystemInfo.getUserName()); + registerSdncInfo.setVendor(esrSystemInfo.getVendor()); + registerSdncInfo.setVersion(esrSystemInfo.getVersion()); + return registerSdncInfo; + } } 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 0a69f40..b37e319 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 @@ -18,7 +18,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.CloudRegionDetail; @@ -27,72 +26,73 @@ import org.onap.aai.esr.entity.rest.VimAuthInfo; import org.onap.aai.esr.entity.rest.VimRegisterInfo; public class VimManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) { - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - - 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()); - - EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); - esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus()); - EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); - cloudRegion.setEsrSystemInfoList(esrSystemInfoList); - return cloudRegion; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) { + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + + 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()); + + EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); + esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus()); + EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); + cloudRegion.setEsrSystemInfoList(esrSystemInfoList); + return cloudRegion; + } + + private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List<VimAuthInfo> vimAuthInfos) { + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + VimAuthInfo vimAuthInfo = vimAuthInfos.get(0); + esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain()); + esrSystemInfoObj.setUserName(vimAuthInfo.getUserName()); + esrSystemInfoObj.setPassword(vimAuthInfo.getPassword()); + esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl()); + esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert()); + esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure()); + esrSystemInfoObj.setDefaultTenant(vimAuthInfo.getDefaultTenant()); + esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId()); + esrSystemInfoObj.setSystemType(SystemType.VIM.toString()); + // esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString()); + return esrSystemInfoObj; + } + + private VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo 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()); + vimAuthInfo.setDefaultTenant(authInfo.getDefaultTenant()); + return vimAuthInfo; + } - private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List<VimAuthInfo> vimAuthInfos) { - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - VimAuthInfo vimAuthInfo = vimAuthInfos.get(0); - esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain()); - esrSystemInfoObj.setUserName(vimAuthInfo.getUserName()); - esrSystemInfoObj.setPassword(vimAuthInfo.getPassword()); - esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl()); - esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert()); - esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure()); - esrSystemInfoObj.setDefaultTenant(vimAuthInfo.getDefaultTenant()); - esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId()); - esrSystemInfoObj.setSystemType(SystemType.VIM.toString()); -// esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString()); - return esrSystemInfoObj; - } - - private VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo 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()); - vimAuthInfo.setDefaultTenant(authInfo.getDefaultTenant()); - return vimAuthInfo; - } - - public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) { - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - List<VimAuthInfo> vimAuthInfos = new ArrayList<>(); - if(cloudRegion.getEsrSystemInfoList()!=null){ - VimAuthInfo vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); - vimAuthInfos.add(vimAuthInfo); - vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); + public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) { + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + List<VimAuthInfo> vimAuthInfos = new ArrayList<>(); + if (cloudRegion.getEsrSystemInfoList() != null) { + VimAuthInfo vimAuthInfo = + authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); + vimAuthInfos.add(vimAuthInfo); + vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); + } + vimRegisterInfo.setVimAuthInfos(vimAuthInfos); + 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.setCloudRegionVersion(cloudRegion.getCloudRegionVersion()); + vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType()); + return vimRegisterInfo; } - vimRegisterInfo.setVimAuthInfos(vimAuthInfos); - 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.setCloudRegionVersion(cloudRegion.getCloudRegionVersion()); - vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType()); - return vimRegisterInfo; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java index f1f33a7..14da20e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java @@ -22,54 +22,54 @@ import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; public class VnfmManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrVnfmDetail vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) { - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl()); - esrVnfm.setVimId(vnfmRegisterInfo.getVimId()); - esrVnfm.setVnfmId(extsysUtil.generateId()); - authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo); - esrSystemInfo = extsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo); - esrVnfm.setEsrSystemInfoList(esrSystemInfo); - return esrVnfm; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); - /** - * @param vnfmRegisterInfo vnfm register informantion from portal - * @return - */ - private EsrSystemInfo getAuthInfoFromVnfmRegisterInfo(VnfmRegisterInfo vnfmRegisterInfo) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setSystemName(vnfmRegisterInfo.getName()); - authInfo.setType(vnfmRegisterInfo.getType()); - authInfo.setVendor(vnfmRegisterInfo.getVendor()); - authInfo.setVersion(vnfmRegisterInfo.getVersion()); - authInfo.setServiceUrl(vnfmRegisterInfo.getUrl()); - authInfo.setUserName(vnfmRegisterInfo.getUserName()); - authInfo.setPassword(vnfmRegisterInfo.getPassword()); - authInfo.setSystemType(SystemType.VNFM.toString()); - return authInfo; - } - - public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfmDetail esrVnfm) { - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId()); - vnfmRegisterInfo.setCertificateUrl(esrVnfm.getCertificateUrl()); - vnfmRegisterInfo.setVimId(esrVnfm.getVimId()); - authInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo().get(0); - vnfmRegisterInfo.setName(authInfo.getSystemName()); - vnfmRegisterInfo.setPassword(authInfo.getPassword()); - vnfmRegisterInfo.setType(authInfo.getType()); - vnfmRegisterInfo.setUrl(authInfo.getServiceUrl()); - vnfmRegisterInfo.setUserName(authInfo.getUserName()); - vnfmRegisterInfo.setVendor(authInfo.getVendor()); - vnfmRegisterInfo.setVersion(authInfo.getVersion()); - return vnfmRegisterInfo; - } + public EsrVnfmDetail vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) { + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl()); + esrVnfm.setVimId(vnfmRegisterInfo.getVimId()); + esrVnfm.setVnfmId(extsysUtil.generateId()); + authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo); + esrSystemInfo = extsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo); + esrVnfm.setEsrSystemInfoList(esrSystemInfo); + return esrVnfm; + } + + /** + * @param vnfmRegisterInfo vnfm register informantion from portal + * @return + */ + private EsrSystemInfo getAuthInfoFromVnfmRegisterInfo(VnfmRegisterInfo vnfmRegisterInfo) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setSystemName(vnfmRegisterInfo.getName()); + authInfo.setType(vnfmRegisterInfo.getType()); + authInfo.setVendor(vnfmRegisterInfo.getVendor()); + authInfo.setVersion(vnfmRegisterInfo.getVersion()); + authInfo.setServiceUrl(vnfmRegisterInfo.getUrl()); + authInfo.setUserName(vnfmRegisterInfo.getUserName()); + authInfo.setPassword(vnfmRegisterInfo.getPassword()); + authInfo.setSystemType(SystemType.VNFM.toString()); + return authInfo; + } + + public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfmDetail esrVnfm) { + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId()); + vnfmRegisterInfo.setCertificateUrl(esrVnfm.getCertificateUrl()); + vnfmRegisterInfo.setVimId(esrVnfm.getVimId()); + authInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo().get(0); + vnfmRegisterInfo.setName(authInfo.getSystemName()); + vnfmRegisterInfo.setPassword(authInfo.getPassword()); + vnfmRegisterInfo.setType(authInfo.getType()); + vnfmRegisterInfo.setUrl(authInfo.getServiceUrl()); + vnfmRegisterInfo.setUserName(authInfo.getUserName()); + vnfmRegisterInfo.setVendor(authInfo.getVendor()); + vnfmRegisterInfo.setVersion(authInfo.getVersion()); + return vnfmRegisterInfo; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java index 8acc825..571afbc 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.exception.ExceptionUtil; import org.onap.aai.esr.exception.ExtsysException; @@ -31,161 +29,159 @@ import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.rest.CommonRegisterResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class EmsManagerWrapper { - private static EmsManagerWrapper emsManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(EmsManagerWrapper.class); - private static EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); + private static EmsManagerWrapper emsManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(EmsManagerWrapper.class); + private static EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); - /** - * get VnfmManagerWrapper instance. - * @return ems manager wrapper instance - */ - public static EmsManagerWrapper getInstance() { - if (emsManagerWrapper == null) { - emsManagerWrapper = new EmsManagerWrapper(); + /** + * get VnfmManagerWrapper instance. + * + * @return ems manager wrapper instance + */ + public static EmsManagerWrapper getInstance() { + if (emsManagerWrapper == null) { + emsManagerWrapper = new EmsManagerWrapper(); + } + return emsManagerWrapper; } - return emsManagerWrapper; - } - - public Response registerEms(EmsRegisterInfo emsRegisterInfo) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); - String emsId = esrEmsDetail.getEmsId(); - try { - ExternalSystemProxy.registerEms(emsId, esrEmsDetail); - result.setId(emsId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register EMS failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response registerEms(EmsRegisterInfo emsRegisterInfo) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + String emsId = esrEmsDetail.getEmsId(); + try { + ExternalSystemProxy.registerEms(emsId, esrEmsDetail); + result.setId(emsId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register EMS failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response updateEms(EmsRegisterInfo emsRegisterInfo, String emsId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); - try { - ExternalSystemProxy.registerEms(emsId, esrEmsDetail); - result.setId(emsId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateEms(EmsRegisterInfo emsRegisterInfo, String emsId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); + try { + ExternalSystemProxy.registerEms(emsId, esrEmsDetail); + result.setId(emsId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryEmsList() { - List<EmsRegisterInfo> emsList = new ArrayList<>(); - EsrEmsList esrEms = new EsrEmsList(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsList(); - esrEms = new Gson().fromJson(esrEmsStr, EsrEmsList.class); - LOG.info("Response from AAI by query EMS list: " + esrEms); - emsList = getEmsDetailList(esrEms); - return Response.ok(emsList).build(); - } catch (ExtsysException e) { - LOG.error("Query EMS list failed !", e); - return Response.ok(emsList).build(); + + public Response queryEmsList() { + List<EmsRegisterInfo> emsList = new ArrayList<>(); + EsrEmsList esrEms = new EsrEmsList(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsList(); + esrEms = new Gson().fromJson(esrEmsStr, EsrEmsList.class); + LOG.info("Response from AAI by query EMS list: " + esrEms); + emsList = getEmsDetailList(esrEms); + return Response.ok(emsList).build(); + } catch (ExtsysException e) { + LOG.error("Query EMS list failed !", e); + return Response.ok(emsList).build(); + } } - } - - public Response queryEmsById(String emsId) { - EmsRegisterInfo ems; - ems = queryEmsDetail(emsId); - if (ems != null) { - return Response.ok(ems).build(); - } else { - return Response.ok(ems).build(); + + public Response queryEmsById(String emsId) { + EmsRegisterInfo ems; + ems = queryEmsDetail(emsId); + if (ems != null) { + return Response.ok(ems).build(); + } else { + return Response.ok(ems).build(); + } } - } - - public Response delEms(String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = queryEsrEmsDetail(emsId); - String resourceVersion = esrEmsDetail.getResourceVersion(); - try { - ExternalSystemProxy.deleteEms(emsId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error( - "Delete EMS from A&AI failed! EMS ID: " + emsId + "resouce-version:" + resourceVersion, - e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delEms(String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = queryEsrEmsDetail(emsId); + String resourceVersion = esrEmsDetail.getResourceVersion(); + try { + ExternalSystemProxy.deleteEms(emsId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete EMS from A&AI failed! EMS ID: " + emsId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - private EmsRegisterInfo queryEmsDetail(String emsId) { - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); - LOG.info("Response from AAI by query EMS: " + esrEmsStr); - esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); - emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEmsDetail); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + private EmsRegisterInfo queryEmsDetail(String emsId) { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); + LOG.info("Response from AAI by query EMS: " + esrEmsStr); + esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEmsDetail); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + } + return emsRegisterInfo; } - return emsRegisterInfo; - } - - private List<EmsRegisterInfo> getEmsDetailList(EsrEmsList esrEms) { - List<EmsRegisterInfo> emsInfoList = new ArrayList<>(); - EmsRegisterInfo emsInfo = new EmsRegisterInfo(); - for (int i = 0; i < esrEms.getEsrEms().size(); i++) { - String emsId = esrEms.getEsrEms().get(i).getEmsId(); - emsInfo = queryEmsDetail(emsId); - if (emsInfo != null) { - emsInfoList.add(emsInfo); - } + + private List<EmsRegisterInfo> getEmsDetailList(EsrEmsList esrEms) { + List<EmsRegisterInfo> emsInfoList = new ArrayList<>(); + EmsRegisterInfo emsInfo = new EmsRegisterInfo(); + for (int i = 0; i < esrEms.getEsrEms().size(); i++) { + String emsId = esrEms.getEsrEms().get(i).getEmsId(); + emsInfo = queryEmsDetail(emsId); + if (emsInfo != null) { + emsInfoList.add(emsInfo); + } + } + return emsInfoList; } - return emsInfoList; - } - - private EsrEmsDetail queryEsrEmsDetail (String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); - LOG.info("Response from AAI by query EMS: " + esrEmsStr); - esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + + private EsrEmsDetail queryEsrEmsDetail(String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); + LOG.info("Response from AAI by query EMS: " + esrEmsStr); + esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + } + return esrEmsDetail; } - return esrEmsDetail; - } - - private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - List<EsrSystemInfo> newEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo(); - EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail(); - List<EsrSystemInfo> oriEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo(); - - oriEsrEmsDetail = queryEsrEmsDetail(emsId); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); - String emsResourceVersion = oriEsrEmsDetail.getResourceVersion(); - esrEmsDetail.setResourceVersion(emsResourceVersion); - esrEmsDetail.setEmsId(emsId); - newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); - oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); - for (int i = 0; i < oriEsrSysInfoList.size(); i++) { - originalEsrSystemInfo = oriEsrSysInfoList.get(i); - for (int j = 0; j < newEsrSysInfoList.size(); j++) { - newEsrSystemInfo = newEsrSysInfoList.get(j); - if (originalEsrSystemInfo.getSystemType().equals(newEsrSystemInfo.getSystemType())) { - esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - break; + + private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + List<EsrSystemInfo> newEsrSysInfoList = new ArrayList<>(); + EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo(); + EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail(); + List<EsrSystemInfo> oriEsrSysInfoList = new ArrayList<>(); + EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo(); + + oriEsrEmsDetail = queryEsrEmsDetail(emsId); + esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + String emsResourceVersion = oriEsrEmsDetail.getResourceVersion(); + esrEmsDetail.setResourceVersion(emsResourceVersion); + esrEmsDetail.setEmsId(emsId); + newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + for (int i = 0; i < oriEsrSysInfoList.size(); i++) { + originalEsrSystemInfo = oriEsrSysInfoList.get(i); + for (int j = 0; j < newEsrSysInfoList.size(); j++) { + newEsrSystemInfo = newEsrSysInfoList.get(j); + if (originalEsrSystemInfo.getSystemType().equals(newEsrSystemInfo.getSystemType())) { + esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + break; + } + } } - } + return esrEmsDetail; } - return esrEmsDetail; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java index a36d0ba..0979ec0 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncList; @@ -31,133 +29,133 @@ import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; import org.onap.aai.esr.util.ThirdpartySdncManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class ThirdpartySdncWrapper { - private static ThirdpartySdncWrapper thirdpatySdncWrapper; - private static final Logger LOG = LoggerFactory.getLogger(ThirdpartySdncWrapper.class); - private static ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); + private static ThirdpartySdncWrapper thirdpatySdncWrapper; + private static final Logger LOG = LoggerFactory.getLogger(ThirdpartySdncWrapper.class); + private static ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); - /** - * get ThirdpatySdncWrapper instance. - * @return ThirdpatySdnc manager wrapper instance - */ - public static ThirdpartySdncWrapper getInstance() { - if (thirdpatySdncWrapper == null) { - thirdpatySdncWrapper = new ThirdpartySdncWrapper(); + /** + * get ThirdpatySdncWrapper instance. + * + * @return ThirdpatySdnc manager wrapper instance + */ + public static ThirdpartySdncWrapper getInstance() { + if (thirdpatySdncWrapper == null) { + thirdpatySdncWrapper = new ThirdpartySdncWrapper(); + } + return thirdpatySdncWrapper; } - return thirdpatySdncWrapper; - } - - public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); - String sdncId = esrSdncDetail.getThirdpartySdncId(); - try { - ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); - result.setId(sdncId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register thirdParty SDNC failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); + String sdncId = esrSdncDetail.getThirdpartySdncId(); + try { + ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); + result.setId(sdncId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register thirdParty SDNC failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + } - - } - public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc, String sdncId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrThirdpartySdncDetail originalEsrSdncDetail = queryEsrThirdpartySdncDetail(sdncId); - EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); - String resourceVersion = originalEsrSdncDetail.getResourceVersion(); - esrSdncDetail.setResourceVersion(resourceVersion); - esrSdncDetail.setThirdpartySdncId(sdncId); - EsrSystemInfo originalEsrSystemInfo = originalEsrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - try { - ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); - result.setId(sdncId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc, String sdncId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrThirdpartySdncDetail originalEsrSdncDetail = queryEsrThirdpartySdncDetail(sdncId); + EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); + String resourceVersion = originalEsrSdncDetail.getResourceVersion(); + esrSdncDetail.setResourceVersion(resourceVersion); + esrSdncDetail.setThirdpartySdncId(sdncId); + EsrSystemInfo originalEsrSystemInfo = originalEsrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + try { + ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); + result.setId(sdncId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryThirdpartySdncList() { - List<ThirdpartySdncRegisterInfo> sdncList = new ArrayList<>(); - EsrThirdpartySdncList esrSdnc = new EsrThirdpartySdncList(); - try { - String esrSdncStr = ExternalSystemProxy.querySdncList(); - esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncList.class); - LOG.info("Response from AAI by query thirdparty SDNC list: " + esrSdnc); - sdncList = getSdncDetailList(esrSdnc); - } catch (ExtsysException e) { - LOG.error("Query thirdparty SDNC list failed !", e); + + public Response queryThirdpartySdncList() { + List<ThirdpartySdncRegisterInfo> sdncList = new ArrayList<>(); + EsrThirdpartySdncList esrSdnc = new EsrThirdpartySdncList(); + try { + String esrSdncStr = ExternalSystemProxy.querySdncList(); + esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncList.class); + LOG.info("Response from AAI by query thirdparty SDNC list: " + esrSdnc); + sdncList = getSdncDetailList(esrSdnc); + } catch (ExtsysException e) { + LOG.error("Query thirdparty SDNC list failed !", e); + } + return Response.ok(sdncList).build(); } - return Response.ok(sdncList).build(); - } - - public Response queryThirdpartySdncById(String thirdpartySdncId) { - ThirdpartySdncRegisterInfo thirdpartySdnc = querySdncDetail(thirdpartySdncId); - return Response.ok(thirdpartySdnc).build(); - } - - public Response delThirdpartySdnc(String thirdpartySdncId) { - EsrThirdpartySdncDetail thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId); - String resourceVersion = thirdpartySdncDetail.getResourceVersion(); - try { - ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId - + "resouce-version:" + resourceVersion, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response queryThirdpartySdncById(String thirdpartySdncId) { + ThirdpartySdncRegisterInfo thirdpartySdnc = querySdncDetail(thirdpartySdncId); + return Response.ok(thirdpartySdnc).build(); } - } - - private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) { - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); - try { - String esrSdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); - LOG.info("Response from AAI by query thirdparty SDNC: " + esrSdncStr); - esrSdncDetail = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); - sdncRegisterInfo = thirdpartySdncManagerUtil.esrSdnc2SdncRegisterInfo(esrSdncDetail); - return sdncRegisterInfo; - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! thirdpaty SDNC ID: " + sdncId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delThirdpartySdnc(String thirdpartySdncId) { + EsrThirdpartySdncDetail thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId); + String resourceVersion = thirdpartySdncDetail.getResourceVersion(); + try { + ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId + "resouce-version:" + + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + } + + private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) { + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + try { + String esrSdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); + LOG.info("Response from AAI by query thirdparty SDNC: " + esrSdncStr); + esrSdncDetail = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); + sdncRegisterInfo = thirdpartySdncManagerUtil.esrSdnc2SdncRegisterInfo(esrSdncDetail); + return sdncRegisterInfo; + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! thirdpaty SDNC ID: " + sdncId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - private List<ThirdpartySdncRegisterInfo> getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) { - List<ThirdpartySdncRegisterInfo> sdncInfoList = new ArrayList<>(); - for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) { - String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId(); - ThirdpartySdncRegisterInfo sdncInfo = querySdncDetail(sdncId); - if (sdncInfo != null) { - sdncInfoList.add(sdncInfo); - } + + private List<ThirdpartySdncRegisterInfo> getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) { + List<ThirdpartySdncRegisterInfo> sdncInfoList = new ArrayList<>(); + for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) { + String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId(); + ThirdpartySdncRegisterInfo sdncInfo = querySdncDetail(sdncId); + if (sdncInfo != null) { + sdncInfoList.add(sdncInfo); + } + } + return sdncInfoList; } - return sdncInfoList; - } - - private EsrThirdpartySdncDetail queryEsrThirdpartySdncDetail (String sdncId) { - EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); - try { - String esrThirdpartySdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); - LOG.info("Response from AAI by query thirdparty SDNC: " + esrThirdpartySdncStr); - esrSdncDetail = new Gson().fromJson(esrThirdpartySdncStr, EsrThirdpartySdncDetail.class); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + sdncId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private EsrThirdpartySdncDetail queryEsrThirdpartySdncDetail(String sdncId) { + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + try { + String esrThirdpartySdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); + LOG.info("Response from AAI by query thirdparty SDNC: " + esrThirdpartySdncStr); + esrSdncDetail = new Gson().fromJson(esrThirdpartySdncStr, EsrThirdpartySdncDetail.class); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + sdncId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return esrSdncDetail; } - return esrSdncDetail; - } - + } 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 fa52166..e34217d 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 @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.entity.aai.CloudRegionList; import org.onap.aai.esr.entity.aai.EsrSystemInfo; @@ -34,190 +32,190 @@ import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.util.VimManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class VimManagerWrapper { - private static VimManagerWrapper vimManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(VimManagerWrapper.class); - - private static VimManagerUtil vimManagerUtil = new VimManagerUtil(); - - private static CloudRegionProxy cloudRegionProxy = new CloudRegionProxy(); - - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * get VimManagerWrapper instance. - * - * @return vim manager wrapper instance - */ - public static VimManagerWrapper getInstance() { - if (vimManagerWrapper == null) { - vimManagerWrapper = new VimManagerWrapper(); + private static VimManagerWrapper vimManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VimManagerWrapper.class); + + private static VimManagerUtil vimManagerUtil = new VimManagerUtil(); + + private static CloudRegionProxy cloudRegionProxy = new CloudRegionProxy(); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * get VimManagerWrapper instance. + * + * @return vim manager wrapper instance + */ + public static VimManagerWrapper getInstance() { + if (vimManagerWrapper == null) { + vimManagerWrapper = new VimManagerWrapper(); + } + return vimManagerWrapper; + } - return vimManagerWrapper; - - } - - public Response registerVim(VimRegisterInfo vimRegisterInfo) { - LOG.info( - "Start register VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - VimRegisterResponse result = new VimRegisterResponse(); - cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); - String cloudOwner = vimRegisterInfo.getCloudOwner(); - String cloudRegionId = vimRegisterInfo.getCloudRegionId(); - try { - cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegion); - result.setCloudOwner(cloudOwner); - result.setCloudRegionId(cloudRegionId); - Tenant tenant = new Tenant(); - tenant.setDefaultTenant(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getDefaultTenant()); - try { - VimManagerProxy.updateVim(cloudOwner, cloudRegionId, tenant); - } catch (ExtsysException e) { - LOG.error("Update VIM by Multi-cloud failed !", e); - } - return Response.ok(result).build(); - } catch (ExtsysException error) { - LOG.error("Register VIM failed !", error); - throw ExceptionUtil.buildExceptionResponse(error.getMessage()); + + public Response registerVim(VimRegisterInfo vimRegisterInfo) { + LOG.info("Start register VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + VimRegisterResponse result = new VimRegisterResponse(); + cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + String cloudOwner = vimRegisterInfo.getCloudOwner(); + String cloudRegionId = vimRegisterInfo.getCloudRegionId(); + try { + cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegion); + result.setCloudOwner(cloudOwner); + result.setCloudRegionId(cloudRegionId); + Tenant tenant = new Tenant(); + tenant.setDefaultTenant(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getDefaultTenant()); + try { + VimManagerProxy.updateVim(cloudOwner, cloudRegionId, tenant); + } catch (ExtsysException e) { + LOG.error("Update VIM by Multi-cloud failed !", e); + } + return Response.ok(result).build(); + } catch (ExtsysException error) { + LOG.error("Register VIM failed !", error); + throw ExceptionUtil.buildExceptionResponse(error.getMessage()); + } } - } - - public Response updateVim(String cloudOwner, String cloudRegionId,VimRegisterInfo vimRegisterInfo) { - LOG.info("Start update VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterResponse result = new VimRegisterResponse(); - - cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); - try { - cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail); - result.setCloudOwner(cloudOwner); - result.setCloudRegionId(cloudRegionId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VIM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response updateVim(String cloudOwner, String cloudRegionId, VimRegisterInfo vimRegisterInfo) { + LOG.info("Start update VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterResponse result = new VimRegisterResponse(); + + cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); + try { + cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail); + result.setCloudOwner(cloudOwner); + result.setCloudRegionId(cloudRegionId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VIM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryVimListDetails() { - List<VimRegisterInfo> vimRegisterInfos = new ArrayList<>(); - CloudRegionList cloudRegionList = new CloudRegionList(); - try { - String aaiVimList = cloudRegionProxy.qureyVimList(); - cloudRegionList = new Gson().fromJson(aaiVimList, CloudRegionList.class); - vimRegisterInfos = getVimDetailList(cloudRegionList); - return Response.ok(vimRegisterInfos).build(); - } catch (ExtsysException error) { - LOG.error("Query vim list details failed !", error); - return Response.ok(vimRegisterInfos).build(); + + public Response queryVimListDetails() { + List<VimRegisterInfo> vimRegisterInfos = new ArrayList<>(); + CloudRegionList cloudRegionList = new CloudRegionList(); + try { + String aaiVimList = cloudRegionProxy.qureyVimList(); + cloudRegionList = new Gson().fromJson(aaiVimList, CloudRegionList.class); + vimRegisterInfos = getVimDetailList(cloudRegionList); + return Response.ok(vimRegisterInfos).build(); + } catch (ExtsysException error) { + LOG.error("Query vim list details failed !", error); + return Response.ok(vimRegisterInfos).build(); + } + } - } - - public Response queryVimById(String cloudOwner, String cloudRegionId) { - VimRegisterInfo vim = new VimRegisterInfo(); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - LOG.info("Response from AAI by query VIM: " + cloudRegionstr); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - vim = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); - return Response.ok(vim).build(); - } catch (ExtsysException e) { - LOG.error("Query vim details by ID failed !", e); - return Response.ok(vim).build(); + public Response queryVimById(String cloudOwner, String cloudRegionId) { + VimRegisterInfo vim = new VimRegisterInfo(); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + LOG.info("Response from AAI by query VIM: " + cloudRegionstr); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + vim = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); + return Response.ok(vim).build(); + } catch (ExtsysException e) { + LOG.error("Query vim details by ID failed !", e); + return Response.ok(vim).build(); + } + } - } - - private List<VimRegisterInfo> getVimDetailList(CloudRegionList cloudRegionList) { - List<VimRegisterInfo> vimRegisterInfos = new ArrayList<>(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - int cloudRegionNum = cloudRegionList.getCloudRegion().size(); - for (int i = 0; i < cloudRegionNum; i++) { - String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner(); - String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId(); - vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); - vimRegisterInfos.add(vimRegisterInfo); + private List<VimRegisterInfo> getVimDetailList(CloudRegionList cloudRegionList) { + List<VimRegisterInfo> vimRegisterInfos = new ArrayList<>(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + int cloudRegionNum = cloudRegionList.getCloudRegion().size(); + for (int i = 0; i < cloudRegionNum; i++) { + String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner(); + String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId(); + vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); + vimRegisterInfos.add(vimRegisterInfo); + } + return vimRegisterInfos; } - return vimRegisterInfos; - } - - private VimRegisterInfo getVimDetail(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterInfo registeredVimInfo = new VimRegisterInfo(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - registeredVimInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); - } catch (ExtsysException error) { - LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " - + cloudRegionId, error); + + private VimRegisterInfo getVimDetail(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterInfo registeredVimInfo = new VimRegisterInfo(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + registeredVimInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); + } catch (ExtsysException error) { + LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + error); + } + return registeredVimInfo; } - return registeredVimInfo; - } - - private CloudRegionDetail getOriginalCloudRegion(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - return cloudRegionDetail; - } catch (ExtsysException error) { - LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " - + cloudRegionId, error); - return null; + + private CloudRegionDetail getOriginalCloudRegion(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + return cloudRegionDetail; + } catch (ExtsysException error) { + LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + error); + return null; + } } - } - - private CloudRegionDetail getVimUpdateInfo(VimRegisterInfo vimRegisterInfo) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - CloudRegionDetail originalCloudRegionDetail = new CloudRegionDetail(); - EsrSystemInfo originalSystemInfo = new EsrSystemInfo(); - String cloudOwner = vimRegisterInfo.getCloudOwner(); - String cloudRegionId = vimRegisterInfo.getCloudRegionId(); - originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); - String resourceVersion = originalCloudRegionDetail.getResourceVersion(); - cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); - if(resourceVersion != null) { - cloudRegionDetail.setResourceVersion(resourceVersion); - originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId(originalSystemInfo.getEsrSystemInfoId()); - cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setResouceVersion(originalSystemInfo.getResouceVersion()); + + private CloudRegionDetail getVimUpdateInfo(VimRegisterInfo vimRegisterInfo) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + CloudRegionDetail originalCloudRegionDetail = new CloudRegionDetail(); + EsrSystemInfo originalSystemInfo = new EsrSystemInfo(); + String cloudOwner = vimRegisterInfo.getCloudOwner(); + String cloudRegionId = vimRegisterInfo.getCloudRegionId(); + originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); + String resourceVersion = originalCloudRegionDetail.getResourceVersion(); + cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + if (resourceVersion != null) { + cloudRegionDetail.setResourceVersion(resourceVersion); + originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalSystemInfo.getEsrSystemInfoId()); + cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalSystemInfo.getResouceVersion()); + } + return cloudRegionDetail; } - return cloudRegionDetail; - } - - public Response delVim(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); - String resourceVersion = cloudRegionDetail.getResourceVersion(); - try { - cloudRegionProxy.deleteVim(cloudOwner, cloudRegionId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error("Delete cloud region from A&AI failed! cloud-owner = " + cloudOwner - + ", cloud-region-id = " + cloudRegionId + "resouce-version:" + resourceVersion, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delVim(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); + String resourceVersion = cloudRegionDetail.getResourceVersion(); + try { + cloudRegionProxy.deleteVim(cloudOwner, cloudRegionId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete cloud region from A&AI failed! cloud-owner = " + cloudOwner + ", cloud-region-id = " + + cloudRegionId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - private CloudRegionDetail queryCloudRegionDetail (String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionStr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - LOG.info("Response from AAI by query cloud region: " + cloudRegionStr); - cloudRegionDetail = new Gson().fromJson(cloudRegionStr, CloudRegionDetail.class); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! cloud-owner = " + cloudOwner - + ", cloud-region-id = " + cloudRegionId , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private CloudRegionDetail queryCloudRegionDetail(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionStr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + LOG.info("Response from AAI by query cloud region: " + cloudRegionStr); + cloudRegionDetail = new Gson().fromJson(cloudRegionStr, CloudRegionDetail.class); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return cloudRegionDetail; } - return cloudRegionDetail; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java index 584a156..ee28b77 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.aai.EsrVnfmList; @@ -31,145 +29,142 @@ import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; import org.onap.aai.esr.util.VnfmManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class VnfmManagerWrapper { - private static VnfmManagerWrapper vnfmManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); + private static VnfmManagerWrapper vnfmManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); - private static VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); - - /** - * get VnfmManagerWrapper instance. - * - * @return vnfm manager wrapper instance - */ - public static VnfmManagerWrapper getInstance() { - if (vnfmManagerWrapper == null) { - vnfmManagerWrapper = new VnfmManagerWrapper(); + private static VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); + + /** + * get VnfmManagerWrapper instance. + * + * @return vnfm manager wrapper instance + */ + public static VnfmManagerWrapper getInstance() { + if (vnfmManagerWrapper == null) { + vnfmManagerWrapper = new VnfmManagerWrapper(); + } + return vnfmManagerWrapper; } - return vnfmManagerWrapper; - } - public Response registerVnfm(VnfmRegisterInfo vnfm) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); - String vnfmId = esrVnfmDetail.getVnfmId(); - try { - ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); - result.setId(vnfmId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register VNFM failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response registerVnfm(VnfmRegisterInfo vnfm) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); + String vnfmId = esrVnfmDetail.getVnfmId(); + try { + ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); + result.setId(vnfmId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response updateVnfm(VnfmRegisterInfo vnfm, String vnfmId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrVnfmDetail originalEsrVnfmDetail = queryEsrVnfmDetail(vnfmId); - EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); - String resourceVersion = getResourceVersion(vnfmId); - esrVnfmDetail.setResourceVersion(resourceVersion); - esrVnfmDetail.setVnfmId(vnfmId); - EsrSystemInfo originalEsrSystemInfo = originalEsrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - try { - ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); - result.setId(vnfmId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateVnfm(VnfmRegisterInfo vnfm, String vnfmId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrVnfmDetail originalEsrVnfmDetail = queryEsrVnfmDetail(vnfmId); + EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); + String resourceVersion = getResourceVersion(vnfmId); + esrVnfmDetail.setResourceVersion(resourceVersion); + esrVnfmDetail.setVnfmId(vnfmId); + EsrSystemInfo originalEsrSystemInfo = originalEsrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + try { + ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); + result.setId(vnfmId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response queryVnfmList() { - List<VnfmRegisterInfo> vnfmList = new ArrayList<>(); - EsrVnfmList esrVnfm = new EsrVnfmList(); - try { - String esrVnfmStr = ExternalSystemProxy.queryVnfmList(); - esrVnfm = new Gson().fromJson(esrVnfmStr, EsrVnfmList.class); - LOG.info("Response from AAI by query VNFM list: " + esrVnfm); - vnfmList = getVnfmDetailList(esrVnfm); - return Response.ok(vnfmList).build(); - } catch (ExtsysException e) { - LOG.error("Query VNFM list failed !", e); - return Response.ok(vnfmList).build(); + public Response queryVnfmList() { + List<VnfmRegisterInfo> vnfmList = new ArrayList<>(); + EsrVnfmList esrVnfm = new EsrVnfmList(); + try { + String esrVnfmStr = ExternalSystemProxy.queryVnfmList(); + esrVnfm = new Gson().fromJson(esrVnfmStr, EsrVnfmList.class); + LOG.info("Response from AAI by query VNFM list: " + esrVnfm); + vnfmList = getVnfmDetailList(esrVnfm); + return Response.ok(vnfmList).build(); + } catch (ExtsysException e) { + LOG.error("Query VNFM list failed !", e); + return Response.ok(vnfmList).build(); + } } - } - public Response queryVnfmById(String vnfmId) { - VnfmRegisterInfo vnfm = queryVnfmDetail(vnfmId); - if (vnfm != null) { - return Response.ok(vnfm).build(); - } else { - return Response.ok(vnfm).build(); + public Response queryVnfmById(String vnfmId) { + VnfmRegisterInfo vnfm = queryVnfmDetail(vnfmId); + if (vnfm != null) { + return Response.ok(vnfm).build(); + } else { + return Response.ok(vnfm).build(); + } } - } - public Response delVnfm(String vnfmId) { - String resourceVersion = getResourceVersion(vnfmId); - try { - ExternalSystemProxy.deleteVnfm(vnfmId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error( - "Delete VNFM from A&AI failed! VNFM ID: " + vnfmId + "resouce-version:" + resourceVersion, - e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response delVnfm(String vnfmId) { + String resourceVersion = getResourceVersion(vnfmId); + try { + ExternalSystemProxy.deleteVnfm(vnfmId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete VNFM from A&AI failed! VNFM ID: " + vnfmId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - private VnfmRegisterInfo queryVnfmDetail(String vnfmId) { - VnfmRegisterInfo vnfm = new VnfmRegisterInfo(); - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - try { - String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); - LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); - esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); - vnfm = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + private VnfmRegisterInfo queryVnfmDetail(String vnfmId) { + VnfmRegisterInfo vnfm = new VnfmRegisterInfo(); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + try { + String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); + LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); + esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); + vnfm = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + } + return vnfm; } - return vnfm; - } - private List<VnfmRegisterInfo> getVnfmDetailList(EsrVnfmList esrVnfm) { - List<VnfmRegisterInfo> vnfmInfoList = new ArrayList<>(); - for (int i = 0; i < esrVnfm.getEsrVnfm().size(); i++) { - String vnfmId = esrVnfm.getEsrVnfm().get(i).getVnfmId(); - VnfmRegisterInfo vnfmInfo = queryVnfmDetail(vnfmId); - if (vnfmInfo != null) { - vnfmInfoList.add(vnfmInfo); - } + private List<VnfmRegisterInfo> getVnfmDetailList(EsrVnfmList esrVnfm) { + List<VnfmRegisterInfo> vnfmInfoList = new ArrayList<>(); + for (int i = 0; i < esrVnfm.getEsrVnfm().size(); i++) { + String vnfmId = esrVnfm.getEsrVnfm().get(i).getVnfmId(); + VnfmRegisterInfo vnfmInfo = queryVnfmDetail(vnfmId); + if (vnfmInfo != null) { + vnfmInfoList.add(vnfmInfo); + } + } + return vnfmInfoList; } - return vnfmInfoList; - } - - private String getResourceVersion (String vnfmId) { - String resourceVersion = null; - EsrVnfmDetail esrVnfmDetail = queryEsrVnfmDetail(vnfmId); - if (esrVnfmDetail != null && esrVnfmDetail.getResourceVersion() != null) { - resourceVersion = esrVnfmDetail.getResourceVersion(); + + private String getResourceVersion(String vnfmId) { + String resourceVersion = null; + EsrVnfmDetail esrVnfmDetail = queryEsrVnfmDetail(vnfmId); + if (esrVnfmDetail != null && esrVnfmDetail.getResourceVersion() != null) { + resourceVersion = esrVnfmDetail.getResourceVersion(); + } + return resourceVersion; } - return resourceVersion; - } - - private EsrVnfmDetail queryEsrVnfmDetail (String vnfmId) { - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - try { - String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); - LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); - esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private EsrVnfmDetail queryEsrVnfmDetail(String vnfmId) { + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + try { + String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); + LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); + esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return esrVnfmDetail; } - return esrVnfmDetail; - } } |