summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml43
-rw-r--r--src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java131
-rw-r--r--src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java56
-rw-r--r--src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java123
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java23
-rw-r--r--src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java192
-rw-r--r--src/main/resources/application.properties16
-rw-r--r--src/main/resources/logback-default.xml9
-rw-r--r--src/main/resources/system.properties19
11 files changed, 344 insertions, 272 deletions
diff --git a/pom.xml b/pom.xml
index 009233efb..fb4c29048 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,9 +20,7 @@
============LICENSE_END============================================
===================================================================
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.clamp</groupId>
<artifactId>clds</artifactId>
@@ -32,7 +30,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>1.1.0</version>
+ <version>1.2.0</version>
</parent>
<description>
@@ -68,7 +66,6 @@
<java.version>1.8</java.version>
<eelf.core.version>1.0.0</eelf.core.version>
- <logging.analytics.version>1.2.2-SNAPSHOT</logging.analytics.version>
<camel.version>2.22.0</camel.version>
<springboot.version>2.0.3.RELEASE</springboot.version>
@@ -86,7 +83,7 @@
<docker.skip.push>true</docker.skip.push>
<docker.skip.tag>true</docker.skip.tag>
<skip.staging.artifacts>false</skip.staging.artifacts>
- <python.http.proxy.param></python.http.proxy.param>
+ <python.http.proxy.param/>
<tomcat.version>8.5.32</tomcat.version>
</properties>
@@ -226,11 +223,6 @@
<version>${eelf.core.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-library</artifactId>
- <version>${logging.analytics.version}</version>
- </dependency>
- <dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.0.8</version>
@@ -315,10 +307,6 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
@@ -555,7 +543,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>25.1-jre</version>
+
</dependency>
<!-- Remove the MYSQL connector and replace it by Mariadb -->
<dependency>
@@ -572,7 +560,7 @@
<dependency>
<groupId>org.onap.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
- <version>1.3.0</version>
+ <version>1.4.1</version>
</dependency>
<!-- TESTING -->
<dependency>
@@ -633,9 +621,22 @@
</testResource>
</testResources>
<resources>
+ <!-- For AAF folder maven should not try to filter Keystores/Truststores ...
+ Otherwise they will be broken and unreadable
+ -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
+ <excludes>
+ <exclude>clds/aaf/**</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>clds/aaf/**</include>
+ </includes>
</resource>
<resource>
<directory>src/main/docker</directory>
@@ -708,10 +709,10 @@
<doctype>book</doctype>
<toc>left</toc>
<toclevels>3</toclevels>
- <numbered></numbered>
- <hardbreaks></hardbreaks>
- <sectlinks></sectlinks>
- <sectanchors></sectanchors>
+ <numbered/>
+ <hardbreaks/>
+ <sectlinks/>
+ <sectanchors/>
<generated>${project.build.directory}/asciidoc/generated</generated>
</attributes>
</configuration>
diff --git a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
index 93432c9f2..13dccdacb 100644
--- a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
@@ -22,49 +22,22 @@
*/
package org.onap.clamp.clds.config;
-import java.util.Properties;
-
import javax.servlet.Filter;
import org.onap.clamp.clds.filter.ClampCadiFilter;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
-import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
-@Component
@Configuration
@Profile("clamp-aaf-authentication")
-@ConfigurationProperties(prefix = "clamp.config.cadi")
public class AAFConfiguration {
- private static final String CADI_KEY_FILE = "cadi_keyfile";
- private static final String CADI_LOG_LEVEL = "cadi_loglevel";
- private static final String LATITUDE = "cadi_latitude";
- private static final String LONGITUDE = "cadi_longitude";
- private static final String LOCATE_URL = "aaf_locate_url";
- private static final String OAUTH_TOKEN_URL = "aaf_oauth2_token_url";
- private static final String OAUTH_INTROSPECT_URL = "aaf_oauth2_introspect_url";
- private static final String AAF_ENV = "aaf_env";
- private static final String AAF_URL = "aaf_url";
- private static final String X509_ISSUERS = "cadi_x509_issuers";
-
- private String keyFile;
- private String cadiLoglevel;
- private String cadiLatitude;
- private String cadiLongitude;
- private String aafLocateUrl;
- private String oauthTokenUrl;
- private String oauthIntrospectUrl;
- private String aafEnv;
- private String aafUrl;
- private String cadiX509Issuers;
/**
* Method to return clamp cadi filter.
- *
+ *
* @return Filter
*/
@Bean(name = "cadiFilter")
@@ -74,7 +47,7 @@ public class AAFConfiguration {
/**
* Method to register cadi filter.
- *
+ *
* @return FilterRegistrationBean
*/
@Bean
@@ -87,104 +60,4 @@ public class AAFConfiguration {
registration.setOrder(0);
return registration;
}
-
- public String getKeyFile() {
- return keyFile;
- }
-
- public void setKeyFile(String keyFile) {
- this.keyFile = keyFile;
- }
-
- public String getCadiLoglevel() {
- return cadiLoglevel;
- }
-
- public void setCadiLoglevel(String cadiLoglevel) {
- this.cadiLoglevel = cadiLoglevel;
- }
-
- public String getCadiLatitude() {
- return cadiLatitude;
- }
-
- public void setCadiLatitude(String cadiLatitude) {
- this.cadiLatitude = cadiLatitude;
- }
-
- public String getCadiLongitude() {
- return cadiLongitude;
- }
-
- public void setCadiLongitude(String cadiLongitude) {
- this.cadiLongitude = cadiLongitude;
- }
-
- public String getAafLocateUrl() {
- return aafLocateUrl;
- }
-
- public void setAafLocateUrl(String aafLocateUrl) {
- this.aafLocateUrl = aafLocateUrl;
- }
-
- public String getOauthTokenUrl() {
- return oauthTokenUrl;
- }
-
- public void setOauthTokenUrl(String oauthTokenUrl) {
- this.oauthTokenUrl = oauthTokenUrl;
- }
-
- public String getOauthIntrospectUrl() {
- return oauthIntrospectUrl;
- }
-
- public void setOauthIntrospectUrl(String oauthIntrospectUrl) {
- this.oauthIntrospectUrl = oauthIntrospectUrl;
- }
-
- public String getAafEnv() {
- return aafEnv;
- }
-
- public void setAafEnv(String aafEnv) {
- this.aafEnv = aafEnv;
- }
-
- public String getAafUrl() {
- return aafUrl;
- }
-
- public void setAafUrl(String aafUrl) {
- this.aafUrl = aafUrl;
- }
-
- public String getCadiX509Issuers() {
- return cadiX509Issuers;
- }
-
- public void setCadiX509Issuers(String cadiX509Issuers) {
- this.cadiX509Issuers = cadiX509Issuers;
- }
-
- public Properties getProperties() {
- Properties prop = System.getProperties();
- //prop.put("cadi_prop_files", "");
- prop.put(CADI_KEY_FILE, keyFile);
- prop.put(CADI_LOG_LEVEL, cadiLoglevel);
- prop.put(LATITUDE, cadiLatitude);
- prop.put(LONGITUDE, cadiLongitude);
- prop.put(LOCATE_URL, aafLocateUrl);
- if (oauthTokenUrl != null) {
- prop.put(OAUTH_TOKEN_URL, oauthTokenUrl);
- }
- if (oauthIntrospectUrl != null) {
- prop.put(OAUTH_INTROSPECT_URL, oauthIntrospectUrl);
- }
- prop.put(AAF_ENV, aafEnv);
- prop.put(AAF_URL, aafUrl);
- prop.put(X509_ISSUERS, cadiX509Issuers);
- return prop;
- }
} \ No newline at end of file
diff --git a/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java b/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java
deleted file mode 100644
index 6a97f2356..000000000
--- a/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-package org.onap.clamp.clds.config;
-
-import org.springframework.context.annotation.Configuration;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Value;
-
-@Configuration
-public class SSLConfiguration {
- private static final String TRUST_STORE = "javax.net.ssl.trustStore";
- private static final String TRUST_STORE_PW = "javax.net.ssl.trustStorePassword";
- private static final String TRUST_STORE_TYPE = "javax.net.ssl.trustStoreType";
-
- @Value("${server.ssl.trust:none}")
- private String sslTruststoreFile;
- @Value("${server.ssl.trust-password:none}")
- private String sslTruststorePw;
- @Value("${server.ssl.trust-type:none}")
- private String sslTruststoreType;
-
- @PostConstruct
- private void configureSSL() {
- if (!sslTruststoreFile.equals("none")) {
- System.setProperty(TRUST_STORE, sslTruststoreFile);
- }
- if (!sslTruststoreType.equals("none")) {
- System.setProperty(TRUST_STORE_TYPE, sslTruststoreType);
- }
- if (!sslTruststorePw.equals("none")) {
- System.setProperty(TRUST_STORE_PW, sslTruststorePw);
- }
- }
-}
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
index ed3dcb46a..f058a9e6a 100644
--- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
+++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
@@ -22,59 +22,122 @@
*/
package org.onap.clamp.clds.filter;
-import java.util.Properties;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.StandardCopyOption;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
+import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.filter.CadiFilter;
-import org.onap.clamp.clds.config.AAFConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
public class ClampCadiFilter extends CadiFilter {
- private static final String CADI_TRUST_STORE = "cadi_truststore";
- private static final String CADI_TRUST_STORE_PW = "cadi_truststore_password";
- private static final String CADI_KEY_STORE = "cadi_keystore";
- private static final String CADI_KEY_STORE_PW = "cadi_keystore_password";
- private static final String ALIAS = "cadi_alias";
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ClampCadiFilter.class);
+
+ @Autowired
+ private ApplicationContext appContext;
- @Value("${server.ssl.key-store:none}")
- private String keyStore;
+ @Value("${server.ssl.key-store:#{null}}")
+ private String keyStore;
- @Value("${clamp.config.cadi.cadiKeystorePassword:none}")
- private String keyStorePass;
+ @Value("${clamp.config.cadi.cadiKeystorePassword:#{null}}")
+ private String keyStorePass;
- @Value("${server.ssl.trust:none}")
- private String trustStore;
+ @Value("${server.ssl.trust-store:#{null}}")
+ private String trustStore;
- @Value("${clamp.config.cadi.cadiTruststorePassword:none}")
- private String trustStorePass;
+ @Value("${clamp.config.cadi.cadiTruststorePassword:#{null}}")
+ private String trustStorePass;
@Value("${server.ssl.key-alias:clamp@clamp.onap.org}")
- private String alias;
+ private String alias;
- @Autowired
- private AAFConfiguration aafConfiguration;
+ @Value("${clamp.config.cadi.keyFile:#{null}}")
+ private String keyFile;
+
+ @Value("${clamp.config.cadi.cadiLoglevel:#{null}}")
+ private String cadiLoglevel;
+
+ @Value("${clamp.config.cadi.cadiLatitude:#{null}}")
+ private String cadiLatitude;
+
+ @Value("${clamp.config.cadi.cadiLongitude:#{null}}")
+ private String cadiLongitude;
+
+ @Value("${clamp.config.cadi.aafLocateUrl:#{null}}")
+ private String aafLocateUrl;
+
+ @Value("${clamp.config.cadi.oauthTokenUrl:#{null}}")
+ private String oauthTokenUrl;
+
+ @Value("${clamp.config.cadi.oauthIntrospectUrl:#{null}}")
+ private String oauthIntrospectUrl;
+
+ @Value("${clamp.config.cadi.aafEnv:#{null}}")
+ private String aafEnv;
+
+ @Value("${clamp.config.cadi.aafUrl:#{null}}")
+ private String aafUrl;
+
+ @Value("${clamp.config.cadi.cadiX509Issuers:#{null}}")
+ private String cadiX509Issuers;
+
+ private void checkIfNullProperty(String key, String value) {
+ /* When value is null, so not defined in application.properties
+ set nothing in System properties */
+ if (value != null) {
+ /* Ensure that any properties already defined in System.prop by JVM params
+ won't be overwritten by Spring application.properties values */
+ System.setProperty(key, System.getProperty(key, value));
+ }
+ }
@Override
public void init(FilterConfig filterConfig) throws ServletException {
- Properties props = aafConfiguration.getProperties();
- props.setProperty(CADI_KEY_STORE, trimFileName(keyStore));
- props.setProperty(CADI_TRUST_STORE, trimFileName(trustStore));
- props.setProperty(ALIAS, alias);
- props.setProperty(CADI_KEY_STORE_PW, keyStorePass);
- props.setProperty(CADI_TRUST_STORE_PW, trustStorePass);
+ // set some properties in System so that Cadi filter will find its config
+ // The JVM values set will always overwrite the Spring ones.
+ checkIfNullProperty(Config.CADI_KEYFILE, convertSpringToPath(keyFile));
+ checkIfNullProperty(Config.CADI_LOGLEVEL, cadiLoglevel);
+ checkIfNullProperty(Config.CADI_LATITUDE, cadiLatitude);
+ checkIfNullProperty(Config.CADI_LONGITUDE, cadiLongitude);
+
+ checkIfNullProperty(Config.AAF_LOCATE_URL, aafLocateUrl);
+ checkIfNullProperty(Config.AAF_OAUTH2_TOKEN_URL, oauthTokenUrl);
+ checkIfNullProperty(Config.AAF_OAUTH2_INTROSPECT_URL, oauthIntrospectUrl);
+
+ checkIfNullProperty(Config.AAF_ENV, aafEnv);
+ checkIfNullProperty(Config.AAF_URL, aafUrl);
+ checkIfNullProperty(Config.CADI_X509_ISSUERS, cadiX509Issuers);
+ checkIfNullProperty(Config.CADI_KEYSTORE, convertSpringToPath(keyStore));
+ checkIfNullProperty(Config.CADI_TRUSTSTORE, convertSpringToPath(trustStore));
+ checkIfNullProperty(Config.CADI_ALIAS, alias);
+ checkIfNullProperty(Config.CADI_KEYSTORE_PASSWORD, keyStorePass);
+ checkIfNullProperty(Config.CADI_TRUSTSTORE_PASSWORD, trustStorePass);
super.init(filterConfig);
}
- private String trimFileName (String fileName) {
- int index= fileName.indexOf("file:");
- if (index == -1) {
- return fileName;
- } else {
- return fileName.substring(index+5);
+ private String convertSpringToPath(String fileName) {
+ try (InputStream ioFile = appContext.getResource(fileName).getInputStream()) {
+ if (!fileName.contains("file:")) {
+ File targetFile = new File(appContext.getResource(fileName).getFilename());
+ java.nio.file.Files.copy(ioFile, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ return targetFile.getPath();
+ } else {
+ return appContext.getResource(fileName).getFile().getPath();
+ }
+ } catch (IOException e) {
+ logger.error("Unable to open and copy the file: " + fileName, e);
+ return null;
}
+
}
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index 2139b3d39..bc58ee69f 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -74,7 +74,7 @@ import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
import org.onap.clamp.clds.transform.XslTransformer;
import org.onap.clamp.clds.util.JacksonUtils;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.clamp.clds.util.ONAPLogConstants;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
index cca0afded..d82e7c6e7 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
@@ -33,7 +33,7 @@ import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsTemplate;
import org.onap.clamp.clds.model.ValueItem;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.clamp.clds.util.ONAPLogConstants;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
index a20a70040..cdb2e29c5 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -45,7 +45,6 @@ import org.slf4j.event.Level;
import org.springframework.security.core.context.SecurityContextHolder;
import org.onap.clamp.clds.service.DefaultUserNameHandler;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
/**
* This class handles the special info that appear in the log, like RequestID,
@@ -58,8 +57,6 @@ public class LoggingUtils {
/** String constant for messages <tt>ENTERING</tt>, <tt>EXITING</tt>, etc. */
private static final String EMPTY_MESSAGE = "";
- private static final String INVOCATIONID_OUT = "InvocationIDOut";
- private static final String TARGET_ENTITY = "TargetEngity";
/** Logger delegate. */
private EELFLogger mLogger;
@@ -209,8 +206,8 @@ public class LoggingUtils {
serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
}
-
- this.mLogger.info("ENTRY");
+
+ this.mLogger.info(ONAPLogConstants.Markers.ENTRY);
}
/**
@@ -224,7 +221,7 @@ public class LoggingUtils {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, defaultToEmpty(descrption));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_SEVERITY, defaultToEmpty(severity));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, defaultToEmpty(status));
- this.mLogger.info("EXIT");
+ this.mLogger.info(ONAPLogConstants.Markers.EXIT);
}
finally {
MDC.clear();
@@ -255,13 +252,13 @@ public class LoggingUtils {
// Log INVOKE*, with the invocationID as the message body.
// (We didn't really want this kind of behavior in the standard,
// but is it worse than new, single-message MDC?)
- this.mLogger.info("INVOKE");
- this.mLogger.info("INVOKE-" + ONAPLogConstants.InvocationMode.SYNCHRONOUS.toString() + "{"+ invocationID +"}");
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{"+ invocationID +"}");
return con;
}
public void invokeReturn() {
// Add the Invoke-return marker and clear the needed MDC
- this.mLogger.info("INVOKE-RETURN");
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
invokeReturnContext();
}
@@ -313,9 +310,9 @@ public class LoggingUtils {
* @param invocationId The invocation ID
*/
private void invokeContext (String targetEntity, String targetServiceName, String invocationID) {
- MDC.put(TARGET_ENTITY, defaultToEmpty(targetEntity));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, defaultToEmpty(targetEntity));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, defaultToEmpty(targetServiceName));
- MDC.put(INVOCATIONID_OUT, invocationID);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATIONID_OUT, invocationID);
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
ZonedDateTime.now(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_INSTANT));
@@ -326,8 +323,8 @@ public class LoggingUtils {
*
*/
private void invokeReturnContext () {
- MDC.remove(TARGET_ENTITY);
+ MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(INVOCATIONID_OUT);
+ MDC.remove(ONAPLogConstants.MDCs.INVOCATIONID_OUT);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
new file mode 100644
index 000000000..eea01a39a
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
@@ -0,0 +1,192 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.util;
+
+/**
+ * Constants for standard ONAP headers, MDCs, etc.
+ */
+public final class ONAPLogConstants {
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Constructors.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Hide and forbid construction.
+ */
+ private ONAPLogConstants() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Marker constants.
+ */
+ public static final class Markers {
+
+ /** Marker reporting invocation. */
+ public static final String INVOKE = "INVOKE";
+
+ /** Marker reporting synchronous invocation. */
+ public static final String INVOKE_RETURN = "INVOKE-RETURN";
+
+ /** Marker reporting synchronous invocation. */
+ public static final String INVOKE_SYNC = "INVOKE-SYNCHRONOUS";
+
+ /** Marker reporting entry into a component. */
+ public static final String ENTRY = "ENTRY";
+
+ /** Marker reporting exit from a component. */
+ public static final String EXIT = "EXIT";
+
+ /**
+ * Hide and forbid construction.
+ */
+ private Markers() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * MDC name constants.
+ */
+ public static final class MDCs {
+
+ // Tracing. ////////////////////////////////////////////////////////////
+
+ /** MDC correlating messages for an invocation. */
+ public static final String INVOCATION_ID = "InvocationID";
+
+ /** MDC correlating messages for a logical transaction. */
+ public static final String REQUEST_ID = "RequestID";
+
+ /** MDC recording calling service. */
+ public static final String PARTNER_NAME = "PartnerName";
+
+ /** MDC recording current service. */
+ public static final String SERVICE_NAME = "ServiceName";
+
+ /** MDC recording target service. */
+ public static final String TARGET_SERVICE_NAME = "TargetServiceName";
+
+ /** MDC recording InvocationID Out. */
+ public static final String INVOCATIONID_OUT = "InvocationIDOut";
+
+ /** MDC recording target entity. */
+ public static final String TARGET_ENTITY = "TargetEngity";
+
+ /** MDC recording current service instance. */
+ public static final String INSTANCE_UUID = "InstanceUUID";
+
+ // Network. ////////////////////////////////////////////////////////////
+
+ /** MDC recording caller address. */
+ public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";
+
+ /** MDC recording server address. */
+ public static final String SERVER_FQDN = "ServerFQDN";
+
+ /**
+ * MDC recording timestamp at the start of the current request,
+ * with the same scope as {@link #REQUEST_ID}.
+ *
+ * <p>Open issues:
+ * <ul>
+ * <ul>Easily confused with {@link #INVOKE_TIMESTAMP}.</ul>
+ * <ul>No mechanism for propagation between components, e.g. via HTTP headers.</ul>
+ * <ul>Whatever mechanism we define, it's going to be costly.</ul>
+ * </ul>
+ * </p>
+ * */
+ public static final String ENTRY_TIMESTAMP = "EntryTimestamp";
+
+ /** MDC recording timestamp at the start of the current invocation. */
+ public static final String INVOKE_TIMESTAMP = "InvokeTimestamp";
+
+ // Outcomes. ///////////////////////////////////////////////////////////
+
+ /** MDC reporting outcome code. */
+ public static final String RESPONSE_CODE = "ResponseCode";
+
+ /** MDC reporting outcome description. */
+ public static final String RESPONSE_DESCRIPTION = "ResponseDescription";
+
+ /** MDC reporting outcome error level. */
+ public static final String RESPONSE_SEVERITY = "Severity";
+
+ /** MDC reporting outcome error level. */
+ public static final String RESPONSE_STATUS_CODE = "StatusCode";
+
+ // Unsorted. ///////////////////////////////////////////////////////////
+
+ /**
+ * Hide and forbid construction.
+ */
+ private MDCs() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Header name constants.
+ */
+ public static final class Headers {
+
+ /** HTTP <tt>X-ONAP-RequestID</tt> header. */
+ public static final String REQUEST_ID = "X-ONAP-RequestID";
+
+ /** HTTP <tt>X-ONAP-InvocationID</tt> header. */
+ public static final String INVOCATION_ID = "X-ONAP-InvocationID";
+
+ /** HTTP <tt>X-ONAP-PartnerName</tt> header. */
+ public static final String PARTNER_NAME = "X-ONAP-PartnerName";
+
+ /**
+ * Hide and forbid construction.
+ */
+ private Headers() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Enums.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Response success or not, for setting <tt>StatusCode</tt>.
+ */
+ public enum ResponseStatus {
+
+ /** Success. */
+ COMPLETED,
+
+ /** Not. */
+ ERROR,
+ }
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 552efbc7c..b5069159f 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -55,15 +55,19 @@ info.build.version=@project.version@
### HTTP (Redirected to HTTPS) and HTTPS Example:
### --------------------------------------------
server.port=8443
-server.ssl.client-auth=want
-server.ssl.key-store=file:/opt/clamp/config/org.onap.clamp.p12
+## Config part for Server certificates
+# Can be a classpath parameter instead of file:/
+server.ssl.key-store=classpath:/clds/aaf/org.onap.clamp.p12
server.ssl.key-store-password=China in the Spring
server.ssl.key-password=China in the Spring
server.ssl.key-store-type=PKCS12
-server.ssl.trust=/opt/clamp/config/truststoreONAPall.jks
-server.ssl.trust-pass=changeit
-server.ssl.trust-type=JKS
server.ssl.key-alias=clamp@clamp.onap.org
+
+## Config part for Client certificates
+server.ssl.client-auth=need
+server.ssl.trust-store=classpath:/clds/aaf/truststoreONAPall.jks
+server.ssl.trust-store-password=changeit
+
server.http-to-https-redirection.port=8080
server.servlet.context-path=/
@@ -228,7 +232,7 @@ clamp.config.security.permission.type.template=org.onap.clamp.clds.template
clamp.config.security.permission.instance=dev
#AAF related parameters
-clamp.config.cadi.keyFile=/opt/clamp/config/org.onap.clamp.keyfile
+clamp.config.cadi.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
clamp.config.cadi.cadiLoglevel=DEBUG
clamp.config.cadi.cadiLatitude=37.78187
clamp.config.cadi.cadiLongitude=-122.26147
diff --git a/src/main/resources/logback-default.xml b/src/main/resources/logback-default.xml
index 7e8eba5da..c2524bec2 100644
--- a/src/main/resources/logback-default.xml
+++ b/src/main/resources/logback-default.xml
@@ -10,17 +10,15 @@
<property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
<property name="p_thr" value="%thread"/>
<property name="defaultPattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
+ <property name="debugPattern" value="%nopexception${p_tim}|${p_lvl}|${p_mdc}|${p_exc}|%msg%n"/>
<!-- Example evaluator filter applied against console appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <!-- filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level>
- <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter -->
- <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
- <pattern>${defaultPattern}</pattern>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
</encoder>
</appender>
@@ -51,7 +49,7 @@
<file>${logDirectory}/debug.log</file>
<append>true</append>
<encoder>
- <pattern>${defaultPattern}</pattern>
+ <pattern>${debugPattern}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${outputDirectory}/clamp/debug.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
@@ -180,7 +178,6 @@
<logger name="ch.qos.logback.core" level="INFO" />
<!-- logback jms appenders & loggers definition starts here -->
- <!-- logback jms appenders & loggers definition starts here -->
<appender name="auditLogs"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties
index a24b6202e..f95fc7009 100644
--- a/src/main/resources/system.properties
+++ b/src/main/resources/system.properties
@@ -5,22 +5,23 @@
# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
# reserved.
# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END============================================
# ===================================================================
-#
-###
+#
+### Static JVM parameters can be set here by the dev team
+### These will be loaded at Clamp startup
#
# JVM SSL/TLS properties
-jdk.tls.client.protocols=TLSv1.1,TLSv1.2
+jdk.tls.client.protocols=TLSv1.1,TLSv1.2
https.protocols=TLSv1.1,TLSv1.2