diff options
Diffstat (limited to 'common-app-api/src/main/java/org/openecomp')
13 files changed, 296 insertions, 27 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java index c962500c2b..79d6438df3 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.config; +import static java.lang.String.format; + import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -28,8 +30,6 @@ import java.util.Set; import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - public class Configuration extends BasicConfiguration { private List<String> identificationHeaderFields; @@ -117,6 +117,8 @@ public class Configuration extends BasicConfiguration { private OnboardingConfig onboarding; + private DcaeConfig dcae; + private CassandrConfig cassandraConfig; private SwitchoverDetectorConfig switchoverDetector; @@ -132,6 +134,60 @@ public class Configuration extends BasicConfiguration { private Map<String, VfModuleProperty> vfModuleProperties; private Map<String, String> genericAssetNodeTypes; + + private String appVersion; + private String artifactGeneratorConfig; + + public String getAutoHealingOwner() { + return autoHealingOwner; + } + + public void setAutoHealingOwner(String autoHealingOwner) { + this.autoHealingOwner = autoHealingOwner; + } + + private String autoHealingOwner; + + private Map<String, List<String>> resourcesForUpgrade; + private boolean skipUpgradeFailedVfs; + + private boolean skipUpgradeVSPs; + + + + + + public void setSkipUpgradeVSPs(boolean skipUpgradeVSPs) { this.skipUpgradeVSPs = skipUpgradeVSPs; } + + public boolean getSkipUpgradeVSPsFlag() { return skipUpgradeVSPs; } + + public boolean getSkipUpgradeFailedVfs() { + return skipUpgradeFailedVfs; + } + + public void setSkipUpgradeFailedVfs(boolean skipUpgradeFailedVfs) { + this.skipUpgradeFailedVfs = skipUpgradeFailedVfs; + } + + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public String getArtifactGeneratorConfig() { + return artifactGeneratorConfig; + } + + public void setArtifactGeneratorConfig(String artifactGeneratorConfig) { + this.artifactGeneratorConfig = artifactGeneratorConfig; + } + + private String workloadContext; + + private EnvironmentContext environmentContext; public Map<String, String> getGenericAssetNodeTypes() { return genericAssetNodeTypes; @@ -485,6 +541,22 @@ public class Configuration extends BasicConfiguration { this.uebHealthCheckReadTimeout = uebHealthCheckReadTimeout; } + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + public EnvironmentContext getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(EnvironmentContext environmentContext) { + this.environmentContext = environmentContext; + } + public static class ElasticSearchConfig { List<IndicesTimeFrequencyEntry> indicesTimeFrequency; @@ -902,6 +974,54 @@ public class Configuration extends BasicConfiguration { } + public DcaeConfig getDcae() { + return dcae; + } + + public void setDcae(DcaeConfig dcae) { + this.dcae = dcae; + } + + public static class DcaeConfig { + + String protocol = "http"; + String host; + Integer port; + String healthCheckUri; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getHealthCheckUri() { + return healthCheckUri; + } + + public void setHealthCheckUri(String healthCheckUri) { + this.healthCheckUri = healthCheckUri; + } + } + public static class EcompPortalConfig { private String defaultFunctionalMenu; @@ -1118,6 +1238,30 @@ public class Configuration extends BasicConfiguration { } } + public static class EnvironmentContext { + + String defaultValue; + List<String> validValues; + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public List<String> getValidValues() { + return validValues; + } + + public void setValidValues(List<String> validValues) { + this.validValues = validValues; + } + } + + + public CleanComponentsConfiguration getCleanComponentsConfiguration() { return cleanComponentsConfiguration; } @@ -1340,4 +1484,13 @@ public class Configuration extends BasicConfiguration { public void setDefaultImports(LinkedList<Map<String, Map<String, String>>> defaultImports) { this.defaultImports = defaultImports; } + + public Map<String, List<String>> getResourcesForUpgrade() { + return resourcesForUpgrade; + } + + public void setResourcesForUpgrade(Map<String, List<String>> resourcesForUpgrade) { + this.resourcesForUpgrade = resourcesForUpgrade; + } + } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java index 1f036678cf..ac7391d8cc 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java @@ -82,7 +82,8 @@ public class BeMonitoringService { } public void start(int interval) { - Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration(); + Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) + .getConfiguration(); if (config.getSystemMonitoring().getEnabled()) { log.info("BE monitoring service is enabled, interval is {} seconds", interval); this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS); @@ -94,8 +95,10 @@ public class BeMonitoringService { private void processMonitoringEvent(MonitoringEvent monitoringMetrics) { CloseableHttpClient httpClient = null; try { - Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration(); - String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(), config.getBeHttpPort()); + Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) + .getConfiguration(); + String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(), + config.getBeHttpPort()); httpClient = getHttpClient(config); HttpPost httpPost = new HttpPost(redirectedUrl); String monitoringMetricsJson = gson.toJson(monitoringMetrics); diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java index fcde7f13ac..8e15b96e0c 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java @@ -109,6 +109,8 @@ public interface Constants { public static final String ARTIFACT_NAME = "artifactName"; public static final String ARTIFACT_ID = "uniqueId"; public static final String REQUIRED_ARTIFACTS = "requiredArtifacts"; + public static final String ARTIFACT_HEAT_PARAMS = "heatParameters"; + public static final String ARTIFACT_ES_ID = "esId"; public static final String ABSTRACT = "abstract"; public static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml"; @@ -127,4 +129,15 @@ public interface Constants { public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml"; public static final String SERVICE_TEMPLATES_CONTAINING_FOLDER = "Definitions/"; public static final String UNBOUNDED = "unbounded"; + + //SDC HealthCheck components + public static final String HC_COMPONENT_FE = "FE"; + public static final String HC_COMPONENT_BE = "BE"; + public static final String HC_COMPONENT_TITAN = "TITAN"; + public static final String HC_COMPONENT_CASSANDRA = "CASSANDRA"; + public static final String HC_COMPONENT_DISTRIBUTION_ENGINE = "DE"; + + //external HealthCheck components + public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING"; + public static final String HC_COMPONENT_DCAE = "DCAE"; } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java index 2e4f54f153..8afd2fb4c9 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java @@ -27,14 +27,14 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; public class HealthCheckInfo { - - private HealthCheckComponent healthCheckComponent; + + private String healthCheckComponent; private HealthCheckStatus healthCheckStatus; private String version; private String description; private List<HealthCheckInfo> componentsInfo; - public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, + public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description) { super(); this.healthCheckComponent = healthCheckComponent; @@ -43,7 +43,7 @@ public class HealthCheckInfo { this.description = description; } - public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, + public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description, List<HealthCheckInfo> componentsInfo) { super(); this.healthCheckComponent = healthCheckComponent; @@ -57,7 +57,7 @@ public class HealthCheckInfo { super(); } - public HealthCheckComponent getHealthCheckComponent() { + public String getHealthCheckComponent() { return healthCheckComponent; } @@ -65,6 +65,10 @@ public class HealthCheckInfo { return healthCheckStatus; } + public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) { + this.healthCheckStatus = healthCheckStatus; + } + public List<HealthCheckInfo> getComponentsInfo() { return componentsInfo; } @@ -85,11 +89,15 @@ public class HealthCheckInfo { return description; } - public enum HealthCheckComponent { - FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, - CAS, ZU;//Amdocs components + public void setDescription(String description) { + this.description = description; } + /*public enum HealthCheckComponent { + FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, DCAE, + CAS, ZU;//Amdocs components + }*/ + public enum HealthCheckStatus { UP, DOWN, UNKNOWN; } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java index 5051d8e645..950af691da 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java @@ -25,9 +25,7 @@ import java.util.IllegalFormatException; import java.util.Locale; import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompAlarmSeverity; import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompErrorSeverity; -import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompErrorType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java index 584a1d8ad1..87453dedc4 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java @@ -30,9 +30,9 @@ import java.util.Date; import java.util.List; import org.openecomp.sdc.common.config.EcompErrorEnum; -import org.openecomp.sdc.common.config.EcompErrorLogUtil; import org.openecomp.sdc.common.config.EcompErrorEnum.AlarmSeverity; import org.openecomp.sdc.common.config.EcompErrorEnum.ErrorType; +import org.openecomp.sdc.common.config.EcompErrorLogUtil; public class GenerateEcompErrorsCsv { diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java index 45976c42d1..a6965a75ac 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java @@ -38,7 +38,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; public class AppContextListener implements ServletContextListener { diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java new file mode 100644 index 0000000000..e0d5206066 --- /dev/null +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.common.util; + +import java.util.List; + +import org.openecomp.sdc.common.api.HealthCheckInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HealthCheckUtil { + + private static Logger log = LoggerFactory.getLogger(HealthCheckUtil.class.getName()); + + public static boolean getAggregateStatus(List<HealthCheckInfo> healthCheckInfos) { + + boolean status = true; + + for (HealthCheckInfo healthCheckInfo : healthCheckInfos) { + if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckInfo.HealthCheckStatus.DOWN)) { + log.debug("Component {} is reported as DOWN - Aggregated HC will be DOWN", healthCheckInfo.getHealthCheckComponent()); + status = false; + break; + } + } + + return status; + } + + public static String getAggregateDescription(List<HealthCheckInfo> healthCheckInfos, String parentDescription) { + + StringBuilder sb = new StringBuilder(); + healthCheckInfos.forEach(x -> { + if (x.getHealthCheckStatus() == HealthCheckInfo.HealthCheckStatus.DOWN) { + sb.append("Component ").append(x.getHealthCheckComponent()).append(" is Down, "); + } + }); + + return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; + +// return description; + } + +} diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java index eb6c29ce4a..d58b9a970d 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java @@ -20,12 +20,12 @@ package org.openecomp.sdc.common.util; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - import java.util.List; import java.util.stream.Collectors; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + public class PairUtils { public static <L, R> List<L> leftSequence(List<ImmutablePair<L, R>> pairs) { diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java index 242d74a9ca..322725b032 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java @@ -267,8 +267,14 @@ public class YamlToObjectConverter { public boolean isValidYaml(byte[] fileContents) { try { - Map<String, Object> mappedToscaTemplate = (Map<String, Object>) defaultYaml - .load(new ByteArrayInputStream(fileContents)); + + Iterable<Object> mappedToscaTemplateIt = defaultYaml.loadAll(new ByteArrayInputStream(fileContents)); + + for (Object o : mappedToscaTemplateIt) { + System.out.println("Loaded object type:" + o.getClass()); + Map<String, Object> map = (Map<String, Object>) o; + } + } catch (Exception e) { log.error("Failed to convert yaml file to object - yaml is invalid", e); return false; diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java index 9058647bdb..109164d07d 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java @@ -20,8 +20,6 @@ package org.openecomp.sdc.exception; -import javax.ws.rs.core.Response; - /** * Nested POJOs to express required JSON format of the error * diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java index 536ec7a1bc..9ee8fc6be0 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java @@ -20,13 +20,13 @@ package org.openecomp.sdc.fe.config; +import static java.lang.String.format; + import java.util.Date; import java.util.List; import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - public class Configuration extends BasicConfiguration { /** * fe FQDN @@ -61,6 +61,8 @@ public class Configuration extends BasicConfiguration { private OnboardingConfig onboarding; + private DcaeConfig dcae; + public String getKibanaProtocol() { return kibanaProtocol; } @@ -349,6 +351,54 @@ public class Configuration extends BasicConfiguration { } } + public DcaeConfig getDcae() { + return dcae; + } + + public void setDcae(DcaeConfig dcae) { + this.dcae = dcae; + } + + public static class DcaeConfig { + + String protocol = "http"; + String host; + Integer port; + String healthCheckUri; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getHealthCheckUri() { + return healthCheckUri; + } + + public void setHealthCheckUri(String healthCheckUri) { + this.healthCheckUri = healthCheckUri; + } + } + @Override public String toString() { return new StringBuilder().append(format("backend host: %s%n", beHost)) diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java index 6733e179ba..a36293b829 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.fe.config; import org.openecomp.sdc.common.config.AbsEcompErrorManager; import org.openecomp.sdc.common.config.EcompErrorEnum; import org.openecomp.sdc.common.config.IEcompConfigurationManager; -import org.openecomp.sdc.fe.config.ConfigurationManager; public class FeEcompErrorManager extends AbsEcompErrorManager { |