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 Boolean consumerBusinessLogic;
122 private Map<String, VfModuleProperty> vfModuleProperties;
123 private Map<String, String> genericAssetNodeTypes;
124 private Map<String, CategoryBaseTypeConfig> serviceBaseNodeTypes;
125 private Map<String, Map<String, String>> resourceNodeTypes;
126 private String appVersion;
127 private String artifactGeneratorConfig;
128 private CadiFilterParams cadiFilterParams;
129 private Boolean aafAuthNeeded = false;
130 private String autoHealingOwner;
131 private boolean enableAutoHealing;
132 private Map<String, List<String>> resourcesForUpgrade;
133 private DmaapConsumerConfiguration dmaapConsumerConfiguration;
134 private DmaapProducerConfiguration dmaapProducerConfiguration;
135 private boolean skipUpgradeFailedVfs;
136 private boolean skipUpgradeVSPs;
137 private DmeConfiguration dmeConfiguration;
138 private boolean supportAllottedResourcesAndProxy;
139 private Integer deleteLockTimeoutInSeconds;
140 private Integer maxDeleteComponents;
141 private CookieConfig authCookie;
142 private String aafNamespace;
143 private String workloadContext;
144 private EnvironmentContext environmentContext;
145 private List<GabConfig> gabConfig;
146 private EcompPortalConfig ecompPortal;
147 private List<ArtifactConfiguration> artifacts;
148 private Map<String, Map<String, List<String>>> componentAllowedInstanceTypes;
149 private ExternalCsarStore externalCsarStore;
150 private CsarFormat csarFormat;
151 private String componentInstanceCounterDelimiter;
152 private String dataValidatorFilterExcludedUrls; // Comma separated list of excluded URLs by the DataValidatorFilter
153 private String permittedAncestors; // Space separated list of permitted ancestors
155 @SuppressWarnings("unchecked")
156 private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {
157 return map == null ? emptyMap() : new CaseInsensitiveMap(map);
160 public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) {
161 return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout;
164 public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) {
165 return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds;
168 public Map<String, Set<String>> getExcludedPolicyTypesMapping() {
169 return safeGetCapsInsensitiveMap(excludedPolicyTypesMapping);
172 public Map<String, Set<String>> getExcludedGroupTypesMapping() {
173 return safeGetCapsInsensitiveMap(excludedGroupTypesMapping);
176 public List<Map<String, Map<String, String>>> getDefaultImports() {
177 return Collections.unmodifiableList(defaultImports);
181 public String toString() {
182 return new StringBuilder().append(format("backend host: %s%n", beFqdn)).append(format("backend http port: %s%n", beHttpPort))
183 .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext))
184 .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)).append(format("Released: %s%n", released))
185 .append(format("Supported protocols: %s%n", protocols)).append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j))
186 .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)).append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
187 .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
188 .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds))
189 .append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
190 .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
191 .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
192 .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts))
193 .append(format("Supported artifacts types: %s%n", artifacts)).append(format("Supported license types: %s%n", licenseTypes))
194 .append(format("Additional information Maximum number of preoperties: %s%n", additionalInformationMaxNumberOfKeys))
195 .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout))
196 .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls))
197 .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts))
198 .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader))
199 .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)).append(format("onboarding: %s%n", onboarding)).toString();
202 public List<String> getGlobalCsarImports() {
203 if (CollectionUtils.isEmpty(globalCsarImports)) {
204 return Collections.emptyList();
206 return globalCsarImports;
212 public static class CookieConfig {
214 private String securityKey = "";
215 private long maxSessionTimeOut = 600 * 1000L;
216 private long sessionIdleTimeOut = 30 * 1000L;
217 private String cookieName = "AuthenticationCookie";
218 private String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp";
219 private List<String> excludedUrls;
220 private List<String> onboardingExcludedUrls;
221 private String domain = "";
222 private String path = "";
223 private boolean isHttpOnly = true;
225 public boolean isHttpOnly() {
229 public void setIsHttpOnly(final boolean isHttpOnly) {
230 this.isHttpOnly = isHttpOnly;
237 public static class CassandrConfig {
239 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
240 private List<String> cassandraHosts;
241 private Integer cassandraPort;
242 private String localDataCenter;
243 private Long reconnectTimeout;
244 private Integer socketReadTimeout;
245 private Integer socketConnectTimeout;
246 private List<KeyspaceConfig> keySpaces;
247 private boolean authenticate;
248 private String username;
249 private String password;
251 private String truststorePath;
252 private String truststorePassword;
253 private int maxWaitSeconds = 120;
255 public Integer getCassandraPort() {
256 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
262 public static class KeyspaceConfig {
265 private String replicationStrategy;
266 private List<String> replicationInfo;
273 public static class SwitchoverDetectorConfig {
275 private String gBeFqdn;
276 private String gFeFqdn;
277 private String beVip;
278 private String feVip;
279 private int beResolveAttempts;
280 private int feResolveAttempts;
281 private Boolean enabled;
282 private long interval;
283 private String changePriorityUser;
284 private String changePriorityPassword;
285 private String publishNetworkUrl;
286 private String publishNetworkBody;
287 private Map<String, GroupInfo> groups;
289 public String getgBeFqdn() {
293 public void setgBeFqdn(String gBeFqdn) {
294 this.gBeFqdn = gBeFqdn;
297 public String getgFeFqdn() {
301 public void setgFeFqdn(String gFeFqdn) {
302 this.gFeFqdn = gFeFqdn;
308 public static class GroupInfo {
310 String changePriorityUrl;
311 String changePriorityBody;
319 public static class HeatDeploymentArtifactTimeout {
321 private Integer defaultMinutes;
322 private Integer minMinutes;
323 private Integer maxMinutes;
329 public static class BeMonitoringConfig {
331 private Boolean enabled;
332 private Boolean isProxy;
333 private Integer probeIntervalInSeconds;
335 public Integer getProbeIntervalInSeconds(int defaultVal) {
336 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
343 public static class ArtifactTypeConfig {
345 private List<String> acceptedTypes;
346 private List<String> validForResourceTypes;
353 public static class OnboardingConfig {
355 private String protocol = "http";
357 private Integer port;
358 private String getLatestVspPackageUri;
359 private String getVspPackageUri;
360 private String getVspUri;
361 private String getLatestVspUri;
363 private String healthCheckUri;
369 public static class BasicAuthConfig {
371 private boolean enabled;
372 private String userName;
373 private String userPass;
374 private String excludedUrls;
380 @ToString(onlyExplicitlyIncluded = true)
381 public static class EcompPortalConfig {
383 private String protocol = "https";
385 private Integer port;
386 private String healthCheckUri;
388 private String defaultFunctionalMenu;
389 private Integer pollingInterval;
390 private Integer timeoutMs;
397 public static class ApplicationL1CacheConfig {
399 private ApplicationL1CacheInfo datatypes;
406 public static class ApplicationL2CacheConfig {
408 private boolean enabled;
409 private ApplicationL1CacheCatalogInfo catalogL1Cache;
411 private QueueInfo queue;
418 public static class ToscaValidatorsConfig {
420 private Integer stringMaxLength;
427 public static class ApplicationL1CacheInfo {
429 private Boolean enabled;
430 private Integer firstRunDelay;
431 private Integer pollIntervalInSec;
438 public static class ApplicationL1CacheCatalogInfo {
440 private Boolean enabled;
441 private Integer resourcesSizeInCache;
442 private Integer servicesSizeInCache;
443 private Integer productsSizeInCache;
450 public static class QueueInfo {
452 private Integer waitOnShutDownInMinutes;
453 private Integer syncIntervalInSecondes;
454 private Integer numberOfCacheWorkers;
460 public static class EnvironmentContext {
462 private String defaultValue;
463 private List<String> validValues;
469 public static class VfModuleProperty {
471 private String forBaseModule;
472 private String forNonBaseModule;
478 public static class PathsAndNamesDefinition {
480 private String friendlyName;
482 private Boolean searchable;
488 public static class GabConfig {
490 private String artifactType;
491 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
497 public static class ExternalCsarStore {
499 private String storageType;
500 private Endpoint endpoint;
501 private Credentials credentials;
502 private String tempPath;
503 private int uploadPartSize;
508 public static class Endpoint {
512 private boolean secure;
518 public static class Credentials {
520 private String accessKey;
521 private String secretKey;
528 public static class CsarFormat {
530 private String defaultFormat;
536 public static class CustomToscaFunction {