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=========================================================
20 package org.openecomp.sdc.be.config;
22 import static java.lang.String.format;
23 import static java.util.Collections.emptyMap;
25 import java.util.Collections;
26 import java.util.Date;
27 import java.util.List;
31 import lombok.NoArgsConstructor;
33 import lombok.ToString;
34 import org.apache.commons.collections.CollectionUtils;
35 import org.apache.commons.collections.map.CaseInsensitiveMap;
36 import org.openecomp.sdc.common.api.BasicConfiguration;
41 public class Configuration extends BasicConfiguration {
43 private List<String> identificationHeaderFields;
45 * Requests from these Urls will not be logged by org.openecomp.sdc.be.filters.BeServletFilter.<br>
47 private List<String> unLoggedUrls;
51 private String beFqdn;
55 private Integer beHttpPort;
57 * backend http secured port
59 private Integer beSslPort;
63 private String beContext;
65 * backend protocol. http | https
67 private String beProtocol = "http";
68 private Date released;
69 private String version = "1111";
70 private String toscaConformanceLevel = "3.0";
71 private String minToscaConformanceLevel = "3.0";
72 private List<String> protocols;
73 private Map<String, String> users;
74 private Map<String, Object> neo4j;
75 private String janusGraphCfgFile;
76 private String janusGraphMigrationKeySpaceCfgFile;
77 private Boolean janusGraphInMemoryGraph;
78 private int startMigrationFrom;
79 private Long janusGraphLockTimeout;
80 private Long janusGraphReconnectIntervalInSeconds;
81 private List<String> healthStatusExclude;
82 private Long janusGraphHealthCheckReadTimeout;
83 private Long uebHealthCheckReconnectIntervalInSeconds;
84 private Long uebHealthCheckReadTimeout;
85 private List<Map<String, Map<String, String>>> defaultImports;
86 private List<String> globalCsarImports;
87 private List<String> resourceTypes;
88 private List<String> excludeResourceCategory;
89 private List<String> excludeResourceType;
90 private Map<String, Set<String>> excludedPolicyTypesMapping;
91 private Map<String, Set<String>> excludedGroupTypesMapping;
92 private Map<String, Object> deploymentResourceArtifacts;
93 private Map<String, Object> deploymentResourceInstanceArtifacts;
94 private Map<String, Object> toscaArtifacts;
95 private Map<String, Object> informationalResourceArtifacts;
96 private Map<String, Object> informationalServiceArtifacts;
97 private Map<String, Object> serviceApiArtifacts;
98 private List<String> excludeServiceCategory;
99 private List<String> licenseTypes;
100 private List<String> definedResourceNamespace;
101 private List<String> directives;
102 private Integer additionalInformationMaxNumberOfKeys;
103 private HeatDeploymentArtifactTimeout heatArtifactDeploymentTimeout;
104 private BeMonitoringConfig systemMonitoring;
105 private CleanComponentsConfiguration cleanComponentsConfiguration;
106 private String artifactsIndex;
107 private String heatEnvArtifactHeader;
108 private String heatEnvArtifactFooter;
109 private String toscaFilesDir;
110 private String heatTranslatorPath;
111 private OnboardingConfig onboarding;
112 private BasicAuthConfig basicAuth;
113 private CassandrConfig cassandraConfig;
114 private SwitchoverDetectorConfig switchoverDetector;
115 private ApplicationL1CacheConfig applicationL1Cache;
116 private ApplicationL2CacheConfig applicationL2Cache;
117 private ToscaValidatorsConfig toscaValidators;
118 private boolean disableAudit;
119 private Boolean consumerBusinessLogic;
120 private Map<String, VfModuleProperty> vfModuleProperties;
121 private Map<String, String> genericAssetNodeTypes;
122 private Map<String, CategoryBaseTypeConfig> serviceBaseNodeTypes;
123 private Map<String, Map<String, String>> resourceNodeTypes;
124 private String appVersion;
125 private String artifactGeneratorConfig;
126 private CadiFilterParams cadiFilterParams;
127 private Boolean aafAuthNeeded = false;
128 private String autoHealingOwner;
129 private boolean enableAutoHealing;
130 private Map<String, List<String>> resourcesForUpgrade;
131 private DmaapConsumerConfiguration dmaapConsumerConfiguration;
132 private DmaapProducerConfiguration dmaapProducerConfiguration;
133 private boolean skipUpgradeFailedVfs;
134 private boolean skipUpgradeVSPs;
135 private DmeConfiguration dmeConfiguration;
136 private boolean supportAllottedResourcesAndProxy;
137 private Integer deleteLockTimeoutInSeconds;
138 private Integer maxDeleteComponents;
139 private CookieConfig authCookie;
140 private String aafNamespace;
141 private String workloadContext;
142 private EnvironmentContext environmentContext;
143 private List<GabConfig> gabConfig;
144 private EcompPortalConfig ecompPortal;
145 private List<ArtifactConfiguration> artifacts;
146 private Map<String, Map<String, List<String>>> componentAllowedInstanceTypes;
147 private ExternalCsarStore externalCsarStore;
148 private CsarFormat csarFormat;
149 private String componentInstanceCounterDelimiter;
150 private String dataValidatorFilterExcludedUrls; // Comma separated list of excluded URLs by the DataValidatorFilter
151 private String permittedAncestors; // Space separated list of permitted ancestors
153 @SuppressWarnings("unchecked")
154 private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {
155 return map == null ? emptyMap() : new CaseInsensitiveMap(map);
158 public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) {
159 return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout;
162 public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) {
163 return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds;
166 public Map<String, Set<String>> getExcludedPolicyTypesMapping() {
167 return safeGetCapsInsensitiveMap(excludedPolicyTypesMapping);
170 public Map<String, Set<String>> getExcludedGroupTypesMapping() {
171 return safeGetCapsInsensitiveMap(excludedGroupTypesMapping);
174 public List<Map<String, Map<String, String>>> getDefaultImports() {
175 return Collections.unmodifiableList(defaultImports);
179 public String toString() {
180 return new StringBuilder().append(format("backend host: %s%n", beFqdn)).append(format("backend http port: %s%n", beHttpPort))
181 .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext))
182 .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)).append(format("Released: %s%n", released))
183 .append(format("Supported protocols: %s%n", protocols)).append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j))
184 .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)).append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
185 .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
186 .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds))
187 .append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
188 .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
189 .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
190 .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts))
191 .append(format("Supported artifacts types: %s%n", artifacts)).append(format("Supported license types: %s%n", licenseTypes))
192 .append(format("Additional information Maximum number of preoperties: %s%n", additionalInformationMaxNumberOfKeys))
193 .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout))
194 .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls))
195 .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts))
196 .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader))
197 .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)).append(format("onboarding: %s%n", onboarding)).toString();
200 public List<String> getGlobalCsarImports() {
201 if (CollectionUtils.isEmpty(globalCsarImports)) {
202 return Collections.emptyList();
204 return globalCsarImports;
210 public static class CookieConfig {
212 private String securityKey = "";
213 private long maxSessionTimeOut = 600 * 1000L;
214 private long sessionIdleTimeOut = 30 * 1000L;
215 private String cookieName = "AuthenticationCookie";
216 private String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp";
217 private List<String> excludedUrls;
218 private List<String> onboardingExcludedUrls;
219 private String domain = "";
220 private String path = "";
221 private boolean isHttpOnly = true;
223 public boolean isHttpOnly() {
227 public void setIsHttpOnly(final boolean isHttpOnly) {
228 this.isHttpOnly = isHttpOnly;
235 public static class CassandrConfig {
237 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
238 private List<String> cassandraHosts;
239 private Integer cassandraPort;
240 private String localDataCenter;
241 private Long reconnectTimeout;
242 private Integer socketReadTimeout;
243 private Integer socketConnectTimeout;
244 private List<KeyspaceConfig> keySpaces;
245 private boolean authenticate;
246 private String username;
247 private String password;
249 private String truststorePath;
250 private String truststorePassword;
251 private int maxWaitSeconds = 120;
253 public Integer getCassandraPort() {
254 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
260 public static class KeyspaceConfig {
263 private String replicationStrategy;
264 private List<String> replicationInfo;
271 public static class SwitchoverDetectorConfig {
273 private String gBeFqdn;
274 private String gFeFqdn;
275 private String beVip;
276 private String feVip;
277 private int beResolveAttempts;
278 private int feResolveAttempts;
279 private Boolean enabled;
280 private long interval;
281 private String changePriorityUser;
282 private String changePriorityPassword;
283 private String publishNetworkUrl;
284 private String publishNetworkBody;
285 private Map<String, GroupInfo> groups;
287 public String getgBeFqdn() {
291 public void setgBeFqdn(String gBeFqdn) {
292 this.gBeFqdn = gBeFqdn;
295 public String getgFeFqdn() {
299 public void setgFeFqdn(String gFeFqdn) {
300 this.gFeFqdn = gFeFqdn;
306 public static class GroupInfo {
308 String changePriorityUrl;
309 String changePriorityBody;
317 public static class HeatDeploymentArtifactTimeout {
319 private Integer defaultMinutes;
320 private Integer minMinutes;
321 private Integer maxMinutes;
327 public static class BeMonitoringConfig {
329 private Boolean enabled;
330 private Boolean isProxy;
331 private Integer probeIntervalInSeconds;
333 public Integer getProbeIntervalInSeconds(int defaultVal) {
334 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
341 public static class ArtifactTypeConfig {
343 private List<String> acceptedTypes;
344 private List<String> validForResourceTypes;
351 public static class OnboardingConfig {
353 private String protocol = "http";
355 private Integer port;
356 private String getLatestVspPackageUri;
357 private String getVspPackageUri;
358 private String getVspUri;
359 private String getLatestVspUri;
361 private String healthCheckUri;
367 public static class BasicAuthConfig {
369 private boolean enabled;
370 private String userName;
371 private String userPass;
372 private String excludedUrls;
378 @ToString(onlyExplicitlyIncluded = true)
379 public static class EcompPortalConfig {
381 private String protocol = "https";
383 private Integer port;
384 private String healthCheckUri;
386 private String defaultFunctionalMenu;
387 private Integer pollingInterval;
388 private Integer timeoutMs;
395 public static class ApplicationL1CacheConfig {
397 private ApplicationL1CacheInfo datatypes;
404 public static class ApplicationL2CacheConfig {
406 private boolean enabled;
407 private ApplicationL1CacheCatalogInfo catalogL1Cache;
409 private QueueInfo queue;
416 public static class ToscaValidatorsConfig {
418 private Integer stringMaxLength;
425 public static class ApplicationL1CacheInfo {
427 private Boolean enabled;
428 private Integer firstRunDelay;
429 private Integer pollIntervalInSec;
436 public static class ApplicationL1CacheCatalogInfo {
438 private Boolean enabled;
439 private Integer resourcesSizeInCache;
440 private Integer servicesSizeInCache;
441 private Integer productsSizeInCache;
448 public static class QueueInfo {
450 private Integer waitOnShutDownInMinutes;
451 private Integer syncIntervalInSecondes;
452 private Integer numberOfCacheWorkers;
458 public static class EnvironmentContext {
460 private String defaultValue;
461 private List<String> validValues;
467 public static class VfModuleProperty {
469 private String forBaseModule;
470 private String forNonBaseModule;
476 public static class PathsAndNamesDefinition {
478 private String friendlyName;
480 private Boolean searchable;
486 public static class GabConfig {
488 private String artifactType;
489 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
495 public static class ExternalCsarStore {
497 private String storageType;
498 private Endpoint endpoint;
499 private Credentials credentials;
500 private String tempPath;
501 private int uploadPartSize;
506 public static class Endpoint {
510 private boolean secure;
516 public static class Credentials {
518 private String accessKey;
519 private String secretKey;
526 public static class CsarFormat {
528 private String defaultFormat;