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, String> serviceNodeTypes;
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;
148 @SuppressWarnings("unchecked")
149 private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {
150 return map == null ? emptyMap() : new CaseInsensitiveMap(map);
153 public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) {
154 return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout;
157 public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) {
158 return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds;
161 public Map<String, Set<String>> getExcludedPolicyTypesMapping() {
162 return safeGetCapsInsensitiveMap(excludedPolicyTypesMapping);
165 public Map<String, Set<String>> getExcludedGroupTypesMapping() {
166 return safeGetCapsInsensitiveMap(excludedGroupTypesMapping);
170 public String toString() {
171 return new StringBuilder().append(format("backend host: %s%n", beFqdn)).append(format("backend http port: %s%n", beHttpPort))
172 .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext))
173 .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)).append(format("Released: %s%n", released))
174 .append(format("Supported protocols: %s%n", protocols)).append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j))
175 .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)).append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
176 .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
177 .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds))
178 .append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
179 .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
180 .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
181 .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts))
182 .append(format("Supported artifacts types: %s%n", artifacts)).append(format("Supported license types: %s%n", licenseTypes))
183 .append(format("Additional information Maximum number of preoperties: %s%n", additionalInformationMaxNumberOfKeys))
184 .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout))
185 .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls))
186 .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts))
187 .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader))
188 .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)).append(format("onboarding: %s%n", onboarding)).toString();
191 public List<String> getGlobalCsarImports() {
192 if (CollectionUtils.isEmpty(globalCsarImports)) {
193 return Collections.emptyList();
195 return globalCsarImports;
201 public static class CookieConfig {
203 private String securityKey = "";
204 private long maxSessionTimeOut = 600 * 1000L;
205 private long sessionIdleTimeOut = 30 * 1000L;
206 private String cookieName = "AuthenticationCookie";
207 private String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp";
208 private List<String> excludedUrls;
209 private List<String> onboardingExcludedUrls;
210 private String domain = "";
211 private String path = "";
212 private boolean isHttpOnly = true;
214 public boolean isHttpOnly() {
218 public void setIsHttpOnly(final boolean isHttpOnly) {
219 this.isHttpOnly = isHttpOnly;
226 public static class CassandrConfig {
228 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
229 private List<String> cassandraHosts;
230 private Integer cassandraPort;
231 private String localDataCenter;
232 private Long reconnectTimeout;
233 private Integer socketReadTimeout;
234 private Integer socketConnectTimeout;
235 private List<KeyspaceConfig> keySpaces;
236 private boolean authenticate;
237 private String username;
238 private String password;
240 private String truststorePath;
241 private String truststorePassword;
242 private int maxWaitSeconds = 120;
244 public Integer getCassandraPort() {
245 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
251 public static class KeyspaceConfig {
254 private String replicationStrategy;
255 private List<String> replicationInfo;
262 public static class SwitchoverDetectorConfig {
264 private String gBeFqdn;
265 private String gFeFqdn;
266 private String beVip;
267 private String feVip;
268 private int beResolveAttempts;
269 private int feResolveAttempts;
270 private Boolean enabled;
271 private long interval;
272 private String changePriorityUser;
273 private String changePriorityPassword;
274 private String publishNetworkUrl;
275 private String publishNetworkBody;
276 private Map<String, GroupInfo> groups;
278 public String getgBeFqdn() {
282 public void setgBeFqdn(String gBeFqdn) {
283 this.gBeFqdn = gBeFqdn;
286 public String getgFeFqdn() {
290 public void setgFeFqdn(String gFeFqdn) {
291 this.gFeFqdn = gFeFqdn;
297 public static class GroupInfo {
299 String changePriorityUrl;
300 String changePriorityBody;
308 public static class HeatDeploymentArtifactTimeout {
310 private Integer defaultMinutes;
311 private Integer minMinutes;
312 private Integer maxMinutes;
318 public static class BeMonitoringConfig {
320 private Boolean enabled;
321 private Boolean isProxy;
322 private Integer probeIntervalInSeconds;
324 public Integer getProbeIntervalInSeconds(int defaultVal) {
325 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
332 public static class ArtifactTypeConfig {
334 private List<String> acceptedTypes;
335 private List<String> validForResourceTypes;
342 public static class OnboardingConfig {
344 private String protocol = "http";
346 private Integer port;
347 private String downloadCsarUri;
349 private String healthCheckUri;
355 public static class BasicAuthConfig {
357 private boolean enabled;
358 private String userName;
359 private String userPass;
360 private String excludedUrls;
366 @ToString(onlyExplicitlyIncluded = true)
367 public static class EcompPortalConfig {
369 private String protocol = "https";
371 private Integer port;
372 private String healthCheckUri;
374 private String defaultFunctionalMenu;
375 private Integer pollingInterval;
376 private Integer timeoutMs;
383 public static class ApplicationL1CacheConfig {
385 private ApplicationL1CacheInfo datatypes;
392 public static class ApplicationL2CacheConfig {
394 private boolean enabled;
395 private ApplicationL1CacheCatalogInfo catalogL1Cache;
397 private QueueInfo queue;
404 public static class ToscaValidatorsConfig {
406 private Integer stringMaxLength;
413 public static class ApplicationL1CacheInfo {
415 private Boolean enabled;
416 private Integer firstRunDelay;
417 private Integer pollIntervalInSec;
424 public static class ApplicationL1CacheCatalogInfo {
426 private Boolean enabled;
427 private Integer resourcesSizeInCache;
428 private Integer servicesSizeInCache;
429 private Integer productsSizeInCache;
436 public static class QueueInfo {
438 private Integer waitOnShutDownInMinutes;
439 private Integer syncIntervalInSecondes;
440 private Integer numberOfCacheWorkers;
446 public static class EnvironmentContext {
448 private String defaultValue;
449 private List<String> validValues;
455 public static class VfModuleProperty {
457 private String forBaseModule;
458 private String forNonBaseModule;
464 public static class PathsAndNamesDefinition {
466 private String friendlyName;
468 private Boolean searchable;
474 public static class GabConfig {
476 private String artifactType;
477 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;