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 keystorePath;
225 private String keystorePassword;
226 private String truststorePath;
227 private String truststorePassword;
228 private int maxWaitSeconds = 120;
230 public Integer getCassandraPort() {
231 return cassandraPort != null ? cassandraPort : CASSANDRA_DEFAULT_PORT;
237 public static class KeyspaceConfig {
240 private String replicationStrategy;
241 private List<String> replicationInfo;
248 public static class SwitchoverDetectorConfig {
250 private String gBeFqdn;
251 private String gFeFqdn;
252 private String beVip;
253 private String feVip;
254 private int beResolveAttempts;
255 private int feResolveAttempts;
256 private Boolean enabled;
257 private long interval;
258 private String changePriorityUser;
259 private String changePriorityPassword;
260 private String publishNetworkUrl;
261 private String publishNetworkBody;
262 private Map<String, GroupInfo> groups;
264 public String getgBeFqdn() {
268 public void setgBeFqdn(String gBeFqdn) {
269 this.gBeFqdn = gBeFqdn;
272 public String getgFeFqdn() {
276 public void setgFeFqdn(String gFeFqdn) {
277 this.gFeFqdn = gFeFqdn;
283 public static class GroupInfo {
285 String changePriorityUrl;
286 String changePriorityBody;
294 public static class HeatDeploymentArtifactTimeout {
296 private Integer defaultMinutes;
297 private Integer minMinutes;
298 private Integer maxMinutes;
304 public static class BeMonitoringConfig {
306 private Boolean enabled;
307 private Boolean isProxy;
308 private Integer probeIntervalInSeconds;
310 public Integer getProbeIntervalInSeconds(int defaultVal) {
311 return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds;
318 public static class ArtifactTypeConfig {
320 private List<String> acceptedTypes;
321 private List<String> validForResourceTypes;
328 public static class OnboardingConfig {
330 private String protocol = "http";
332 private Integer port;
333 private String getLatestVspPackageUri;
334 private String getVspPackageUri;
335 private String getVspUri;
336 private String getLatestVspUri;
338 private String healthCheckUri;
344 public static class BasicAuthConfig {
346 private boolean enabled;
347 private String userName;
348 private String userPass;
349 private String excludedUrls;
355 @ToString(onlyExplicitlyIncluded = true)
356 public static class EcompPortalConfig {
358 private String protocol = "https";
360 private Integer port;
361 private String healthCheckUri;
363 private String defaultFunctionalMenu;
364 private Integer pollingInterval;
365 private Integer timeoutMs;
372 public static class ApplicationL1CacheConfig {
374 private ApplicationL1CacheInfo datatypes;
381 public static class ApplicationL2CacheConfig {
383 private boolean enabled;
384 private ApplicationL1CacheCatalogInfo catalogL1Cache;
386 private QueueInfo queue;
393 public static class ToscaValidatorsConfig {
395 private Integer stringMaxLength;
402 public static class ApplicationL1CacheInfo {
404 private Boolean enabled;
405 private Integer firstRunDelay;
406 private Integer pollIntervalInSec;
413 public static class ApplicationL1CacheCatalogInfo {
415 private Boolean enabled;
416 private Integer resourcesSizeInCache;
417 private Integer servicesSizeInCache;
418 private Integer productsSizeInCache;
425 public static class QueueInfo {
427 private Integer waitOnShutDownInMinutes;
428 private Integer syncIntervalInSecondes;
429 private Integer numberOfCacheWorkers;
435 public static class EnvironmentContext {
437 private String defaultValue;
438 private List<String> validValues;
444 public static class VfModuleProperty {
446 private String forBaseModule;
447 private String forNonBaseModule;
453 public static class PathsAndNamesDefinition {
455 private String friendlyName;
457 private Boolean searchable;
463 public static class GabConfig {
465 private String artifactType;
466 private List<PathsAndNamesDefinition> pathsAndNamesDefinitions;
472 public static class ExternalCsarStore {
474 private String storageType;
475 private Endpoint endpoint;
476 private Credentials credentials;
477 private String tempPath;
478 private int uploadPartSize;
483 public static class Endpoint {
487 private boolean secure;
493 public static class Credentials {
495 private String accessKey;
496 private String secretKey;
503 public static class CsarFormat {
505 private String defaultFormat;
511 public static class CustomToscaFunction {