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;
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 CookieConfig {
209 private String securityKey = "";
210 private long maxSessionTimeOut = 600 * 1000L;
211 private long sessionIdleTimeOut = 30 * 1000L;
212 private String cookieName = "AuthenticationCookie";
213 private String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp";
214 private List<String> excludedUrls;
215 private List<String> onboardingExcludedUrls;
216 private String domain = "";
217 private String path = "";
218 private boolean isHttpOnly = true;
220 public boolean isHttpOnly() {
224 public void setIsHttpOnly(final boolean isHttpOnly) {
225 this.isHttpOnly = isHttpOnly;
232 public static class CassandrConfig {
234 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
235 private List<String> cassandraHosts;
236 private Integer cassandraPort;
237 private String localDataCenter;
238 private Long reconnectTimeout;
239 private Integer socketReadTimeout;
240 private Integer socketConnectTimeout;
241 private List<KeyspaceConfig> keySpaces;
242 private boolean authenticate;
243 private String username;
244 private String password;
246 private String truststorePath;
247 private String truststorePassword;
248 private int maxWaitSeconds = 120;
250 public Integer getCassandraPort() {
251 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
257 public static class KeyspaceConfig {
260 private String replicationStrategy;
261 private List<String> replicationInfo;
268 public static class SwitchoverDetectorConfig {
270 private String gBeFqdn;
271 private String gFeFqdn;
272 private String beVip;
273 private String feVip;
274 private int beResolveAttempts;
275 private int feResolveAttempts;
276 private Boolean enabled;
277 private long interval;
278 private String changePriorityUser;
279 private String changePriorityPassword;
280 private String publishNetworkUrl;
281 private String publishNetworkBody;
282 private Map<String, GroupInfo> groups;
284 public String getgBeFqdn() {
288 public void setgBeFqdn(String gBeFqdn) {
289 this.gBeFqdn = gBeFqdn;
292 public String getgFeFqdn() {
296 public void setgFeFqdn(String gFeFqdn) {
297 this.gFeFqdn = gFeFqdn;
303 public static class GroupInfo {
305 String changePriorityUrl;
306 String changePriorityBody;
314 public static class HeatDeploymentArtifactTimeout {
316 private Integer defaultMinutes;
317 private Integer minMinutes;
318 private Integer maxMinutes;
324 public static class BeMonitoringConfig {
326 private Boolean enabled;
327 private Boolean isProxy;
328 private Integer probeIntervalInSeconds;
330 public Integer getProbeIntervalInSeconds(int defaultVal) {
331 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
338 public static class ArtifactTypeConfig {
340 private List<String> acceptedTypes;
341 private List<String> validForResourceTypes;
348 public static class OnboardingConfig {
350 private String protocol = "http";
352 private Integer port;
353 private String getLatestVspPackageUri;
354 private String getVspPackageUri;
355 private String getVspUri;
356 private String getLatestVspUri;
358 private String healthCheckUri;
364 public static class BasicAuthConfig {
366 private boolean enabled;
367 private String userName;
368 private String userPass;
369 private String excludedUrls;
375 @ToString(onlyExplicitlyIncluded = true)
376 public static class EcompPortalConfig {
378 private String protocol = "https";
380 private Integer port;
381 private String healthCheckUri;
383 private String defaultFunctionalMenu;
384 private Integer pollingInterval;
385 private Integer timeoutMs;
392 public static class ApplicationL1CacheConfig {
394 private ApplicationL1CacheInfo datatypes;
401 public static class ApplicationL2CacheConfig {
403 private boolean enabled;
404 private ApplicationL1CacheCatalogInfo catalogL1Cache;
406 private QueueInfo queue;
413 public static class ToscaValidatorsConfig {
415 private Integer stringMaxLength;
422 public static class ApplicationL1CacheInfo {
424 private Boolean enabled;
425 private Integer firstRunDelay;
426 private Integer pollIntervalInSec;
433 public static class ApplicationL1CacheCatalogInfo {
435 private Boolean enabled;
436 private Integer resourcesSizeInCache;
437 private Integer servicesSizeInCache;
438 private Integer productsSizeInCache;
445 public static class QueueInfo {
447 private Integer waitOnShutDownInMinutes;
448 private Integer syncIntervalInSecondes;
449 private Integer numberOfCacheWorkers;
455 public static class EnvironmentContext {
457 private String defaultValue;
458 private List<String> validValues;
464 public static class VfModuleProperty {
466 private String forBaseModule;
467 private String forNonBaseModule;
473 public static class PathsAndNamesDefinition {
475 private String friendlyName;
477 private Boolean searchable;
483 public static class GabConfig {
485 private String artifactType;
486 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
492 public static class ExternalCsarStore {
494 private String storageType;
495 private Endpoint endpoint;
496 private Credentials credentials;
497 private String tempPath;
498 private int uploadPartSize;
503 public static class Endpoint {
507 private boolean secure;
513 public static class Credentials {
515 private String accessKey;
516 private String secretKey;
523 public static class CsarFormat {
525 private String defaultFormat;