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 String tlsCert;
70 private String tlsKey;
71 private String caCert;
72 private Date released;
73 private String version = "1111";
74 private String toscaConformanceLevel = "3.0";
75 private String minToscaConformanceLevel = "3.0";
76 private List<String> protocols;
77 private Map<String, String> users;
78 private Map<String, Object> neo4j;
79 private String janusGraphCfgFile;
80 private String janusGraphMigrationKeySpaceCfgFile;
81 private Boolean janusGraphInMemoryGraph;
82 private int startMigrationFrom;
83 private Long janusGraphLockTimeout;
84 private Long janusGraphReconnectIntervalInSeconds;
85 private List<String> healthStatusExclude;
86 private Long janusGraphHealthCheckReadTimeout;
87 private Long uebHealthCheckReconnectIntervalInSeconds;
88 private Long uebHealthCheckReadTimeout;
89 private List<Map<String, Map<String, String>>> defaultImports;
90 private List<String> globalCsarImports;
91 private List<String> resourceTypes;
92 private List<String> excludeResourceCategory;
93 private List<String> excludeResourceType;
94 private Map<String, Set<String>> excludedPolicyTypesMapping;
95 private Map<String, Set<String>> excludedGroupTypesMapping;
96 private Map<String, Object> deploymentResourceArtifacts;
97 private Map<String, Object> deploymentResourceInstanceArtifacts;
98 private Map<String, Object> toscaArtifacts;
99 private Map<String, Object> informationalResourceArtifacts;
100 private Map<String, Object> informationalServiceArtifacts;
101 private Map<String, Object> serviceApiArtifacts;
102 private List<String> excludeServiceCategory;
103 private List<String> licenseTypes;
104 private List<String> definedResourceNamespace;
105 private List<String> directives;
106 private List<CustomToscaFunction> defaultCustomToscaFunctions;
107 private Integer additionalInformationMaxNumberOfKeys;
108 private HeatDeploymentArtifactTimeout heatArtifactDeploymentTimeout;
109 private BeMonitoringConfig systemMonitoring;
110 private CleanComponentsConfiguration cleanComponentsConfiguration;
111 private String artifactsIndex;
112 private String heatEnvArtifactHeader;
113 private String heatEnvArtifactFooter;
114 private String toscaFilesDir;
115 private String heatTranslatorPath;
116 private OnboardingConfig onboarding;
117 private BasicAuthConfig basicAuth;
118 private CassandrConfig cassandraConfig;
119 private SwitchoverDetectorConfig switchoverDetector;
120 private ApplicationL1CacheConfig applicationL1Cache;
121 private ApplicationL2CacheConfig applicationL2Cache;
122 private ToscaValidatorsConfig toscaValidators;
123 private boolean disableAudit;
124 private Map<String, VfModuleProperty> vfModuleProperties;
125 private Map<String, String> genericAssetNodeTypes;
126 private Map<String, CategoryBaseTypeConfig> serviceBaseNodeTypes;
127 private Map<String, Map<String, String>> resourceNodeTypes;
128 private String appVersion;
129 private String artifactGeneratorConfig;
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 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 CassandrConfig {
212 private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
213 private List<String> cassandraHosts;
214 private Integer cassandraPort;
215 private String localDataCenter;
216 private Long reconnectTimeout;
217 private Integer socketReadTimeout;
218 private Integer socketConnectTimeout;
219 private List<KeyspaceConfig> keySpaces;
220 private boolean authenticate;
221 private String username;
222 private String password;
224 private String truststorePath;
225 private String truststorePassword;
226 private int maxWaitSeconds = 120;
228 public Integer getCassandraPort() {
229 return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
235 public static class KeyspaceConfig {
238 private String replicationStrategy;
239 private List<String> replicationInfo;
246 public static class SwitchoverDetectorConfig {
248 private String gBeFqdn;
249 private String gFeFqdn;
250 private String beVip;
251 private String feVip;
252 private int beResolveAttempts;
253 private int feResolveAttempts;
254 private Boolean enabled;
255 private long interval;
256 private String changePriorityUser;
257 private String changePriorityPassword;
258 private String publishNetworkUrl;
259 private String publishNetworkBody;
260 private Map<String, GroupInfo> groups;
262 public String getgBeFqdn() {
266 public void setgBeFqdn(String gBeFqdn) {
267 this.gBeFqdn = gBeFqdn;
270 public String getgFeFqdn() {
274 public void setgFeFqdn(String gFeFqdn) {
275 this.gFeFqdn = gFeFqdn;
281 public static class GroupInfo {
283 String changePriorityUrl;
284 String changePriorityBody;
292 public static class HeatDeploymentArtifactTimeout {
294 private Integer defaultMinutes;
295 private Integer minMinutes;
296 private Integer maxMinutes;
302 public static class BeMonitoringConfig {
304 private Boolean enabled;
305 private Boolean isProxy;
306 private Integer probeIntervalInSeconds;
308 public Integer getProbeIntervalInSeconds(int defaultVal) {
309 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
316 public static class ArtifactTypeConfig {
318 private List<String> acceptedTypes;
319 private List<String> validForResourceTypes;
326 public static class OnboardingConfig {
328 private String protocol = "http";
330 private Integer port;
331 private String getLatestVspPackageUri;
332 private String getVspPackageUri;
333 private String getVspUri;
334 private String getLatestVspUri;
336 private String healthCheckUri;
342 public static class BasicAuthConfig {
344 private boolean enabled;
345 private String userName;
346 private String userPass;
347 private String excludedUrls;
353 @ToString(onlyExplicitlyIncluded = true)
354 public static class EcompPortalConfig {
356 private String protocol = "https";
358 private Integer port;
359 private String healthCheckUri;
361 private String defaultFunctionalMenu;
362 private Integer pollingInterval;
363 private Integer timeoutMs;
370 public static class ApplicationL1CacheConfig {
372 private ApplicationL1CacheInfo datatypes;
379 public static class ApplicationL2CacheConfig {
381 private boolean enabled;
382 private ApplicationL1CacheCatalogInfo catalogL1Cache;
384 private QueueInfo queue;
391 public static class ToscaValidatorsConfig {
393 private Integer stringMaxLength;
400 public static class ApplicationL1CacheInfo {
402 private Boolean enabled;
403 private Integer firstRunDelay;
404 private Integer pollIntervalInSec;
411 public static class ApplicationL1CacheCatalogInfo {
413 private Boolean enabled;
414 private Integer resourcesSizeInCache;
415 private Integer servicesSizeInCache;
416 private Integer productsSizeInCache;
423 public static class QueueInfo {
425 private Integer waitOnShutDownInMinutes;
426 private Integer syncIntervalInSecondes;
427 private Integer numberOfCacheWorkers;
433 public static class EnvironmentContext {
435 private String defaultValue;
436 private List<String> validValues;
442 public static class VfModuleProperty {
444 private String forBaseModule;
445 private String forNonBaseModule;
451 public static class PathsAndNamesDefinition {
453 private String friendlyName;
455 private Boolean searchable;
461 public static class GabConfig {
463 private String artifactType;
464 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
470 public static class ExternalCsarStore {
472 private String storageType;
473 private Endpoint endpoint;
474 private Credentials credentials;
475 private String tempPath;
476 private int uploadPartSize;
481 public static class Endpoint {
485 private boolean secure;
491 public static class Credentials {
493 private String accessKey;
494 private String secretKey;
501 public static class CsarFormat {
503 private String defaultFormat;
509 public static class CustomToscaFunction {