2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.config;
23 import static java.lang.String.format;
24 import static java.util.Collections.emptyMap;
26 import java.util.Collections;
27 import java.util.Date;
28 import java.util.List;
32 import lombok.NoArgsConstructor;
34 import lombok.ToString;
35 import org.apache.commons.collections.CollectionUtils;
36 import org.apache.commons.collections.map.CaseInsensitiveMap;
37 import org.openecomp.sdc.common.api.BasicConfiguration;
42 public class Configuration extends BasicConfiguration {
44 private List<String> identificationHeaderFields;
46 * Requests from these Urls will not be logged by org.openecomp.sdc.be.filters.BeServletFilter.<br>
48 private List<String> unLoggedUrls;
52 private String beFqdn;
56 private Integer beHttpPort;
58 * backend http secured port
60 private Integer beSslPort;
64 private String beContext;
66 * backend protocol. http | https
68 private String beProtocol = "http";
69 private Date released;
70 private String version = "1111";
71 private String toscaConformanceLevel = "3.0";
72 private String minToscaConformanceLevel = "3.0";
73 private List<String> protocols;
74 private Map<String, String> users;
75 private Map<String, Object> neo4j;
76 private String janusGraphCfgFile;
77 private String janusGraphMigrationKeySpaceCfgFile;
78 private Boolean janusGraphInMemoryGraph;
79 private int startMigrationFrom;
80 private Long janusGraphLockTimeout;
81 private Long janusGraphReconnectIntervalInSeconds;
82 private List<String> healthStatusExclude;
83 private Long janusGraphHealthCheckReadTimeout;
84 private Long uebHealthCheckReconnectIntervalInSeconds;
85 private Long uebHealthCheckReadTimeout;
86 private List<Map<String, Map<String, String>>> defaultImports;
87 private List<String> globalCsarImports;
88 private List<String> resourceTypes;
89 private List<String> excludeResourceCategory;
90 private List<String> excludeResourceType;
91 private Map<String, Set<String>> excludedPolicyTypesMapping;
92 private Map<String, Set<String>> excludedGroupTypesMapping;
93 private Map<String, Object> deploymentResourceArtifacts;
94 private Map<String, Object> deploymentResourceInstanceArtifacts;
95 private Map<String, Object> toscaArtifacts;
96 private Map<String, Object> informationalResourceArtifacts;
97 private Map<String, Object> informationalServiceArtifacts;
98 private Map<String, Object> serviceApiArtifacts;
99 private List<String> excludeServiceCategory;
100 private List<String> licenseTypes;
101 private List<String> definedResourceNamespace;
102 private List<String> directives;
103 private List<CustomToscaFunction> defaultCustomToscaFunctions;
104 private Integer additionalInformationMaxNumberOfKeys;
105 private HeatDeploymentArtifactTimeout heatArtifactDeploymentTimeout;
106 private BeMonitoringConfig systemMonitoring;
107 private CleanComponentsConfiguration cleanComponentsConfiguration;
108 private String artifactsIndex;
109 private String heatEnvArtifactHeader;
110 private String heatEnvArtifactFooter;
111 private String toscaFilesDir;
112 private String heatTranslatorPath;
113 private OnboardingConfig onboarding;
114 private BasicAuthConfig basicAuth;
115 private CassandrConfig cassandraConfig;
116 private SwitchoverDetectorConfig switchoverDetector;
117 private ApplicationL1CacheConfig applicationL1Cache;
118 private ApplicationL2CacheConfig applicationL2Cache;
119 private ToscaValidatorsConfig toscaValidators;
120 private boolean disableAudit;
121 private Map<String, VfModuleProperty> vfModuleProperties;
122 private Map<String, String> genericAssetNodeTypes;
123 private Map<String, CategoryBaseTypeConfig> serviceBaseNodeTypes;
124 private Map<String, Map<String, String>> resourceNodeTypes;
125 private String appVersion;
126 private String artifactGeneratorConfig;
127 private String autoHealingOwner;
128 private boolean enableAutoHealing;
129 private Map<String, List<String>> resourcesForUpgrade;
130 private DmaapConsumerConfiguration dmaapConsumerConfiguration;
131 private DmaapProducerConfiguration dmaapProducerConfiguration;
132 private boolean skipUpgradeFailedVfs;
133 private boolean skipUpgradeVSPs;
134 private DmeConfiguration dmeConfiguration;
135 private boolean supportAllottedResourcesAndProxy;
136 private Integer deleteLockTimeoutInSeconds;
137 private Integer maxDeleteComponents;
138 private String workloadContext;
139 private EnvironmentContext environmentContext;
140 private List<GabConfig> gabConfig;
141 private EcompPortalConfig ecompPortal;
142 private List<ArtifactConfiguration> artifacts;
143 private Map<String, Map<String, List<String>>> componentAllowedInstanceTypes;
144 private ExternalCsarStore externalCsarStore;
145 private CsarFormat csarFormat;
146 private String componentInstanceCounterDelimiter;
147 private String dataValidatorFilterExcludedUrls; // Comma separated list of excluded URLs by the DataValidatorFilter
148 private String permittedAncestors; // Space separated list of permitted ancestors
150 @SuppressWarnings("unchecked")
151 private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {
152 return map == null ? emptyMap() : new CaseInsensitiveMap(map);
155 public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) {
156 return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout;
159 public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) {
160 return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds;
163 public Map<String, Set<String>> getExcludedPolicyTypesMapping() {
164 return safeGetCapsInsensitiveMap(excludedPolicyTypesMapping);
167 public Map<String, Set<String>> getExcludedGroupTypesMapping() {
168 return safeGetCapsInsensitiveMap(excludedGroupTypesMapping);
171 public List<Map<String, Map<String, String>>> getDefaultImports() {
172 return Collections.unmodifiableList(defaultImports);
176 public String toString() {
177 return new StringBuilder().append(format("backend host: %s%n", beFqdn)).append(format("backend http port: %s%n", beHttpPort))
178 .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext))
179 .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)).append(format("Released: %s%n", released))
180 .append(format("Supported protocols: %s%n", protocols)).append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j))
181 .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)).append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
182 .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
183 .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds))
184 .append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
185 .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
186 .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
187 .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts))
188 .append(format("Supported artifacts types: %s%n", artifacts)).append(format("Supported license types: %s%n", licenseTypes))
189 .append(format("Additional information Maximum number of preoperties: %s%n", additionalInformationMaxNumberOfKeys))
190 .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout))
191 .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls))
192 .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts))
193 .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader))
194 .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)).append(format("onboarding: %s%n", onboarding)).toString();
197 public List<String> getGlobalCsarImports() {
198 if (CollectionUtils.isEmpty(globalCsarImports)) {
199 return Collections.emptyList();
201 return globalCsarImports;
207 public static class CassandrConfig {
209 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
210 private List<String> cassandraHosts;
211 private Integer cassandraPort;
212 private String localDataCenter;
213 private Long reconnectTimeout;
214 private Integer socketReadTimeout;
215 private Integer socketConnectTimeout;
216 private List<KeyspaceConfig> keySpaces;
217 private boolean authenticate;
218 private String username;
219 private String password;
221 private String truststorePath;
222 private String truststorePassword;
223 private int maxWaitSeconds = 120;
225 public Integer getCassandraPort() {
226 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
232 public static class KeyspaceConfig {
235 private String replicationStrategy;
236 private List<String> replicationInfo;
243 public static class SwitchoverDetectorConfig {
245 private String gBeFqdn;
246 private String gFeFqdn;
247 private String beVip;
248 private String feVip;
249 private int beResolveAttempts;
250 private int feResolveAttempts;
251 private Boolean enabled;
252 private long interval;
253 private String changePriorityUser;
254 private String changePriorityPassword;
255 private String publishNetworkUrl;
256 private String publishNetworkBody;
257 private Map<String, GroupInfo> groups;
259 public String getgBeFqdn() {
263 public void setgBeFqdn(String gBeFqdn) {
264 this.gBeFqdn = gBeFqdn;
267 public String getgFeFqdn() {
271 public void setgFeFqdn(String gFeFqdn) {
272 this.gFeFqdn = gFeFqdn;
278 public static class GroupInfo {
280 String changePriorityUrl;
281 String changePriorityBody;
289 public static class HeatDeploymentArtifactTimeout {
291 private Integer defaultMinutes;
292 private Integer minMinutes;
293 private Integer maxMinutes;
299 public static class BeMonitoringConfig {
301 private Boolean enabled;
302 private Boolean isProxy;
303 private Integer probeIntervalInSeconds;
305 public Integer getProbeIntervalInSeconds(int defaultVal) {
306 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
313 public static class ArtifactTypeConfig {
315 private List<String> acceptedTypes;
316 private List<String> validForResourceTypes;
323 public static class OnboardingConfig {
325 private String protocol = "http";
327 private Integer port;
328 private String getLatestVspPackageUri;
329 private String getVspPackageUri;
330 private String getVspUri;
331 private String getLatestVspUri;
333 private String healthCheckUri;
339 public static class BasicAuthConfig {
341 private boolean enabled;
342 private String userName;
343 private String userPass;
344 private String excludedUrls;
350 @ToString(onlyExplicitlyIncluded = true)
351 public static class EcompPortalConfig {
353 private String protocol = "https";
355 private Integer port;
356 private String healthCheckUri;
358 private String defaultFunctionalMenu;
359 private Integer pollingInterval;
360 private Integer timeoutMs;
367 public static class ApplicationL1CacheConfig {
369 private ApplicationL1CacheInfo datatypes;
376 public static class ApplicationL2CacheConfig {
378 private boolean enabled;
379 private ApplicationL1CacheCatalogInfo catalogL1Cache;
381 private QueueInfo queue;
388 public static class ToscaValidatorsConfig {
390 private Integer stringMaxLength;
397 public static class ApplicationL1CacheInfo {
399 private Boolean enabled;
400 private Integer firstRunDelay;
401 private Integer pollIntervalInSec;
408 public static class ApplicationL1CacheCatalogInfo {
410 private Boolean enabled;
411 private Integer resourcesSizeInCache;
412 private Integer servicesSizeInCache;
413 private Integer productsSizeInCache;
420 public static class QueueInfo {
422 private Integer waitOnShutDownInMinutes;
423 private Integer syncIntervalInSecondes;
424 private Integer numberOfCacheWorkers;
430 public static class EnvironmentContext {
432 private String defaultValue;
433 private List<String> validValues;
439 public static class VfModuleProperty {
441 private String forBaseModule;
442 private String forNonBaseModule;
448 public static class PathsAndNamesDefinition {
450 private String friendlyName;
452 private Boolean searchable;
458 public static class GabConfig {
460 private String artifactType;
461 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
467 public static class ExternalCsarStore {
469 private String storageType;
470 private Endpoint endpoint;
471 private Credentials credentials;
472 private String tempPath;
473 private int uploadPartSize;
478 public static class Endpoint {
482 private boolean secure;
488 public static class Credentials {
490 private String accessKey;
491 private String secretKey;
498 public static class CsarFormat {
500 private String defaultFormat;
506 public static class CustomToscaFunction {