summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-annotations/src/main/java/org/onap/aai/annotations/Metadata.java1
-rw-r--r--aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java12
-rw-r--r--aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java4
-rw-r--r--aai-queries/src/main/java/org/onap/aai/queries/CustomQueryConfig.java53
-rw-r--r--aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java149
-rw-r--r--aai-queries/src/main/java/org/onap/aai/queries/GremlinServerSingleton.java117
-rw-r--r--aai-queries/src/main/resources/etc/appprops/error.properties167
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java132
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java230
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java96
-rw-r--r--aai-queries/src/test/resources/application-onap-test.properties33
-rw-r--r--aai-queries/src/test/resources/application-test.properties34
-rw-r--r--aai-queries/src/test/resources/logback.xml81
-rw-r--r--aai-queries/src/test/resources/schema-ingest.properties10
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java12
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java9
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java2
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java50
-rw-r--r--aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java14
-rw-r--r--aai-schema-service/pom.xml2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java56
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/AuthorizationConfiguration.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java6
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/PropertyPasswordConfiguration.java90
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java6
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResetLoggingContext.java96
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResponseTransactionLogging.java25
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/HeaderValidation.java65
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/SetLoggingContext.java69
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/TwoWaySslAuthorization.java187
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java6
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java6
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryService.java6
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/service/AuthorizationService.java8
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java49
-rw-r--r--aai-schema-service/src/main/resources/etc/appprops/error.properties295
-rw-r--r--aai-schema-service/src/main/resources/logback.xml112
-rw-r--r--aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java4
-rw-r--r--aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java6
-rw-r--r--aai-schema-service/src/test/resources/etc/appprops/aaiconfig.properties0
-rw-r--r--aai-schema-service/src/test/resources/logback.xml243
-rw-r--r--aai-schema/pom.xml4
-rw-r--r--aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java556
-rw-r--r--pom.xml2
48 files changed, 2169 insertions, 982 deletions
diff --git a/aai-annotations/src/main/java/org/onap/aai/annotations/Metadata.java b/aai-annotations/src/main/java/org/onap/aai/annotations/Metadata.java
index d9e9f0f..b915ee5 100644
--- a/aai-annotations/src/main/java/org/onap/aai/annotations/Metadata.java
+++ b/aai-annotations/src/main/java/org/onap/aai/annotations/Metadata.java
@@ -52,5 +52,6 @@ public @interface Metadata {
String containsSuggestibleProps() default "";
String suggestionAliases() default "";
String sourceOfTruthType() default "";
+ String dslStartNodeProps() default "";
}
diff --git a/aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java b/aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java
index 39cfdec..6b68e1f 100644
--- a/aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java
+++ b/aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java
@@ -117,9 +117,15 @@ public enum ObjectMetadata {
/**
* a value of true allows this object to be written directly
*/
- ALLOW_DIRECT_WRITE("allowDirectWrite");
-
- private final String name;
+ ALLOW_DIRECT_WRITE("allowDirectWrite"),
+ /**
+ * properties that are allowed to be in start node in a DSL
+ * <br><b>comma separated list</b>
+ */
+ DSL_START_NODE_PROPS("dslStartNodeProps");
+
+
+ private final String name;
private ObjectMetadata(String name) {
this.name = name;
diff --git a/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java b/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
index a518e0c..c6bd03c 100644
--- a/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
+++ b/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
@@ -42,7 +42,9 @@ public class AnnotationsTest {
isAbstract = "",
alternateKeys1 = "",
maximumDepth = "",
- crossEntityReference = "")
+ crossEntityReference = "",
+ dslStartNodeProps = "")
+
public void testAnnotation() {
}
}
diff --git a/aai-queries/src/main/java/org/onap/aai/queries/CustomQueryConfig.java b/aai-queries/src/main/java/org/onap/aai/queries/CustomQueryConfig.java
new file mode 100644
index 0000000..5a58923
--- /dev/null
+++ b/aai-queries/src/main/java/org/onap/aai/queries/CustomQueryConfig.java
@@ -0,0 +1,53 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import java.util.List;
+
+public class CustomQueryConfig {
+ public CustomQueryConfig() {
+ // used by GetCustomQueryConfig
+ }
+
+
+ private String query;
+ private List<String> queryOptionalProperties;
+ private List<String> queryRequiredProperties;
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQueryOptionalProperties( List<String> queryOptionalProperties) {
+ this.queryOptionalProperties = queryOptionalProperties;
+ }
+ public List<String> getQueryOptionalProperties( ) {
+ return queryOptionalProperties;
+ }
+ public void setQueryRequiredProperties( List<String> queryRequiredProperties) {
+ this.queryRequiredProperties = queryRequiredProperties;
+ }
+ public List<String> getQueryRequiredProperties( ) {
+ return queryRequiredProperties;
+ }
+}
diff --git a/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java b/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java
new file mode 100644
index 0000000..ed4ff99
--- /dev/null
+++ b/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java
@@ -0,0 +1,149 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+public class GetCustomQueryConfig {
+
+ private JsonArray storedQueries = null;
+ private CustomQueryConfig customQueryConfig;
+
+
+ private final static String QUERY_CONFIG = "query";
+ private final static String REQUIRED_CONFIG = "required-properties";
+ private final static String OPTIONAL_CONFIG = "optional-properties";
+ private final static String STORED_QUERIES_CONFIG = "stored-queries";
+ private final static String STORED_QUERY_CONFIG = "stored-query";
+
+// public static final String AAI_HOME_ETC_QUERY_JSON = AAIConstants.AAI_HOME_ETC + "query" + AAIConstants.AAI_FILESEP + "stored-queries.json";
+
+ public GetCustomQueryConfig(String customQueryJson ) {
+ init(customQueryJson);
+ }
+
+ private void init( String customQueryJson) {
+ JsonParser parser = new JsonParser();
+ JsonObject queriesObject = parser.parse(customQueryJson).getAsJsonObject();
+ if (queriesObject.has(STORED_QUERIES_CONFIG)) {
+
+ storedQueries = queriesObject.getAsJsonArray(STORED_QUERIES_CONFIG);
+ }
+ }
+
+ private List<String> toStringList(JsonArray array) {
+ Gson converter = new Gson();
+ Type listType = new TypeToken<List<String>>() {}.getType();
+ return converter.fromJson(array, listType);
+ }
+
+ private List<String> getPropertyList(JsonObject configObject, String config ) {
+ JsonElement subqueryConfig;
+ JsonArray props;
+
+ if ( configObject.has(config)) {
+ subqueryConfig = configObject.get(config);
+ if ( subqueryConfig != null && !subqueryConfig.isJsonNull() ) {
+ props = subqueryConfig.getAsJsonArray();
+ if ( props != null ) {
+ return toStringList(props);
+ }
+ }
+ }
+ return toStringList(null);
+ }
+
+ private String getPropertyString(JsonObject configObject, String config) {
+ JsonElement subqueryConfig;
+
+ if ( configObject.has(config)) {
+ subqueryConfig = configObject.get(config);
+ if ( subqueryConfig != null && !subqueryConfig.isJsonNull() ) {
+ return subqueryConfig.getAsString();
+ }
+ }
+ return null;
+ }
+
+ private void getStoredQueryBlock( JsonObject configObject, String config ) {
+ if ( !configObject.has(config)) {
+ customQueryConfig.setQueryRequiredProperties( new ArrayList<String>() );
+ customQueryConfig.setQueryOptionalProperties( new ArrayList<String>() );
+ return;
+ }
+
+ JsonElement queryConfig;
+ JsonObject subObject;
+ String multipleStartNodes;
+ List<String> propertyList;
+
+ queryConfig = configObject.get(config);
+ subObject = queryConfig.getAsJsonObject();
+ propertyList = getPropertyList(subObject, REQUIRED_CONFIG);
+ if ( propertyList == null ) {
+ propertyList = new ArrayList<String>();
+ }
+ customQueryConfig.setQueryRequiredProperties( propertyList );
+ propertyList = getPropertyList(subObject, OPTIONAL_CONFIG);
+ if ( propertyList == null ) {
+ propertyList = new ArrayList<String>();
+ }
+ customQueryConfig.setQueryOptionalProperties( propertyList );
+
+ }
+
+
+ public CustomQueryConfig getStoredQuery(String queryName ) {
+
+ customQueryConfig = null;
+ JsonObject configObject;
+ JsonElement query;
+ JsonElement queryConfig;
+ String queryString;
+
+ for (JsonElement storedQuery : storedQueries) {
+ if (storedQuery.isJsonObject()) {
+ JsonObject queryObject = storedQuery.getAsJsonObject();
+ query = queryObject.get(queryName);
+ if ( query != null ) {
+ customQueryConfig = new CustomQueryConfig();
+ configObject = query.getAsJsonObject();
+ getStoredQueryBlock(configObject, QUERY_CONFIG);
+ if ( configObject.has(STORED_QUERY_CONFIG)) {
+ queryConfig = configObject.get(STORED_QUERY_CONFIG);
+ customQueryConfig.setQuery(queryConfig.getAsString());
+ }
+ break;
+ }
+ }
+ }
+
+ return customQueryConfig;
+
+ }
+
+
+
+}
diff --git a/aai-queries/src/main/java/org/onap/aai/queries/GremlinServerSingleton.java b/aai-queries/src/main/java/org/onap/aai/queries/GremlinServerSingleton.java
new file mode 100644
index 0000000..3b4a406
--- /dev/null
+++ b/aai-queries/src/main/java/org/onap/aai/queries/GremlinServerSingleton.java
@@ -0,0 +1,117 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.onap.aai.aaf.auth.FileWatcher;
+import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.util.AAIConstants;
+
+import org.springframework.beans.factory.annotation.Value;
+import javax.annotation.PostConstruct;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class GremlinServerSingleton {
+
+ private static Logger logger = LoggerFactory.getLogger(GremlinServerSingleton.class);
+
+ private boolean timerSet;
+ private Timer timer;
+
+ private GetCustomQueryConfig queryConfig;
+
+ @Value("${schema.queries.location}")
+ private String storedQueriesLocation;
+
+ /**
+ * Initializes the gremlin server singleton
+ * Loads the configuration of the gremlin server and creates a cluster
+ * Loads the gremlin query file into the properties object
+ * Then creates a file watcher to watch the file every ten seconds
+ * and if there is a change in the file, then reloads the file into
+ * the properties object
+ *
+ */
+ @PostConstruct
+ public void init() {
+
+ try {
+ String filepath = storedQueriesLocation + AAIConstants.AAI_FILESEP + "stored-queries.json";
+ Path path = Paths.get(filepath);
+ String customQueryConfigJson = new String(Files.readAllBytes(path));
+
+
+ queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
+ } catch (IOException e) {
+ logger.error("Error occurred during the processing of query json file: " + LogFormatTools.getStackTop(e));
+ }
+
+
+ TimerTask task = new FileWatcher(new File(storedQueriesLocation)) {
+ @Override
+ protected void onChange(File file) {
+ try {
+ String filepath = storedQueriesLocation;
+ Path path = Paths.get(filepath);
+ String customQueryConfigJson = new String(Files.readAllBytes(path));
+ queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
+ } catch (IOException e) {
+ logger.error("Error occurred during the processing of query json file: " + LogFormatTools.getStackTop(e));
+ }
+ }
+ };
+
+ if (!timerSet) {
+ timerSet = true;
+ timer = new Timer();
+ timer.schedule( task , new Date(), 10000 );
+ }
+
+ }
+
+ /**
+ * Gets the query using CustomQueryConfig
+ * @param key
+ * @return
+ */
+ public String getStoredQueryFromConfig(String key){
+ CustomQueryConfig customQueryConfig = queryConfig.getStoredQuery(key);
+ if ( customQueryConfig == null ) {
+ return null;
+ }
+ return customQueryConfig.getQuery();
+ }
+
+ public CustomQueryConfig getCustomQueryConfig(String key) {
+ return queryConfig.getStoredQuery(key);
+ }
+
+
+}
diff --git a/aai-queries/src/main/resources/etc/appprops/error.properties b/aai-queries/src/main/resources/etc/appprops/error.properties
new file mode 100644
index 0000000..fc8bcde
--- /dev/null
+++ b/aai-queries/src/main/resources/etc/appprops/error.properties
@@ -0,0 +1,167 @@
+# Adding comment trying to trigger a build
+#------------------------------------------------------------------------------- ----------
+#Key=Disposition:Category:Severity:Error Code:HTTP ResponseCode:RESTError Code:Error Message
+#------------------------------------------------------------------------------- ----------
+# testing code, please don't change unless error utility source code changes
+AAI_TESTING=5:2:WARN:0000:400:0001:Error code for testing
+# General success
+AAI_0000=0:0:INFO:0000:200:0000:Success
+# health check success
+AAI_0001=0:0:INFO:0001:200:0001:Success X-FromAppId=%1 X-TransactionId=%2
+AAI_0002=0:0:INFO:0002:200:0001:Successful health check
+# Success with additional info
+AAI_0003=0:3:INFO:0003:202:0003:Success with additional info performing %1 on %2. Added %3 with key %4
+AAI_0004=0:3:INFO:0004:202:0003:Added prerequisite object to db
+#--- aairest: 3000-3299
+# svc errors
+AAI_3000=5:2:INFO:3000:400:3000:Invalid input performing %1 on %2
+AAI_3001=5:6:INFO:3001:404:3001:Resource not found for %1 using id %2
+AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2
+AAI_3003=5:1:WARN:3003:400:3003:Failed to make edge to missing target node of type %3 with keys %4 performing %1 on %2
+AAI_3005=5:6:WARN:3005:404:3001:Node cannot be directly accessed for read, must be accessed via ancestor(s)
+AAI_3006=5:6:WARN:3006:404:3001:Node cannot be directly accessed for write, must be accessed via ancestor(s)
+AAI_3007=5:6:INFO:3007:410:3007:This version (%1) of the API is retired, please migrate to %2
+AAI_3008=5:6:WARN:3008:400:3008:URI is not encoded in UTF-8
+AAI_3009=5:6:WARN:3009:400:3002:Malformed URL
+AAI_3010=5:6:WARN:3010:400:3002:Cannot write via this URL
+AAI_3011=5:6:WARN:3011:400:3000:Unknown XML namespace used in payload
+AAI_3012=5:6:WARN:3012:400:3012:Unrecognized AAI function
+AAI_3013=5:6:WARN:3013:400:3013:Query payload missing required parameters %1
+AAI_3014=5:6:WARN:3014:400:3014:Query payload is invalid %1
+AAI_3015=5:6:INFO:3015:410:3015:The %1 capability is retired, please contact the A&AI SE team to identify a replacement query
+AAI_3016=5:6:INFO:3007:400:3016:Request uri is not valid, please check the version %1
+AAI_3017=5:6:INFO:3007:400:3016:Request uri is not valid, please check the uri %1
+AAI_3018=5:6:INFO:3018:400:3018:Request schema version %1 is not valid, please check the schema version
+AAI_3050=5:1:WARN:3002:400:3002:Invalid request, missing or empty query parameter version
+AAI_3051=5:1:WARN:3002:400:3002:Invalid request, version parameter %1 passed is not conforming to the following pattern v[1-9][0-9]*
+# pol errors
+AAI_3100=5:1:WARN:3100:400:3100:Unsupported operation %1
+AAI_3101=5:1:WARN:3101:403:3101:Attempt by client %1 to execute API %2
+AAI_3102=5:1:WARN:3102:400:3102:Error parsing input performing %1 on %2
+AAI_3300=5:1:WARN:3300:403:3300:Unauthorized
+AAI_3301=5:1:WARN:3301:401:3301:Stale credentials
+AAI_3302=5:1:WARN:3302:401:3301:Not authenticated
+AAI_3303=5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry
+#--- aaigen: 4000-4099
+AAI_4000=5:4:ERROR:4000:500:3002:Internal Error
+AAI_4001=5:4:FATAL:4001:500:3002:Configuration file not found
+AAI_4002=5:4:FATAL:4002:500:3002:Error reading Configuration file
+AAI_4003=5:4:ERROR:4003:500:3002:Error writing to log file
+AAI_4004=5:4:FATAL:4004:500:3002:Error reading/parsing the error properties file
+AAI_4005=5:4:FATAL:4005:500:3002:Missing or invalid configuration parameter
+AAI_4006=5:4:FATAL:4006:500:3002:Unexpected error in service
+AAI_4007=5:4:WARN:4007:500:3102:Input parsing error
+AAI_4008=5:4:ERROR:4008:500:3002:Output parsing error
+AAI_4009=4:0:WARN:4009:400:3000:Invalid X-FromAppId in header
+AAI_4010=4:0:WARN:4010:400:3000:Invalid X-TransactionId in header
+AAI_4011=5:4:ERROR:4011:500:3002:Missing data for REST error response
+AAI_4014=4:0:WARN:4014:400:3000:Invalid Accept header
+AAI_4015=4:0:WARN:4015:400:3000:You must provide at least one indexed property
+AAI_4016=4:0:WARN:4016:400:3000:The depth parameter must be a number or the string "all"
+AAI_4017=5:2:INFO:4017:400:3000:Could not set property
+AAI_4018=5:2:WARN:4018:400:3000:Unable to convert the string to integer
+#--- aaidbmap: 5102-5199
+AAI_5102=5:4:FATAL:5102:500:3002:Graph database is null after open
+AAI_5105=5:4:ERROR:5105:500:3002:Unexpected error reading/updating database
+AAI_5106=5:4:WARN:5106:404:3001:Node not found
+AAI_5107=5:2:WARN:5107:400:3000:Required information missing
+AAI_5108=5:2:WARN:5108:200:0:Unexpected information in request being ignored
+#--- aaidbgen: 6101-6199
+AAI_6101=5:4:ERROR:6101:500:3002:null JanusGraph object passed
+AAI_6102=5:4:WARN:6102:400:3000:Passed-in property is not valid for this nodeType
+AAI_6103=5:4:WARN:6103:400:3000:Required Node-property not found in input data
+AAI_6104=5:4:WARN:6104:400:3000:Required Node-property was passed with no data
+AAI_6105=5:4:WARN:6105:400:3000:Node-Key-Property not defined in DbMaps
+AAI_6106=5:4:WARN:6106:400:3000:Passed-in property is not valid for this edgeType
+AAI_6107=5:4:WARN:6107:400:3000:Required Edge-property not found in input data
+AAI_6108=5:4:WARN:6108:400:3000:Required Edge-property was passed with no data
+AAI_6109=5:4:WARN:6109:400:3000:Bad dependent Node value
+AAI_6110=5:4:ERROR:6110:400:3100:Node cannot be deleted
+AAI_6111=5:4:WARN:6111:400:3000:JSON processing error
+AAI_6112=5:4:ERROR:6112:400:3000:More than one node found by getUniqueNode()
+AAI_6114=5:4:INFO:6114:404:3001:Node Not Found
+AAI_6115=5:4:ERROR:6115:400:3000:Unrecognized NodeType
+AAI_6116=5:4:ERROR:6116:400:3000:Unrecognized Property
+AAI_6117=5:4:ERROR:6117:400:3000:Uniqueness constraint violated
+AAI_6118=5:4:WARN:6118:400:3000:Required Field not passed.
+AAI_6120=5:4:WARN:6120:400:3000:Bad Parameter Passed
+AAI_6121=5:4:ERROR:6121:400:3000:Problem with internal AAI reference data
+AAI_6122=5:4:ERROR:6122:400:3000:Data Set not complete in DB for this request
+AAI_6123=5:4:ERROR:6123:500:3000:Bad Data found by DataGrooming Tool - Investigate
+AAI_6124=5:4:ERROR:6124:500:3000:File read/write error
+AAI_6125=5:4:WARN:6125:500:3000:Problem Pulling Data Set
+AAI_6126=5:4:ERROR:6126:400:3000:Edge cannot be deleted
+AAI_6127=5:4:INFO:6127:404:3001:Edge Not Found
+AAI_6128=5:4:INFO:6128:500:3000:Unexpected error
+AAI_6129=5:4:INFO:6129:404:3003:Error making edge to target node
+AAI_6130=5:4:WARN:6130:412:3000:Precondition Required
+AAI_6131=5:4:WARN:6131:412:3000:Precondition Failed
+AAI_6132=5:4:WARN:6132:400:3000:Bad Model Definition
+AAI_6133=5:4:WARN:6133:400:3000:Bad Named Query Definition
+AAI_6134=5:4:ERROR:6134:500:6134:Could not persist transaction to storage back end. Exhausted retry amount
+AAI_6135=5:4:WARN:6135:412:3000:Resource version specified on create
+AAI_6136=5:4:ERROR:6136:400:3000:Object cannot hold multiple items
+AAI_6137=5:4:ERROR:6137:400:3000:Cannot perform writes on multiple vertices
+AAI_6138=5:4:ERROR:6138:400:3000:Cannot delete multiple vertices
+AAI_6139=5:4:ERROR:6139:404:3000:Attempted to add edge to vertex that does not exist
+AAI_6140=5:4:ERROR:6140:400:3000:Edge multiplicity violated
+AAI_6141=5:4:WARN:6141:400:3000:Please Refine Query
+AAI_6142=5:4:INFO:6142:400:3000:Retrying transaction
+AAI_6143=5:4:INFO:6143:400:3000:Ghost vertex found
+AAI_6144=5:4:WARN:6144:400:3000:Cycle found in graph
+AAI_6145=5:4:ERROR:6145:400:3000:Cannot create a nested/containment edge via relationship
+AAI_6146=5:4:ERROR:6146:400:3000:Ambiguous identity map found, use a URI instead
+AAI_6147=5:4:ERROR:6147:400:3000:Payload Limit Reached, reduce payload
+#--- aaicsvp: 7101-7199
+AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing
+AAI_7102=5:4:ERROR:7102:500:3002:Error in cleanup temporary directory
+#AAI_7103=4:2:ERROR:7103:500:3002:Unsupported user
+AAI_7104=5:4:ERROR:7104:500:3002:Failed to create directory
+AAI_7105=5:4:ERROR:7105:500:3002:Temporary directory exists
+AAI_7106=5:4:ERROR:7106:500:3002:Cannot delete
+AAI_7107=5:4:ERROR:7107:500:3002:Input file does not exist
+AAI_7108=5:4:ERROR:7108:500:3002:Output file does not exist
+AAI_7109=5:4:ERROR:7109:500:3002:Error closing file
+AAI_7110=5:4:ERROR:7110:500:3002:Error loading/reading properties file
+AAI_7111=5:4:ERROR:7111:500:3002:Error executing shell script
+AAI_7112=5:4:ERROR:7112:500:3002:Error creating output file
+AAI_7113=5:4:ERROR:7113:500:3002:Trailer record error
+AAI_7114=5:4:ERROR:7114:500:3002:Input file error
+AAI_7115=5:4:ERROR:7115:500:3002:Unexpected error
+AAI_7116=5:4:ERROR:7116:500:3002:Request error
+AAI_7117=5:4:ERROR:7117:500:3002:Error in get http client object
+AAI_7118=5:4:ERROR:7118:500:3002:Script Error
+AAI_7119=5:4:ERROR:7119:500:3002:Unknown host
+#--- aaisdnc: 7201-7299
+AAI_7202=5:4:ERROR:7202:500:3002:Error getting connection to odl
+#AAI_7206=5:4:ERROR:7206:500:3002:Invalid data returned from ODL
+#--- NotificationEvent, using UEB space
+AAI_7350=5:4:ERROR:7305:500:3002:Notification event creation failed
+#--- aairestctlr: 7401-7499
+AAI_7401=5:4:ERROR:7401:500:3002:Error connecting to AAI REST API
+AAI_7402=5:4:ERROR:7402:500:3002:Unexpected error
+AAI_7403=5:4:WARN:7403:400:3001:Request error
+AAI_7404=5:4:INFO:7404:404:3001:Node not found
+AAI_7405=5:4:WARN:7405:200:0:UUID not formatted correctly, generating UUID
+AAI_7406=5:4:ERROR:7406:400:7406:Request Timed Out
+#--- aaicsiovals: 7501-7599
+#AAI_7501=5:4:WARN:7501:500:3002:Error getting connection to CSI-OVALS
+AAI_7502=5:4:WARN:7502:500:3002:Bad parameter when trying to build request for CSI-OVALS
+AAI_7503=5:4:WARN:7503:500:3002:Error returned by CSI-OVALS
+#--- aaiauth: 9101-9199
+AAI_9101=5:0:WARN:9101:403:3300:User is not authorized to perform function
+#AAI_9102=5:0:WARN:9102:401:3301:Refresh credentials from source
+#AAI_9103=5:0:WARN:9103:403:3300:User not found
+#AAI_9104=5:0:WARN:9104:401:3302:Authentication error
+#AAI_9105=5:0:WARN:9105:403:3300:Authorization error
+#AAI_9106=5:0:WARN:9106:403:3300:Invalid AppId
+#AAI_9107=5:0:WARN:9107:403:3300:No Username in Request
+AAI_9107=5:0:WARN:9107:403:3300:SSL is not provided in request, please contact admin
+AAI_9108=5:0:WARN:9107:403:3300:Basic auth credentials is not provided in the request
+#--- aaiinstar: 9201-9299
+#AAI_9201=5:4:ERROR:9201:500:3002:Unable to send notification
+AAI_9202=5:4:ERROR:9202:500:3002:Unable to start a thread
+#--- GRM DME2: 9501-9599
+AAI_9501=5:4:WARN:9501:500:3002:Unable to register with GRM retrying
+AAI_9502=5:4:ERROR:9502:500:3002:Unable to register with GRM after exhausting all retries
+AAI_9503=5:4:WARN:9503:500:3002:Unable to successfully unpublish with GRM, recommend manual cleanup but not necessary
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
new file mode 100644
index 0000000..551c10d
--- /dev/null
+++ b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
@@ -0,0 +1,132 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.onap.aai.config.IntrospectionConfig;
+import org.onap.aai.config.RestBeanConfig;
+import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.edges.EdgeIngestor;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.MoxyLoader;
+import org.onap.aai.nodes.NodeIngestor;
+import org.onap.aai.rest.db.HttpEntry;
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.onap.aai.setup.AAIConfigTranslator;
+import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import static org.junit.Assert.assertNotNull;
+
+@ContextConfiguration(classes = {
+ SchemaLocationsBean.class,
+ SchemaVersions.class,
+ AAIConfigTranslator.class,
+ EdgeIngestor.class,
+ EdgeSerializer.class,
+ NodeIngestor.class,
+ SpringContextAware.class,
+ IntrospectionConfig.class ,
+ RestBeanConfig.class,
+ GremlinServerSingleton.class
+})
+@TestPropertySource(properties = {
+ "schema.uri.base.path = /aai",
+ "schema.ingest.file = src/test/resources/application-test.properties"
+})
+public abstract class AAISetup {
+ @Autowired
+ protected NodeIngestor nodeIngestor;
+
+ @Autowired
+ protected LoaderFactory loaderFactory;
+
+ @Autowired
+ protected Map<SchemaVersion, MoxyLoader> moxyLoaderInstance;
+
+ @Autowired
+ protected HttpEntry traversalHttpEntry;
+
+ @Autowired
+ protected HttpEntry traversalUriHttpEntry;
+
+ @Autowired
+ protected EdgeSerializer edgeSer;
+
+ @Autowired
+ protected EdgeIngestor edgeIngestor;
+
+ @Autowired
+ protected SchemaVersions schemaVersions;
+
+ @Autowired
+ protected GremlinServerSingleton gremlinServerSingleton;
+
+ @Value("${schema.uri.base.path}")
+ protected String basePath;
+
+ @ClassRule
+ public static final SpringClassRule springClassRule = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule springMethodRule = new SpringMethodRule();
+
+ @BeforeClass
+ public static void setupBundleconfig() throws Exception {
+ System.setProperty("AJSC_HOME", "./");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+
+ }
+
+ public String getPayload(String filename) throws IOException {
+
+ InputStream inputStream = getClass()
+ .getClassLoader()
+ .getResourceAsStream(filename);
+
+ String message = String.format("Unable to find the %s in src/test/resources", filename);
+ assertNotNull(message, inputStream);
+
+ String resource = IOUtils.toString(inputStream);
+ return resource;
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
new file mode 100644
index 0000000..d25aff6
--- /dev/null
+++ b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
@@ -0,0 +1,230 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.google.gson.Gson;
+import com.google.gson.stream.JsonReader;
+import com.jayway.jsonpath.JsonPath;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.config.IntrospectionConfig;
+import org.onap.aai.config.SpringContextAware;
+import org.onap.aai.edges.EdgeIngestor;
+import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
+import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.nodes.NodeIngestor;
+import org.onap.aai.queries.GremlinServerSingleton;
+import org.onap.aai.query.builder.GremlinTraversal;
+import org.onap.aai.restcore.search.GremlinGroovyShell;
+import org.onap.aai.restcore.search.GroovyQueryBuilder;
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.serialization.engines.QueryStyle;
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.setup.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+
+@RunWith(Parameterized.class)
+@ContextConfiguration(classes = {
+ SchemaLocationsBean.class,
+ SchemaConfigVersions.class,
+ AAIConfigTranslator.class,
+ EdgeIngestor.class,
+ EdgeSerializer.class,
+ NodeIngestor.class,
+ SpringContextAware.class,
+ GremlinServerSingleton.class,
+ IntrospectionConfig.class
+})
+@TestPropertySource(properties = {
+ "schema.uri.base.path = /aai",
+ "schema.source.name = onap",
+ "schema.ingest.file = src/test/resources/application-test.properties"
+})
+public abstract class OnapQueryTest {
+
+ @ClassRule
+ public static final SpringClassRule springClassRule = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule springMethodRule = new SpringMethodRule();
+
+ protected Logger logger;
+ protected Graph graph;
+ protected GremlinGroovyShell shell;
+ @Mock protected TransactionalGraphEngine dbEngine;
+ protected final List<Vertex> expectedResult = new ArrayList<>();
+
+ @Autowired
+ protected EdgeIngestor edgeRules;
+
+ @Autowired
+ protected EdgeSerializer rules;
+
+ @Autowired
+ protected LoaderFactory loaderFactory;
+
+ @Autowired
+ protected SchemaVersions schemaVersions;
+
+ protected Loader loader;
+ protected GraphTraversalSource gts;
+
+ @Autowired
+ protected GremlinServerSingleton gremlinServerSingleton;
+
+ @Parameterized.Parameter(value = 0)
+ public SchemaVersion version;
+
+ @Parameterized.Parameters(name = "Version.{0}")
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][]{
+ {new SchemaVersion("v11")},
+ {new SchemaVersion("v12")},
+ {new SchemaVersion("v13")},
+ {new SchemaVersion("v14")},
+ {new SchemaVersion("v15")},
+ {new SchemaVersion("v16")},
+ {new SchemaVersion("v17")},
+ {new SchemaVersion("v18")},
+ {new SchemaVersion("v19")}
+ });
+ }
+
+ protected String query;
+
+ LinkedHashMap <String, Object> params;
+
+ @Autowired
+ private Environment env;
+
+ @BeforeClass
+ public static void setupBundleconfig() {
+ System.setProperty("AJSC_HOME", "./");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+ }
+
+ @Before
+ public void setUp() throws AAIException, NoEdgeRuleFoundException, EdgeRuleNotFoundException, AmbiguousRuleChoiceException, IOException {
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
+ logger = LoggerFactory.getLogger(getClass());
+ MockitoAnnotations.initMocks(this);
+ graph = TinkerGraph.open();
+ gts = graph.traversal();
+ createGraph();
+ shell = new GremlinGroovyShell();
+ loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, version);
+ setUpQuery();
+ }
+
+
+ protected void setUpQuery() {
+ query = gremlinServerSingleton.getStoredQueryFromConfig(getQueryName());
+ params = new LinkedHashMap <>();
+ addParam(params);
+ when(dbEngine.getQueryBuilder(any(QueryStyle.class))).thenReturn(new GremlinTraversal<>(loader, graph.traversal()));
+ logger.info("Stored query in abstraction form {}", query);
+ query = new GroovyQueryBuilder().executeTraversal(dbEngine, query, params);
+ logger.info("After converting to gremlin query {}", query);
+ query = "g" + query;
+ GraphTraversal<Vertex, Vertex> g = graph.traversal().V();
+ addStartNode(g);
+ params.put("g", g);
+ }
+
+ public void run() {
+
+ GraphTraversal<Vertex, Vertex> result = (GraphTraversal<Vertex, Vertex>)shell.executeTraversal(query, params);
+
+ List<Vertex> vertices = result.toList();
+
+ logger.info("Expected result set of vertexes [{}]", convert(expectedResult));
+ logger.info("Actual Result set of vertexes [{}]", convert(vertices));
+
+ List<Vertex> nonDuplicateExpectedResult = new ArrayList<>(new HashSet<>(expectedResult));
+ vertices = new ArrayList<>(new HashSet<>(vertices));
+
+ nonDuplicateExpectedResult.sort(Comparator.comparing(vertex -> vertex.id().toString()));
+ vertices.sort(Comparator.comparing(vertex -> vertex.id().toString()));
+
+
+ // Use this instead of the assertTrue as this provides more useful
+ // debugging information such as this when expected and actual differ:
+ // java.lang.AssertionError: Expected all the vertices to be found
+ // Expected :[v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12]]
+ // Actual :[v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12]]
+ assertEquals("Expected all the vertices to be found", nonDuplicateExpectedResult, vertices);
+
+ }
+
+ protected String convert(List<Vertex> vertices){
+ return vertices
+ .stream()
+ .map(vertex -> vertex.property("aai-node-type").value().toString())
+ .collect(Collectors.joining(","));
+ }
+
+ protected abstract void createGraph() throws AAIException, NoEdgeRuleFoundException, EdgeRuleNotFoundException, AmbiguousRuleChoiceException;
+
+ protected abstract String getQueryName();
+
+ protected abstract void addStartNode(GraphTraversal<Vertex, Vertex> g);
+
+ protected abstract void addParam(Map<String, Object> params);
+
+}
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java b/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java
new file mode 100644
index 0000000..9b6a0e8
--- /dev/null
+++ b/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java
@@ -0,0 +1,96 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 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.aai.queries;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+import java.util.Map;
+
+public class VnfToEsrSystemInfoQueryTest extends OnapQueryTest {
+ public VnfToEsrSystemInfoQueryTest() {
+ super();
+ }
+
+ @Test
+ public void run() {
+ super.run();
+ }
+
+ @Override
+ protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
+
+
+ Vertex gnvf = graph.addVertex(T.label, "generic-vnf", T.id, "2", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-1");
+ Vertex vserver = graph.addVertex(T.label, "vserver", T.id, "3", "aai-node-type", "vserver", "vserver-id", "vserver-id-1","vserver-name","vserver-name-1");
+ Vertex tenant = graph.addVertex(T.label, "tenant", T.id, "4", "aai-node-type", "tenant", "tenant-id", "tenantid01", "tenant-name", "tenantName01");
+ Vertex cloudregion = graph.addVertex(T.label, "cloud-region", T.id, "5", "aai-node-type", "cloud-region", "cloud-region-id", "cloud-region-id-1", "cloud-region-owner", "cloud-owner-name-1");
+ Vertex esr = graph.addVertex(T.label, "esr-system-info", T.id, "6", "aai-node-type", "esr-system-info", "esr-system-info-id", "esr-system-info-1");
+
+ Vertex gnvf1 = graph.addVertex(T.label, "generic-vnf", T.id, "8", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-2");
+ Vertex vserver1 = graph.addVertex(T.label, "vserver", T.id, "9", "aai-node-type", "vserver", "vserver-id", "vserver-id-2","vserver-name","vserver-name-2");
+ Vertex tenant1 = graph.addVertex(T.label, "tenant", T.id, "10", "aai-node-type", "tenant", "tenant-id", "tenantid02", "tenant-name", "tenantName02");
+ Vertex cloudregion1 = graph.addVertex(T.label, "cloud-region", T.id, "11", "aai-node-type", "cloud-region", "cloud-region-id", "cloud-region-id-2", "cloud-region-owner", "cloud-owner-name-2");
+ Vertex esr1 = graph.addVertex(T.label, "esr-system-info", T.id, "12", "aai-node-type", "esr-system-info", "esr-system-info-id", "esr-system-info-2");
+
+
+
+
+ GraphTraversalSource g = graph.traversal();
+ rules.addEdge(g, gnvf, vserver);
+ rules.addTreeEdge(g, vserver,tenant);
+ rules.addTreeEdge(g, tenant,cloudregion);
+ rules.addTreeEdge(g, cloudregion, esr);
+
+ //Not expected in result
+ rules.addEdge(g, gnvf1, vserver1);
+ rules.addTreeEdge(g, vserver1,tenant1);
+ rules.addTreeEdge(g, tenant1,cloudregion1);
+ rules.addTreeEdge(g, cloudregion1, esr1);
+ //Not expected in result
+
+ expectedResult.add(gnvf);
+ expectedResult.add(vserver);
+ expectedResult.add(tenant);
+ expectedResult.add(cloudregion);
+ expectedResult.add(esr);
+
+
+ }
+
+ @Override
+ protected String getQueryName() {
+ return "vnf-to-esr-system-info";
+ }
+ @Override
+ protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
+ g.has("aai-node-type", "generic-vnf").has("vnf-id", "vnf-id-1");
+
+ }
+ @Override
+ protected void addParam(Map<String, Object> params) {
+ return;
+ }
+}
diff --git a/aai-queries/src/test/resources/application-onap-test.properties b/aai-queries/src/test/resources/application-onap-test.properties
new file mode 100644
index 0000000..697c4a8
--- /dev/null
+++ b/aai-queries/src/test/resources/application-onap-test.properties
@@ -0,0 +1,33 @@
+server.local.startpath=src/main/resources/
+# Schema related attributes for the oxm and edges
+# Any additional schema related attributes should start with prefix schema
+schema.configuration.location=N/A
+# Choose if the oxm schema is onap or other system
+schema.source.name=onap
+# Location of where the oxm files are
+schema.nodes.location=${server.local.startpath}/schema/${schema.source.name}/oxm/
+# Location of where the dbedgerules files are
+schema.edges.location=${server.local.startpath}/schema/${schema.source.name}/dbedgerules/
+# Location of where the stored queries are
+schema.queries.location=${server.local.startpath}/schema/${schema.source.name}/query/
+
+schema.ingest.file=${server.local.startpath}/application-test.properties
+
+# Schema Version Related Attributes
+schema.uri.base.path=/aai
+# Lists all of the versions in the schema
+schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17
+# Specifies from which version should the depth parameter to default to zero
+schema.version.depth.start=v10
+# Specifies from which version should the related link be displayed in response payload
+schema.version.related.link.start=v10
+# Specifies from which version should the client see only the uri excluding host info
+# Before this version server base will also be included
+schema.version.app.root.start=v11
+# Specifies from which version should the namespace be changed
+schema.version.namespace.change.start=v12
+# Specifies from which version should the client start seeing the edge label in payload
+schema.version.edge.label.start=v12
+# Specifies the version that the application should default to
+schema.version.api.default=v17
+schema.translator.list=config \ No newline at end of file
diff --git a/aai-queries/src/test/resources/application-test.properties b/aai-queries/src/test/resources/application-test.properties
new file mode 100644
index 0000000..b6aafc7
--- /dev/null
+++ b/aai-queries/src/test/resources/application-test.properties
@@ -0,0 +1,34 @@
+server.local.startpath=src/main/resources
+# Schema related attributes for the oxm and edges
+# Any additional schema related attributes should start with prefix schema
+schema.configuration.location=N/A
+# Choose if the oxm schema is onap or other system
+schema.source.name=ecomp
+# Location of where the oxm files are
+schema.nodes.location=${server.local.startpath}/schema/${schema.source.name}/oxm/
+# Location of where the dbedgerules files are
+schema.edges.location=${server.local.startpath}/schema/${schema.source.name}/dbedgerules/
+# Location of where the stored queries are
+schema.queries.location=${server.local.startpath}/schema/${schema.source.name}/query/
+
+schema.ingest.file=${server.local.startpath}/application-test.properties
+
+# Schema Version Related Attributes
+schema.uri.base.path=/aai
+# Lists all of the versions in the schema
+schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19
+# Specifies from which version should the depth parameter to default to zero
+schema.version.depth.start=v10
+# Specifies from which version should the related link be displayed in response payload
+schema.version.related.link.start=v10
+# Specifies from which version should the client see only the uri excluding host info
+# Before this version server base will also be included
+schema.version.app.root.start=v11
+# Specifies from which version should the namespace be changed
+schema.version.namespace.change.start=v12
+# Specifies from which version should the client start seeing the edge label in payload
+schema.version.edge.label.start=v12
+# Specifies the version that the application should default to
+schema.version.api.default=v19
+
+schema.translator.list=config
diff --git a/aai-queries/src/test/resources/logback.xml b/aai-queries/src/test/resources/logback.xml
new file mode 100644
index 0000000..795533f
--- /dev/null
+++ b/aai-queries/src/test/resources/logback.xml
@@ -0,0 +1,81 @@
+<!--
+
+ ============LICENSE_START=======================================================
+ org.onap.aai
+ ================================================================================
+ Copyright © 2017 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+-->
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+ <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
+
+ <property resource="application.properties" />
+
+ <property name="namespace" value="aai-queries"/>
+
+ <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
+ <jmxConfigurator />
+
+ <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+ <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>
+ %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
+ </pattern>
+ </encoder>
+ </appender>
+
+ <!-- Spring related loggers -->
+ <logger name="org.springframework" level="WARN" />
+ <logger name="org.springframework.beans" level="WARN" />
+ <logger name="org.springframework.web" level="WARN" />
+ <logger name="com.blog.spring.jms" level="WARN" />
+ <logger name="com.jayway.jsonpath" level="WARN" />
+
+ <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging.
+ May aid in troubleshooting) -->
+ <logger name="org.apache.camel" level="WARN" />
+ <logger name="org.apache.cxf" level="WARN" />
+ <logger name="org.apache.camel.processor.interceptor" level="WARN" />
+ <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN" />
+ <logger name="org.apache.cxf.service" level="WARN" />
+ <logger name="org.restlet" level="WARN" />
+ <logger name="org.apache.camel.component.restlet" level="WARN" />
+
+ <logger name="org.hibernate.validator" level="WARN" />
+ <logger name="org.hibernate" level="WARN" />
+ <logger name="org.hibernate.ejb" level="OFF" />
+
+ <!-- logback internals logging -->
+ <logger name="ch.qos.logback.classic" level="WARN" />
+ <logger name="ch.qos.logback.core" level="WARN" />
+
+ <logger name="org.eclipse.jetty" level="WARN" />
+
+
+ <logger name="org.apache" level="WARN" />
+ <logger name="org.zookeeper" level="WARN" />
+ <logger name="org.janusgraph" level="WARN" />
+ <logger name="com.att.aft.dme2" level="WARN" />
+
+ <root level="DEBUG">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
diff --git a/aai-queries/src/test/resources/schema-ingest.properties b/aai-queries/src/test/resources/schema-ingest.properties
new file mode 100644
index 0000000..95846ea
--- /dev/null
+++ b/aai-queries/src/test/resources/schema-ingest.properties
@@ -0,0 +1,10 @@
+schema.configuration.location=N/A
+schema.nodes.location=src/main/resources/schema/oxm/
+schema.edges.location=src/main/resources/schema/dbedgerules/
+
+schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17
+schema.version.depth.start=v10
+schema.version.related.link.start=v10
+schema.version.app.root.start=v11
+schema.version.edge.label.start=v12
+schema.version.api.default=v17
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java
index 9ff0fa3..e75be8f 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXM.java
@@ -87,8 +87,12 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
+ "apidocs/aai_swagger_" + v.toString() + ".diff)");
}
sb.append(
- DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved.\n\n Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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.\n\n This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
- + v.toString() + "\"" + LINE_SEPARATOR );
+ DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " This document is best viewed with Firefox or Chrome. ");
+ sb.append(
+ "Nodes can be found by opening the models link below and finding the node-type. ");
+ sb.append(
+ "Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
+ + v.toString() + "\"" + LINE_SEPARATOR );
sb.append(" title: Active and Available Inventory REST API" + LINE_SEPARATOR);
sb.append(
" license:" + LINE_SEPARATOR + " name: Apache 2.0" + LINE_SEPARATOR + " url: http://www.apache.org/licenses/LICENSE-2.0.html" + LINE_SEPARATOR);
@@ -257,6 +261,7 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
String pathDescriptionProperty = javaType.getPathDescriptionProperty();
String container = javaType.getContainerProperty();
Vector<String> indexedProps = javaType.getIndexedProps();
+ Vector<String> dslStartNodeProps = javaType.getDslStartNodeProps();
Vector<String> containerProps = new Vector<String>();
if (container != null) {
logger.debug("javaTypeName " + javaTypeName + " container:" + container
@@ -324,7 +329,8 @@ public class NodesYAMLfromOXM extends OxmFileProcessor {
NodeGetOperation.addContainerProps(container, containerProps);
}
if (xmlElementElement.isStandardType()) {
- sbProperties.append(xmlElementElement.getTypePropertyYAML());
+ boolean isDslStartNode = dslStartNodeProps.contains(xmlElementElement.getAttribute("name"));
+ sbProperties.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
++propertyCnt;
}
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
index 5ab3678..496f3df 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PatchOperation.java
@@ -20,6 +20,7 @@
package org.onap.aai.schemagen.genxsd;
import org.apache.commons.lang3.StringUtils;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.schemagen.GenerateXsd;
import java.util.StringTokenizer;
@@ -31,8 +32,9 @@ public class PatchOperation {
private String path;
private String pathParams;
private String prefixForPatch;
+ private SchemaVersion version;
- public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams) {
+ public PatchOperation(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, SchemaVersion v) {
super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
@@ -40,6 +42,7 @@ public class PatchOperation {
this.path = path;
this.pathParams = pathParams;
this.prefixForPatch = "";
+ this.version = v;
}
public void setPrefixForPatchRef(String prefixForPatchRef) {
this.prefixForPatch = prefixForPatchRef;
@@ -81,8 +84,8 @@ public class PatchOperation {
if ( path.endsWith("/relationship") ) {
pathSb.append(" summary: see node definition for valid relationships\n");
- relationshipExamplesSb.append("[See Examples](apidocs/relations/"+GenerateXsd.getAPIVersion()+"/"+useOpId+".json)");
} else {
+ relationshipExamplesSb.append("[See Examples](apidocs/relations/"+version.toString()+"/"+useOpId+".json)");
pathSb.append(" summary: update an existing " + xmlRootElementName + "\n");
pathSb.append(" description: |\n");
pathSb.append(" Update an existing " + xmlRootElementName + "\n");
@@ -109,7 +112,7 @@ public class PatchOperation {
pathSb.append(pathParams); // for nesting
pathSb.append(" - name: body\n");
pathSb.append(" in: body\n");
- pathSb.append(" description: " + xmlRootElementName + " object that needs to be updated."+relationshipExamplesSb.toString()+"\n");
+ pathSb.append(" description: " + xmlRootElementName + " object that needs to be updated."+relationshipExamplesSb.toString()+"\n");
pathSb.append(" required: true\n");
pathSb.append(" schema:\n");
pathSb.append(" $ref: \"#/definitions/" + prefixForPatch + xmlRootElementName + "\"\n");
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
index c666d9f..2b3fcf2 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/PutRelationPathSet.java
@@ -76,7 +76,7 @@ public class PutRelationPathSet {
relations.add("{\"comment\": \"Valid TO Relations that can be added\"}\n");
SortedSet<String> ss=new TreeSet<String>(results.keySet());
for(String key : ss) {
- results.get(key).stream().filter((i) -> (! i.isPrivateEdge())).forEach((i) ->{ String rel = selectedRelation(i); relations.add(rel); logger.debug("Relation added: "+rel); } );
+ results.get(key).stream().filter((i) -> ("NONE".equals(i.getContains()) &&! i.isPrivateEdge())).forEach((i) ->{ String rel = selectedRelation(i); relations.add(rel); logger.debug("Relation added: "+rel); } );
}
} catch(Exception e) {
logger.debug("objectName: "+objectName+"\n"+e);
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java
index 38117e5..785ea68 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/XSDElement.java
@@ -37,6 +37,7 @@ public class XSDElement implements Element {
private static final int VALUE_INDEXED_PROPS = 2;
private static final int VALUE_CONTAINER = 3;
private static final int VALUE_REQUIRES = 4;
+ private static final int VALUE_DSLSTARTNODE = 5;
public XSDElement(Element xmlElementElement, String maxOccurs) {
super();
@@ -153,8 +154,9 @@ public class XSDElement implements Element {
}
return pathDescriptionProperty;
}
- public Vector<String> getIndexedProps() {
- Vector<String> indexedProps = new Vector<String>();
+
+ public Vector<String> getProps(int needValue) {
+ Vector<String> props = new Vector<String>();
NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
for ( int i = 0; i < xmlPropNodes.getLength(); ++i ) {
@@ -173,19 +175,21 @@ public class XSDElement implements Element {
String attrValue = attr.getNodeValue();
if ( attrName == null || attrValue == null )
continue;
- if ( attrValue.equals("indexedProps")) {
+ if ( needValue == VALUE_INDEXED_PROPS && attrValue.equals("indexedProps")) {
useValue = VALUE_INDEXED_PROPS;
+ } else if ( needValue == VALUE_DSLSTARTNODE && attrValue.equals("dslStartNodeProps")) {
+ useValue = VALUE_DSLSTARTNODE;
}
- if ( useValue == VALUE_INDEXED_PROPS && attrName.equals("value")) {
- indexedProps = getIndexedProps( attrValue );
+ if ( useValue != VALUE_NONE && attrName.equals("value")) {
+ props = getProps( attrValue );
}
}
}
}
- return indexedProps;
+ return props;
}
-
- private static Vector<String> getIndexedProps( String attrValue )
+
+ private static Vector<String> getProps( String attrValue )
{
if ( attrValue == null )
return null;
@@ -198,6 +202,14 @@ public class XSDElement implements Element {
}
return result;
}
+
+ public Vector<String> getIndexedProps() {
+ return getProps(VALUE_INDEXED_PROPS);
+ }
+
+ public Vector<String> getDslStartNodeProps() {
+ return getProps(VALUE_DSLSTARTNODE);
+ }
public String getContainerProperty() {
NodeList xmlPropNodes = this.getElementsByTagName("xml-properties");
@@ -407,7 +419,7 @@ public class XSDElement implements Element {
return sb.toString();
}
- public String getTypePropertyYAML() {
+ public String getTypePropertyYAML(boolean isDslStartNode) {
StringBuffer sbProperties = new StringBuffer();
sbProperties.append(" " + this.getAttribute("name") + ":\n");
sbProperties.append(" type: ");
@@ -425,8 +437,21 @@ public class XSDElement implements Element {
else if ( ("java.lang.Boolean").equals(this.getAttribute("type")))
sbProperties.append("boolean\n");
String attrDescription = this.getPathDescriptionProperty();
- if ( attrDescription != null && attrDescription.length() > 0 )
- sbProperties.append(" description: " + attrDescription + "\n");
+ if ( attrDescription != null && attrDescription.length() > 0 ) {
+ if ( !isDslStartNode ) {
+ sbProperties.append(" description: " + attrDescription + "\n");
+ } else {
+ sbProperties.append(" description: |\n");
+ sbProperties.append(" " + attrDescription + "\n");
+ sbProperties.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ }
+ } else {
+ if ( isDslStartNode ) {
+ sbProperties.append(" description: |\n");
+ sbProperties.append(" \n");
+ sbProperties.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ }
+ }
String elementAlsoRequiresProperty=this.getRequiresProperty();
if ( StringUtils.isNotEmpty(elementAlsoRequiresProperty) )
sbProperties.append(" also requires: " + elementAlsoRequiresProperty + "\n");
@@ -735,5 +760,4 @@ public class XSDElement implements Element {
}
-}
-
+} \ No newline at end of file
diff --git a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java
index b75a1dc..40d5c0e 100644
--- a/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java
+++ b/aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/YAMLfromOXM.java
@@ -88,8 +88,12 @@ public class YAMLfromOXM extends OxmFileProcessor {
+ "apidocs/aai_swagger_" + v.toString() + ".diff)");
}
sb.append(
- DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License.\n\n You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)\n\n Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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." + DOUBLE_LINE_SEPARATOR + " This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
- + v.toString() + "\"" + LINE_SEPARATOR );
+ DOUBLE_LINE_SEPARATOR + " Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + DOUBLE_LINE_SEPARATOR + " You may obtain a copy of the License at\n\n (https://creativecommons.org/licenses/by/4.0/)" + DOUBLE_LINE_SEPARATOR + " Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR + " This document is best viewed with Firefox or Chrome. ");
+ sb.append(
+ "Nodes can be found by opening the models link below and finding the node-type. ");
+ sb.append(
+ "Edge definitions can be found with the node definitions." + LINE_SEPARATOR + " version: \""
+ + v.toString() + "\"" + LINE_SEPARATOR );
sb.append(" title: Active and Available Inventory REST API" + LINE_SEPARATOR);
sb.append(
" license:" + LINE_SEPARATOR + " name: Apache 2.0\n url: http://www.apache.org/licenses/LICENSE-2.0.html" + LINE_SEPARATOR);
@@ -264,6 +268,7 @@ public class YAMLfromOXM extends OxmFileProcessor {
String pathDescriptionProperty = javaType.getPathDescriptionProperty();
String container = javaType.getContainerProperty();
Vector<String> indexedProps = javaType.getIndexedProps();
+ Vector<String> dslStartNodeProps = javaType.getDslStartNodeProps();
Vector<String> containerProps = new Vector<String>();
if (container != null) {
logger.debug("javaTypeName " + javaTypeName + " container:" + container
@@ -345,9 +350,10 @@ public class YAMLfromOXM extends OxmFileProcessor {
GetOperation.addContainerProps(container, containerProps);
}
if (xmlElementElement.isStandardType()) {
- sbProperties.append(xmlElementElement.getTypePropertyYAML());
+ boolean isDslStartNode = dslStartNodeProps.contains(xmlElementElement.getAttribute("name"));
+ sbProperties.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
if ( !"resource-version".equals(xmlElementElement.getAttribute("name"))) {
- sbPropertiesPatch.append(xmlElementElement.getTypePropertyYAML());
+ sbPropertiesPatch.append(xmlElementElement.getTypePropertyYAML(isDslStartNode));
++patchPropertyCnt;
}
++propertyCnt;
@@ -464,7 +470,7 @@ public class YAMLfromOXM extends OxmFileProcessor {
pathSb.append(put.toString());
// add PATCH
PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path,
- pathParams == null ? "" : pathParams.toString());
+ pathParams == null ? "" : pathParams.toString(), this.v);
patch.setPrefixForPatchRef(patchDefinePrefix);
pathSb.append(patch.toString());
// add DELETE
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
index d08c3e0..9ad16d6 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
@@ -253,13 +253,13 @@ public class NodesYAMLfromOXMTest {
sb.append(" description: |\n");
sb.append("\n");
sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved.\n\n");
+ sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" You may obtain a copy of the License at\n");
sb.append("\n");
sb.append(" (https://creativecommons.org/licenses/by/4.0/)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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.\n\n");
- sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
+ sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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."+ OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
+ sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
index e686fbc..e36d520 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.onap.aai.setup.SchemaVersion;
import java.util.Arrays;
import java.util.Collection;
@@ -39,11 +40,12 @@ public class PatchOperationTest {
private String path;
private String pathParams;
private String result;
+ private static SchemaVersion v = new SchemaVersion("v16");
@Parameters
public static Collection<String []> testConditions() {
String inputs [][] = {
- {"NetworkGenericVnfsGenericVnf","generic-vnf","Network","/network/generic-vnfs/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\n responses:\n \"default\":\n null parameters:\n - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
+ {"NetworkGenericVnfsGenericVnf","generic-vnf","Network","/network/generic-vnfs/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\n responses:\n \"default\":\n null parameters:\n - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.[See Examples](apidocs/relations/v16/NetworkGenericVnfsGenericVnf.json)\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
// if ( StringUtils.isEmpty(tag) )
{"GenericVnf","generic-vnf","","/generic-vnf/{vnf-id}"," - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__",""},
// Test: if ( !path.endsWith("/relationship") && !path.endsWith("}") )
@@ -73,7 +75,7 @@ public class PatchOperationTest {
@Test
public void testToString() {
- PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams);
+ PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v);
String modResult = patch.toString();
assertThat(modResult, is(this.result));
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
index 3c072f3..2ebaee1 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
@@ -43,6 +43,7 @@ import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.core.Every.everyItem;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
public class XSDElementTest {
@@ -603,13 +604,23 @@ public class XSDElementTest {
target.add(" Customer:\n type: description: customer identifiers to provide linkage back to BSS information.\n");
target.add(" ServiceSubscriptions:\n type: description: Collection of objects that group service instances.\n");
target.add(" ServiceSubscription:\n type: description: Object that group service instances.\n");
+ StringBuilder sb = new StringBuilder(" Customer:\n type: description: |\n customer identifiers to provide linkage back to BSS information.\n");
+ sb.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ String yamlDesc = sb.toString();
List<String> types = new ArrayList<String>();
+ String container;
+ String customerDesc = null;
for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) {
XSDElement javaTypeElement = new XSDElement((Element) javaTypeNodes.item(i));
- if(javaTypeElement.getTypePropertyYAML() != null)
- types.add(javaTypeElement.getTypePropertyYAML());
+ if(javaTypeElement.getTypePropertyYAML(false) != null)
+ types.add(javaTypeElement.getTypePropertyYAML(false));
+ container = javaTypeElement.getContainerProperty();
+ if ( "customers".equals(container)) {
+ customerDesc = javaTypeElement.getTypePropertyYAML(true);
+ }
}
assertThat(new ArrayList<>(types),both(everyItem(is(in(target.toArray())))).and(containsInAnyOrder(target.toArray())));
+ assertEquals(customerDesc, yamlDesc );
}
@Test
@@ -640,4 +651,5 @@ public class XSDElementTest {
}
}
+
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
index b54408d..2ccf051 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
@@ -315,14 +315,12 @@ public class YAMLfromOXMTest {
sb.append("\n");
sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License.\n");
- sb.append("\n");
+ sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" You may obtain a copy of the License at\n");
sb.append("\n");
- sb.append(" (https://creativecommons.org/licenses/by/4.0/)\n");
- sb.append("\n");
+ sb.append(" (https://creativecommons.org/licenses/by/4.0/)"+ OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; 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." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
+ sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
@@ -445,7 +443,8 @@ public class YAMLfromOXMTest {
sb.append(" example: __SERVICE-TYPE__\n");
sb.append(" - name: body\n");
sb.append(" in: body\n");
- sb.append(" description: service-subscription object that needs to be updated.\n");
+ sb.append(" description: service-subscription object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-service-subscription\"\n");
@@ -594,7 +593,8 @@ public class YAMLfromOXMTest {
sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
sb.append(" - name: body\n");
sb.append(" in: body\n");
- sb.append(" description: customer object that needs to be updated.\n");
+ sb.append(" description: customer object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomer.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-customer\"\n");
diff --git a/aai-schema-service/pom.xml b/aai-schema-service/pom.xml
index 4b4fcf8..7804c7a 100644
--- a/aai-schema-service/pom.xml
+++ b/aai-schema-service/pom.xml
@@ -4,7 +4,7 @@
============LICENSE_START=======================================================
org.onap.aai
================================================================================
- Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ Copyright © 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.
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
index f2e0bd1..4e5bea5 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
@@ -19,11 +19,9 @@
*/
package org.onap.aai.schemaservice;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.logging.LoggingContext.StatusCode;
import org.onap.aai.schemaservice.config.PropertyPasswordConfiguration;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,7 +31,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
+import org.onap.aai.aailog.logs.AaiDebugLog;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -50,12 +50,19 @@ import java.util.UUID;
DataSourceTransactionManagerAutoConfiguration.class,
HibernateJpaAutoConfiguration.class
})
+@ComponentScan(basePackages = {
+ "org.onap.aai.schemaservice",
+ "org.onap.aai.aaf"
+})
public class SchemaServiceApp {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(SchemaServiceApp.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(SchemaServiceApp.class.getName());
private static final String APP_NAME = "aai-schema-service";
- private static Map<String, String> contextMap;
+ private static AaiDebugLog debugLog = new AaiDebugLog();
+ static {
+ debugLog.setupMDC();
+ }
@Autowired
private Environment env;
@@ -64,14 +71,6 @@ public class SchemaServiceApp {
setDefaultProps();
- LoggingContext.save();
- LoggingContext.component("init");
- LoggingContext.partnerName("NA");
- LoggingContext.targetEntity(APP_NAME);
- LoggingContext.requestId(UUID.randomUUID().toString());
- LoggingContext.serviceName(APP_NAME);
- LoggingContext.targetServiceName("contextInitialized");
- LoggingContext.statusCode(StatusCode.COMPLETE);
SpringApplication app = new SpringApplication(SchemaServiceApp.class);
@@ -79,19 +78,17 @@ public class SchemaServiceApp {
app.setRegisterShutdownHook(true);
app.addInitializers(new PropertyPasswordConfiguration());
Environment env = app.run(args).getEnvironment();
- MDC.setContextMap(contextMap);
- logger.info(
+ logger.debug(
"Application '{}' is running on {}!",
env.getProperty("spring.application.name"),
env.getProperty("server.port")
);
- logger.info("SchemaService MicroService Started");
+ logger.debug("SchemaService MicroService Started");
System.out.println("SchemaService Microservice Started");
- LoggingContext.restoreIfPossible();
}
public static void setDefaultProps() {
@@ -122,17 +119,7 @@ public class SchemaServiceApp {
System.setProperty("org.onap.aai.serverStarted", "false");
setDefaultProps();
- LoggingContext.save();
- LoggingContext.component("init");
- LoggingContext.partnerName("NA");
- LoggingContext.targetEntity(APP_NAME);
- LoggingContext.requestId(UUID.randomUUID().toString());
- LoggingContext.serviceName(APP_NAME);
- LoggingContext.targetServiceName("contextInitialized");
- LoggingContext.statusCode(StatusCode.COMPLETE);
-
- contextMap = MDC.getCopyOfContextMap();
- logger.info("SchemaService initialization started...");
+ logger.debug("SchemaService initialization started...");
// Setting this property to allow for encoded slash (/) in the path parameter
// This is only needed for tomcat keeping this as temporary
@@ -143,20 +130,11 @@ public class SchemaServiceApp {
logger.warn("You have seriously misconfigured your application");
}
- LoggingContext.restoreIfPossible();
}
@PreDestroy
public void cleanup() {
- LoggingContext.save();
- LoggingContext.component("Stopped");
- LoggingContext.partnerName("NA");
- LoggingContext.targetEntity(APP_NAME);
- LoggingContext.requestId(UUID.randomUUID().toString());
- LoggingContext.serviceName(APP_NAME);
- LoggingContext.targetServiceName("Stopped");
- LoggingContext.statusCode(StatusCode.COMPLETE);
- logger.info("SchemaService shutting down");
+ logger.debug("SchemaService shutting down");
}
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/AuthorizationConfiguration.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/AuthorizationConfiguration.java
index 76dd084..8069520 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/AuthorizationConfiguration.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/AuthorizationConfiguration.java
@@ -19,7 +19,7 @@
*/
package org.onap.aai.schemaservice.config;
-import org.onap.aai.auth.AAIAuthCore;
+import org.onap.aai.aaf.auth.AAIAuthCore;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
index cb5416f..6e29d4a 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.config;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.ErrorObject;
@@ -49,7 +49,7 @@ import java.util.List;
@Component
public class ErrorHandler extends OncePerRequestFilter {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ErrorHandler.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ErrorHandler.class);
private String basePath;
public ErrorHandler(@Value("${schema.uri.base.path}") String basePath) {
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/PropertyPasswordConfiguration.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/PropertyPasswordConfiguration.java
index 49cd1ed..db67ac6 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/PropertyPasswordConfiguration.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/PropertyPasswordConfiguration.java
@@ -26,28 +26,114 @@ import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.commons.io.IOUtils;
+import org.springframework.context.ApplicationContextInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.env.*;
+
public class PropertyPasswordConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext> {
private static final Pattern decodePasswordPattern = Pattern.compile("password\\((.*?)\\)");
-
private PasswordDecoder passwordDecoder = new JettyPasswordDecoder();
+ private static final Logger logger = LoggerFactory.getLogger(PropertyPasswordConfiguration.class.getName());
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
ConfigurableEnvironment environment = applicationContext.getEnvironment();
+ String certPath = environment.getProperty("server.certs.location");
+ File passwordFile = null;
+ File passphrasesFile = null;
+ InputStream passwordStream = null;
+ InputStream passphrasesStream = null;
+ Map<String, Object> sslProps = new LinkedHashMap<>();
+
+ // Override the passwords from application.properties if we find AAF certman files
+ if (certPath != null) {
+ try {
+ passwordFile = new File(certPath + ".password");
+ passwordStream = new FileInputStream(passwordFile);
+
+ if (passwordStream != null) {
+ String keystorePassword = null;
+
+ keystorePassword = IOUtils.toString(passwordStream);
+ if (keystorePassword != null) {
+ keystorePassword = keystorePassword.trim();
+ sslProps.put("server.ssl.key-store-password", keystorePassword);
+ }
+ else{
+ logger.warn("Keystore password is null in AAF Certman password file");
+ }
+ } else {
+ logger.info("Not using AAF Certman password file");
+ }
+ } catch (IOException e) {
+ logger.warn("Not using AAF Certman password file " + passwordFile.getName() + " e=" + e.getMessage());
+ } finally {
+ if (passwordStream != null) {
+ try {
+ passwordStream.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+ try {
+ passphrasesFile = new File(certPath + ".passphrases");
+ passphrasesStream = new FileInputStream(passphrasesFile);
+
+ if (passphrasesStream != null) {
+ String truststorePassword = null;
+ Properties passphrasesProps = new Properties();
+ passphrasesProps.load(passphrasesStream);
+ truststorePassword = passphrasesProps.getProperty("cadi_truststore_password");
+ if (truststorePassword != null) {
+ truststorePassword = truststorePassword.trim();
+ sslProps.put("server.ssl.trust-store-password", truststorePassword);
+ }
+ else {
+ logger.warn("Truststore password is null in AAF Certman passphrases file");
+ }
+ } else {
+ logger.info("Not using AAF Certman passphrases file");
+ }
+ } catch (IOException e) {
+ logger.warn("Not using AAF Certman passphrases file " + passphrasesFile.getName() + " e=" + e.getMessage());
+ } finally {
+ if (passphrasesStream != null) {
+ try {
+ passphrasesStream.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
for (PropertySource<?> propertySource : environment.getPropertySources()) {
Map<String, Object> propertyOverrides = new LinkedHashMap<>();
decodePasswords(propertySource, propertyOverrides);
if (!propertyOverrides.isEmpty()) {
- PropertySource<?> decodedProperties = new MapPropertySource("decoded " + propertySource.getName(), propertyOverrides);
+ PropertySource<?> decodedProperties = new MapPropertySource("decoded "+ propertySource.getName(), propertyOverrides);
environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties);
}
+
}
+ if (!sslProps.isEmpty()) {
+ logger.info("Using AAF Certman files");
+ PropertySource<?> additionalProperties = new MapPropertySource("additionalProperties", sslProps);
+ environment.getPropertySources().addFirst(additionalProperties);
+ }
+
}
private void decodePasswords(PropertySource<?> source, Map<String, Object> propertyOverrides) {
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
index ca953fd..a4eba45 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.edges;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -45,7 +45,7 @@ import java.util.stream.Stream;
@Service
public class EdgeService {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(EdgeService.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(EdgeService.class);
private static final String FILESEP = System.getProperty("file.separator");
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResetLoggingContext.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResetLoggingContext.java
deleted file mode 100644
index 420ee78..0000000
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResetLoggingContext.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 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.aai.schemaservice.interceptors.post;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.logging.LoggingContext.StatusCode;
-import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.annotation.Priority;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.Response.StatusType;
-import java.io.IOException;
-
-@Priority(AAIResponseFilterPriority.RESET_LOGGING_CONTEXT)
-public class ResetLoggingContext extends AAIContainerFilter implements ContainerResponseFilter {
-
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ResetLoggingContext.class);
-
- @Autowired
- private HttpServletRequest httpServletRequest;
-
- @Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
-
- this.cleanLoggingContext(responseContext);
-
- }
-
- private void cleanLoggingContext(ContainerResponseContext responseContext) {
- //String url = httpServletRequest.getRequestURL().toString();
- boolean success = true;
- String uri = httpServletRequest.getRequestURI();
- String queryString = httpServletRequest.getQueryString();
-
- if (queryString != null && !queryString.isEmpty()) {
- uri = uri + "?" + queryString;
- }
- // For now, we use the the HTTP status code,
- // This may change, once the requirements for response codes are defined
-
- int httpStatusCode = responseContext.getStatus();
- if (httpStatusCode < 100 || httpStatusCode > 599) {
- httpStatusCode = Status.INTERNAL_SERVER_ERROR.getStatusCode();
- }
- LoggingContext.responseCode(Integer.toString(httpStatusCode));
-
- StatusType sType = responseContext.getStatusInfo();
- if (sType != null) {
- Status.Family sFamily = sType.getFamily();
- if (!(Status.Family.SUCCESSFUL.equals(sFamily) ||
- (Status.NOT_FOUND.equals(Status.fromStatusCode(httpStatusCode))))) {
- success = false;
- }
- } else {
- if ((httpStatusCode < 200 || httpStatusCode > 299) && (!(Status.NOT_FOUND.equals(Status.fromStatusCode(httpStatusCode))))) {
- success = false;
- }
- }
- if (success) {
- LoggingContext.statusCode(StatusCode.COMPLETE);
- LOGGER.info(uri + " call succeeded");
- } else {
- LoggingContext.statusCode(StatusCode.ERROR);
- LOGGER.error(uri + " call failed with responseCode=" + httpStatusCode);
- }
- LoggingContext.clear();
-
-
- }
-
-}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResponseTransactionLogging.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResponseTransactionLogging.java
index cd6706d..bc42d0f 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResponseTransactionLogging.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/post/ResponseTransactionLogging.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.interceptors.post;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.JsonObject;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
@@ -42,7 +42,7 @@ import java.util.Optional;
@Priority(AAIResponseFilterPriority.RESPONSE_TRANS_LOGGING)
public class ResponseTransactionLogging extends AAIContainerFilter implements ContainerResponseFilter {
- private static final EELFLogger TRANSACTION_LOGGER = EELFManager.getInstance().getLogger(ResponseTransactionLogging.class);
+ private static final Logger TRANSACTION_LOGGER = LoggerFactory.getLogger(ResponseTransactionLogging.class);
@Autowired
private HttpServletResponse httpServletResponse;
@@ -57,24 +57,13 @@ public class ResponseTransactionLogging extends AAIContainerFilter implements Co
private void transLogging(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
- String logValue;
- String getValue;
-
- try {
- logValue = AAIConfig.get("aai.transaction.logging");
- getValue = AAIConfig.get("aai.transaction.logging.get");
- } catch (AAIException e) {
- return;
- }
+ String logValue = AAIConfig.get("aai.transaction.logging", "true");
+ String isGetTransactionResponseLoggingEnabled = AAIConfig.get("aai.transaction.logging.get", "false");
String httpMethod = requestContext.getMethod();
if(Boolean.parseBoolean(logValue)){
- if(!Boolean.parseBoolean(getValue) && HttpMethod.GET.equals(httpMethod)){
- return;
- }
-
String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
String fullUri = requestContext.getUriInfo().getRequestUri().toString();
@@ -96,7 +85,9 @@ public class ResponseTransactionLogging extends AAIContainerFilter implements Co
logEntry.addProperty("resourceId", fullUri);
logEntry.addProperty("resourceType", httpMethod);
logEntry.addProperty("rqstBuf", Objects.toString(request, ""));
- logEntry.addProperty("respBuf", Objects.toString(response, ""));
+ if(Boolean.parseBoolean(isGetTransactionResponseLoggingEnabled) || (!HttpMethod.GET.equals(httpMethod))) {
+ logEntry.addProperty("respBuf", Objects.toString(response, ""));
+ }
try {
TRANSACTION_LOGGER.debug(logEntry.toString());
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/HeaderValidation.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/HeaderValidation.java
index 85cb6be..66be48e 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/HeaderValidation.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/HeaderValidation.java
@@ -23,6 +23,8 @@ import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
@@ -34,7 +36,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-import java.util.UUID;
@PreMatching
@Priority(AAIRequestFilterPriority.HEADER_VALIDATION)
@@ -45,35 +46,26 @@ public class HeaderValidation extends AAIContainerFilter implements ContainerReq
Optional<Response> oResp;
- String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
- String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
-
List<MediaType> acceptHeaderValues = requestContext.getAcceptableMediaTypes();
-
+ String fromAppId = getPartnerName(requestContext);
oResp = this.validateHeaderValuePresence(fromAppId, "AAI_4009", acceptHeaderValues);
if (oResp.isPresent()) {
requestContext.abortWith(oResp.get());
return;
}
+ String transId = getRequestId(requestContext);
oResp = this.validateHeaderValuePresence(transId, "AAI_4010", acceptHeaderValues);
if (oResp.isPresent()) {
requestContext.abortWith(oResp.get());
return;
}
-
- if (!this.isValidUUID(transId)) {
- transId = UUID.randomUUID().toString();
- requestContext.getHeaders().get(AAIHeaderProperties.TRANSACTION_ID).clear();
- requestContext.getHeaders().add(AAIHeaderProperties.TRANSACTION_ID, transId);
- }
-
}
private Optional<Response> validateHeaderValuePresence(String value, String errorCode,
List<MediaType> acceptHeaderValues) {
Response response = null;
AAIException aaie;
- if (value == null) {
+ if (value == null || value.isEmpty()) {
aaie = new AAIException(errorCode);
return Optional.of(Response.status(aaie.getErrorObject().getHTTPResponseCode())
.entity(ErrorLogHelper.getRESTAPIErrorResponse(acceptHeaderValues, aaie, new ArrayList<>()))
@@ -82,5 +74,52 @@ public class HeaderValidation extends AAIContainerFilter implements ContainerReq
return Optional.ofNullable(response);
}
+ public String getRequestId(ContainerRequestContext requestContext) {
+ String requestId = requestContext.getHeaderString(ONAPLogConstants.Headers.REQUEST_ID);
+ if (requestId == null || requestId.isEmpty()) {
+ requestId = requestContext.getHeaderString(Constants.HttpHeaders.HEADER_REQUEST_ID);
+ if (requestId == null || requestId.isEmpty()) {
+ requestId = requestContext.getHeaderString(Constants.HttpHeaders.TRANSACTION_ID);
+ if (requestId == null || requestId.isEmpty()) {
+ requestId = requestContext.getHeaderString(Constants.HttpHeaders.ECOMP_REQUEST_ID);
+ if (requestId == null || requestId.isEmpty()) {
+ return requestId;
+ }
+ }
+ }
+ }
+ if (requestContext.getHeaders().get(ONAPLogConstants.Headers.REQUEST_ID) != null) {
+ requestContext.getHeaders().get(ONAPLogConstants.Headers.REQUEST_ID).clear();
+ }
+ if (requestContext.getHeaders().get(Constants.HttpHeaders.TRANSACTION_ID) != null) {
+ requestContext.getHeaders().get(Constants.HttpHeaders.TRANSACTION_ID).clear();
+ }
+ if (requestContext.getHeaders().get(Constants.HttpHeaders.HEADER_REQUEST_ID) != null) {
+ requestContext.getHeaders().get(Constants.HttpHeaders.HEADER_REQUEST_ID).clear();
+ }
+ if (requestContext.getHeaders().get(Constants.HttpHeaders.ECOMP_REQUEST_ID) != null) {
+ requestContext.getHeaders().get(Constants.HttpHeaders.ECOMP_REQUEST_ID).clear();
+ }
+ requestContext.getHeaders().add(Constants.HttpHeaders.TRANSACTION_ID, requestId);
+
+ return requestId;
+ }
+ public String getPartnerName(ContainerRequestContext requestContext) {
+ String partnerName = requestContext.getHeaderString(ONAPLogConstants.Headers.PARTNER_NAME);
+ if (partnerName == null || (partnerName.isEmpty())) {
+ partnerName = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
+ if (partnerName == null || (partnerName.isEmpty())) {
+ return partnerName;
+ }
+ }
+ if (requestContext.getHeaders().get(ONAPLogConstants.Headers.PARTNER_NAME) != null) {
+ requestContext.getHeaders().get(ONAPLogConstants.Headers.PARTNER_NAME).clear();
+ }
+ if (requestContext.getHeaders().get(AAIHeaderProperties.FROM_APP_ID) != null) {
+ requestContext.getHeaders().get(AAIHeaderProperties.FROM_APP_ID).clear();
+ }
+ requestContext.getHeaders().add(AAIHeaderProperties.FROM_APP_ID, partnerName);
+ return partnerName;
+ }
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/SetLoggingContext.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/SetLoggingContext.java
deleted file mode 100644
index 32802d1..0000000
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/SetLoggingContext.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 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.aai.schemaservice.interceptors.pre;
-
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
-import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-
-import javax.annotation.Priority;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.PreMatching;
-import java.io.IOException;
-
-@PreMatching
-@Priority(AAIRequestFilterPriority.SET_LOGGING_CONTEXT)
-public class SetLoggingContext extends AAIContainerFilter implements ContainerRequestFilter {
-
- @Autowired
- private Environment environment;
-
- @Autowired
- private HttpServletRequest httpServletRequest;
-
- @Override
- public void filter(ContainerRequestContext requestContext) throws IOException {
-
- String uri = httpServletRequest.getRequestURI();
- String queryString = httpServletRequest.getQueryString();
-
- if (queryString != null && !queryString.isEmpty()) {
- uri = uri + "?" + queryString;
- }
-
- String httpMethod = requestContext.getMethod();
- String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
- String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
-
- LoggingContext.init();
- LoggingContext.requestId(transId);
- LoggingContext.partnerName(fromAppId);
- LoggingContext.targetEntity(environment.getProperty("spring.application.name"));
- LoggingContext.component(fromAppId);
- LoggingContext.serviceName(httpMethod + " " + uri);
- LoggingContext.targetServiceName(httpMethod + " " + uri);
- LoggingContext.statusCode(LoggingContext.StatusCode.COMPLETE);
- }
-
-}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/TwoWaySslAuthorization.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/TwoWaySslAuthorization.java
deleted file mode 100644
index 4f69042..0000000
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/TwoWaySslAuthorization.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 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.aai.schemaservice.interceptors.pre;
-
-import org.onap.aai.auth.AAIAuthCore;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.restcore.HttpMethod;
-import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
-import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-
-import javax.annotation.Priority;
-import javax.security.auth.x500.X500Principal;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.PreMatching;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.security.cert.X509Certificate;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@PreMatching
-@Priority(AAIRequestFilterPriority.AUTHORIZATION)
-@Profile("two-way-ssl")
-public class TwoWaySslAuthorization extends AAIContainerFilter implements ContainerRequestFilter {
-
- private static final String PATCH = "PATCH";
-
- @Autowired
- private HttpServletRequest httpServletRequest;
-
- @Autowired
- private AAIAuthCore aaiAuthCore;
-
- @Override
- public void filter(ContainerRequestContext requestContext) {
-
- Optional<Response> oResp;
-
- String uri = requestContext.getUriInfo().getAbsolutePath().getPath();
- String httpMethod = getHttpMethod(requestContext);
-
- List<MediaType> acceptHeaderValues = requestContext.getAcceptableMediaTypes();
-
- Optional<String> authUser = getUser(this.httpServletRequest);
-
- if (authUser.isPresent()) {
- oResp = this.authorize(uri, httpMethod, acceptHeaderValues, authUser.get(),
- this.getHaProxyUser(this.httpServletRequest), getCertIssuer(this.httpServletRequest));
- if (oResp.isPresent()) {
- requestContext.abortWith(oResp.get());
- return;
- }
- } else {
- AAIException aaie = new AAIException("AAI_9107");
- requestContext
- .abortWith(Response
- .status(aaie.getErrorObject().getHTTPResponseCode()).entity(ErrorLogHelper
- .getRESTAPIErrorResponseWithLogging(acceptHeaderValues, aaie, new ArrayList<>()))
- .build());
- }
-
- }
-
- private String getCertIssuer(HttpServletRequest hsr) {
- String issuer = hsr.getHeader("X-AAI-SSL-Issuer");
- if (issuer != null && !issuer.isEmpty()) {
- // the haproxy header replaces the ', ' with '/' and reverses on the '/' need to undo that.
- List<String> broken = Arrays.asList(issuer.split("/"));
- broken = broken.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
- Collections.reverse(broken);
- issuer = String.join(", ", broken);
- } else {
- if (hsr.getAttribute("javax.servlet.request.cipher_suite") != null) {
- X509Certificate[] certChain = (X509Certificate[]) hsr.getAttribute("javax.servlet.request.X509Certificate");
- if (certChain != null && certChain.length > 0) {
- X509Certificate clientCert = certChain[0];
- issuer = clientCert.getIssuerX500Principal().getName();
- }
- }
- }
- return issuer;
- }
-
- private String getHttpMethod(ContainerRequestContext requestContext) {
- String httpMethod = requestContext.getMethod();
- if (javax.ws.rs.HttpMethod.POST.equalsIgnoreCase(httpMethod)
- && PATCH.equals(requestContext.getHeaderString(AAIHeaderProperties.HTTP_METHOD_OVERRIDE))) {
- httpMethod = HttpMethod.MERGE_PATCH.toString();
- }
- if (httpMethod.equalsIgnoreCase(HttpMethod.MERGE_PATCH.toString()) || PATCH.equalsIgnoreCase(httpMethod)) {
- httpMethod = HttpMethod.PUT.toString();
- }
- return httpMethod;
- }
-
- private Optional<String> getUser(HttpServletRequest hsr) {
- String authUser = null;
- if (hsr.getAttribute("javax.servlet.request.cipher_suite") != null) {
- X509Certificate[] certChain = (X509Certificate[]) hsr.getAttribute("javax.servlet.request.X509Certificate");
-
- /*
- * If the certificate is null or the certificate chain length is zero Then
- * retrieve the authorization in the request header Authorization Check that it
- * is not null and that it starts with Basic and then strip the basic portion to
- * get the base64 credentials Check if this is contained in the AAIBasicAuth
- * Singleton class If it is, retrieve the username associated with that
- * credentials and set to authUser Otherwise, get the principal from certificate
- * and use that authUser
- */
-
- if (certChain == null || certChain.length == 0) {
-
- String authorization = hsr.getHeader("Authorization");
-
- if (authorization != null && authorization.startsWith("Basic ")) {
- authUser = authorization.substring(6);
- }
-
- } else {
- X509Certificate clientCert = certChain[0];
- X500Principal subjectDN = clientCert.getSubjectX500Principal();
- authUser = subjectDN.toString().toLowerCase();
- }
- }
-
- return Optional.ofNullable(authUser);
- }
-
- private String getHaProxyUser(HttpServletRequest hsr) {
- String haProxyUser;
- if (Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-CN"))
- || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-OU"))
- || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-O"))
- || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-L"))
- || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-ST"))
- || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-C"))) {
- haProxyUser = "";
- } else {
- haProxyUser = String.format("CN=%s, OU=%s, O=\"%s\", L=%s, ST=%s, C=%s",
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-CN"), ""),
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-OU"), ""),
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-O"), ""),
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-L"), ""),
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-ST"), ""),
- Objects.toString(hsr.getHeader("X-AAI-SSL-Client-C"), "")).toLowerCase();
- }
- return haProxyUser;
- }
-
- private Optional<Response> authorize(String uri, String httpMethod, List<MediaType> acceptHeaderValues,
- String authUser, String haProxyUser, String issuer) {
- Response response = null;
- try {
- if (!aaiAuthCore.authorize(authUser, uri, httpMethod, haProxyUser, issuer)) {
- throw new AAIException("AAI_9101", "Request on " + httpMethod + " " + uri + " status is not OK");
- }
- } catch (AAIException e) {
- response = Response.status(e.getErrorObject().getHTTPResponseCode())
- .entity(ErrorLogHelper.getRESTAPIErrorResponseWithLogging(acceptHeaderValues, e, new ArrayList<>()))
- .build();
- }
- return Optional.ofNullable(response);
- }
-
-}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
index e372c2a..016e86f 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.nodeschema;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.CaseFormat;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
@@ -54,7 +54,7 @@ import java.util.regex.Pattern;
@Component
public class NodeIngestor {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(NodeIngestor.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(NodeIngestor.class);
private static final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\.");
private Map<SchemaVersion, DynamicJAXBContext> versionContextMap = new TreeMap<>();
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
index 07f4cf4..8c6399b 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.nodeschema;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.onap.aai.logging.LogFormatTools;
import org.springframework.stereotype.Service;
@@ -38,7 +38,7 @@ import java.util.Optional;
@Service
public class NodeSchemaService {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(NodeSchemaResource.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(NodeSchemaResource.class);
private SchemaVersions schemaVersions;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryService.java
index badb09a..1e67bd9 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryService.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.query;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -35,7 +35,7 @@ import java.util.stream.Stream;
@Service
public class QueryService {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(QueryService.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(QueryService.class);
private String queryLocation;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/service/AuthorizationService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/service/AuthorizationService.java
index 1a83aa5..766e56c 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/service/AuthorizationService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/service/AuthorizationService.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice.service;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.eclipse.jetty.util.security.Password;
import org.onap.aai.schemaservice.Profiles;
import org.onap.aai.util.AAIConstants;
@@ -41,7 +41,7 @@ import java.util.stream.Stream;
@Service
public class AuthorizationService {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(AuthorizationService.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuthorizationService.class);
private final Map<String, String> authorizedUsers = new HashMap<>();
@@ -72,7 +72,7 @@ public class AuthorizationService {
String[] usernamePasswordArray = usernamePassword.split(":");
if(usernamePasswordArray == null || usernamePasswordArray.length != 3){
- throw new RuntimeException("Not a valid entry for the realm.properties entry: " + usernamePassword);
+ throw new RuntimeException("This username / pwd is not a valid entry in realm.properties");
}
String username = usernamePasswordArray[0];
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
index 9fbe3a5..3023fab 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
@@ -38,6 +38,8 @@ import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import java.util.stream.Collectors;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
+
@Component
public class JerseyConfiguration extends ResourceConfig {
@@ -58,19 +60,19 @@ public class JerseyConfiguration extends ResourceConfig {
register(EdgeResource.class);
//Request Filters
- registerFiltersForRequests();
- // Response Filters
- registerFiltersForResponses();
+ registerFilters(ContainerRequestFilter.class);
+ registerFilters(ContainerResponseFilter.class);
+ registerFilters(AuditLogContainerFilter.class);
}
- public void registerFiltersForRequests() {
+ public <T> void registerFilters(Class<T> type) {
- // Find all the classes within the interceptors package
+ Reflections loggingReflections = new Reflections("org.onap.aai.aailog.filter");
Reflections reflections = new Reflections("org.onap.aai.schemaservice.interceptors");
// Filter them based on the clazz that was passed in
- Set<Class<? extends ContainerRequestFilter>> filters = reflections.getSubTypesOf(ContainerRequestFilter.class);
-
+ Set<Class<? extends T>> filters = loggingReflections.getSubTypesOf(type);
+ filters.addAll(reflections.getSubTypesOf(type));
// Check to ensure that each of the filter has the @Priority annotation and if not throw exception
for (Class filterClass : filters) {
@@ -80,7 +82,7 @@ public class JerseyConfiguration extends ResourceConfig {
}
// Turn the set back into a list
- List<Class<? extends ContainerRequestFilter>> filtersList = filters
+ List<Class<? extends T>> filtersList = filters
.stream()
.filter(f -> {
if (f.isAnnotationPresent(Profile.class)
@@ -98,36 +100,5 @@ public class JerseyConfiguration extends ResourceConfig {
filtersList.forEach(this::register);
}
- public void registerFiltersForResponses() {
-
- // Find all the classes within the interceptors package
- Reflections reflections = new Reflections("org.onap.aai.schemaservice.interceptors");
- // Filter them based on the clazz that was passed in
- Set<Class<? extends ContainerResponseFilter>> filters = reflections.getSubTypesOf(ContainerResponseFilter.class);
-
- // Check to ensure that each of the filter has the @Priority annotation and if not throw exception
- for (Class filterClass : filters) {
- if (filterClass.getAnnotation(Priority.class) == null) {
- throw new RuntimeException("Container filter " + filterClass.getName() + " does not have @Priority annotation");
- }
- }
-
- // Turn the set back into a list
- List<Class<? extends ContainerResponseFilter>> filtersList = filters.stream()
- .filter(f -> {
- if (f.isAnnotationPresent(Profile.class)
- && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
- return false;
- }
- return true;
- })
- .collect(Collectors.toList());
-
- // Sort them by their priority levels value
- filtersList.sort((c1, c2) -> Integer.valueOf(c1.getAnnotation(Priority.class).value()).compareTo(c2.getAnnotation(Priority.class).value()));
-
- // Then register this to the jersey application
- filtersList.forEach(this::register);
- }
}
diff --git a/aai-schema-service/src/main/resources/etc/appprops/error.properties b/aai-schema-service/src/main/resources/etc/appprops/error.properties
index 222c6b3..5b6850e 100644
--- a/aai-schema-service/src/main/resources/etc/appprops/error.properties
+++ b/aai-schema-service/src/main/resources/etc/appprops/error.properties
@@ -3,181 +3,182 @@
#Key=Disposition:Category:Severity:Error Code:HTTP ResponseCode:RESTError Code:Error Message
#------------------------------------------------------------------------------- ----------
# testing code, please don't change unless error utility source code changes
-AAI_TESTING=5:2:WARN:0000:400:0001:Error code for testing
+AAI_TESTING=5:2:WARN:0000:400:0001:Error code for testing:0
# General success
-AAI_0000=0:0:INFO:0000:200:0000:Success
+AAI_0000=0:0:INFO:0000:200:0000:Success:0
# health check success
-AAI_0001=0:0:INFO:0001:200:0001:Success X-FromAppId=%1 X-TransactionId=%2
-AAI_0002=0:0:INFO:0002:200:0001:Successful health check
+AAI_0001=0:0:INFO:0001:200:0001:Success X-FromAppId=%1 X-TransactionId=%2:0
+AAI_0002=0:0:INFO:0002:200:0001:Successful health check:0
# Success with additional info
-AAI_0003=0:3:INFO:0003:202:0003:Success with additional info performing %1 on %2. Added %3 with key %4
-AAI_0004=0:3:INFO:0004:202:0003:Added prerequisite object to db
+AAI_0003=0:3:INFO:0003:202:0003:Success with additional info performing %1 on %2. Added %3 with key %4:0
+AAI_0004=0:3:INFO:0004:202:0003:Added prerequisite object to db:0
#--- aairest: 3000-3299
# svc errors
-AAI_3000=5:2:INFO:3000:400:3000:Invalid input performing %1 on %2
-AAI_3001=5:6:INFO:3001:404:3001:Resource not found for %1 using id %2
-AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2
-AAI_3003=5:1:WARN:3003:400:3003:Failed to make edge to missing target node of type %3 with keys %4 performing %1 on %2
-AAI_3005=5:6:WARN:3005:404:3001:Node cannot be directly accessed for read, must be accessed via ancestor(s)
-AAI_3006=5:6:WARN:3006:404:3001:Node cannot be directly accessed for write, must be accessed via ancestor(s)
-AAI_3007=5:6:INFO:3007:410:3007:This version (%1) of the API is retired, please migrate to %2
-AAI_3008=5:6:WARN:3008:400:3008:URI is not encoded in UTF-8
-AAI_3009=5:6:WARN:3009:400:3002:Malformed URL
-AAI_3010=5:6:WARN:3010:400:3002:Cannot write via this URL
-AAI_3011=5:6:WARN:3011:400:3000:Unknown XML namespace used in payload
-AAI_3012=5:6:WARN:3012:400:3012:Unrecognized AAI function
-AAI_3013=5:6:WARN:3013:400:3013:Query payload missing required parameters %1
-AAI_3014=5:6:WARN:3014:400:3014:Query payload is invalid %1
-AAI_3015=5:6:INFO:3015:410:3015:The %1 capability is retired, please contact the A&AI SE team to identify a replacement query
-AAI_3016=5:6:INFO:3007:400:3016:Request uri is not valid, please check the version %1
-AAI_3017=5:6:INFO:3007:400:3016:Request uri is not valid, please check the uri %1
-AAI_3018=5:6:INFO:3018:400:3018:Request schema version %1 is not valid, please check the schema version
-AAI_3019=5:6:WARN:3019:400:3019:Request contains invalid header accept type
+AAI_3000=5:2:INFO:3000:400:3000:Invalid input performing %1 on %2:300
+AAI_3001=5:6:INFO:3001:404:3001:Resource not found for %1 using id %2:300
+AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2:300
+AAI_3003=5:1:WARN:3003:400:3003:Failed to make edge to missing target node of type %3 with keys %4 performing %1 on %2:400
+AAI_3005=5:6:WARN:3005:404:3001:Node cannot be directly accessed for read, must be accessed via ancestor(s):100
+AAI_3006=5:6:WARN:3006:404:3001:Node cannot be directly accessed for write, must be accessed via ancestor(s):100
+AAI_3007=5:6:INFO:3007:410:3007:This version (%1) of the API is retired, please migrate to %2:500
+AAI_3008=5:6:WARN:3008:400:3008:URI is not encoded in UTF-8:300
+AAI_3009=5:6:WARN:3009:400:3002:Malformed URL:300
+AAI_3010=5:6:WARN:3010:400:3002:Cannot write via this URL:100
+AAI_3011=5:6:WARN:3011:400:3000:Unknown XML namespace used in payload:300
+AAI_3012=5:6:WARN:3012:400:3012:Unrecognized AAI function:300
+AAI_3013=5:6:WARN:3013:400:3013:Query payload missing required parameters %1:300
+AAI_3014=5:6:WARN:3014:400:3014:Query payload is invalid %1:300
+AAI_3015=5:6:INFO:3015:410:3015:The %1 capability is retired, please contact the A&AI SE team to identify a replacement query:500
+AAI_3016=5:6:INFO:3007:400:3016:Request uri is not valid, please check the version %1:500
+AAI_3017=5:6:INFO:3007:400:3016:Request uri is not valid, please check the uri %1:500
+AAI_3018=5:6:INFO:3018:400:3018:Request schema version %1 is not valid, please check the schema version:400
+AAI_3019=5:6:WARN:3019:400:3019:Request contains invalid header accept type:300
-AAI_3050=5:1:WARN:3002:400:3002:Invalid request, missing or empty query parameter version
-AAI_3051=5:1:WARN:3002:400:3002:Invalid request, version parameter %1 passed is not conforming to the following pattern v[1-9][0-9]*
+AAI_3050=5:1:WARN:3002:400:3002:Invalid request, missing or empty query parameter version:300
+AAI_3051=5:1:WARN:3002:400:3002:Invalid request, version parameter %1 passed is not conforming to the following pattern v[1-9][0-9]*:300
# pol errors
-AAI_3100=5:1:WARN:3100:400:3100:Unsupported operation %1
-AAI_3101=5:1:WARN:3101:403:3101:Attempt by client %1 to execute API %2
-AAI_3102=5:1:WARN:3102:400:3102:Error parsing input performing %1 on %2
-AAI_3300=5:1:WARN:3300:403:3300:Unauthorized
-AAI_3301=5:1:WARN:3301:401:3301:Stale credentials
-AAI_3302=5:1:WARN:3302:401:3301:Not authenticated
-AAI_3303=5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry
+AAI_3100=5:1:WARN:3100:400:3100:Unsupported operation %1:300
+AAI_3101=5:1:WARN:3101:403:3101:Attempt by client %1 to execute API %2:100
+AAI_3102=5:1:WARN:3102:400:3102:Error parsing input performing %1 on %2:200
+AAI_3300=5:1:WARN:3300:403:3300:Unauthorized:100
+AAI_3301=5:1:WARN:3301:401:3301:Stale credentials:100
+AAI_3302=5:1:WARN:3302:401:3301:Not authenticated:100
+AAI_3303=5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry:500
#--- aaigen: 4000-4099
-AAI_4000=5:4:ERROR:4000:500:3002:Internal Error
-AAI_4001=5:4:FATAL:4001:500:3002:Configuration file not found
-AAI_4002=5:4:FATAL:4002:500:3002:Error reading Configuration file
-AAI_4003=5:4:ERROR:4003:500:3002:Error writing to log file
-AAI_4004=5:4:FATAL:4004:500:3002:Error reading/parsing the error properties file
-AAI_4005=5:4:FATAL:4005:500:3002:Missing or invalid configuration parameter
-AAI_4006=5:4:FATAL:4006:500:3002:Unexpected error in service
-AAI_4007=5:4:WARN:4007:500:3102:Input parsing error
-AAI_4008=5:4:ERROR:4008:500:3002:Output parsing error
-AAI_4009=4:0:WARN:4009:400:3000:Invalid X-FromAppId in header
-AAI_4010=4:0:WARN:4010:400:3000:Invalid X-TransactionId in header
-AAI_4011=5:4:ERROR:4011:500:3002:Missing data for REST error response
-AAI_4014=4:0:WARN:4014:400:3000:Invalid Accept header
-AAI_4015=4:0:WARN:4015:400:3000:You must provide at least one indexed property
-AAI_4016=4:0:WARN:4016:400:3000:The depth parameter must be a number or the string "all"
-AAI_4017=5:2:INFO:4017:400:3000:Could not set property
-AAI_4018=5:2:WARN:4018:400:3000:Unable to convert the string to integer
+AAI_4000=5:4:ERROR:4000:500:3002:Internal Error:900
+AAI_4001=5:4:FATAL:4001:500:3002:Configuration file not found:500
+AAI_4002=5:4:FATAL:4002:500:3002:Error reading Configuration file:500
+AAI_4003=5:4:ERROR:4003:500:3002:Error writing to log file:500
+AAI_4004=5:4:FATAL:4004:500:3002:Error reading/parsing the error properties file:500
+AAI_4005=5:4:FATAL:4005:500:3002:Missing or invalid configuration parameter:500
+AAI_4006=5:4:FATAL:4006:500:3002:Unexpected error in service:500
+AAI_4007=5:4:WARN:4007:500:3102:Input parsing error:500
+AAI_4008=5:4:ERROR:4008:500:3002:Output parsing error:500
+AAI_4009=4:0:WARN:4009:400:3000:Invalid X-FromAppId in header:300
+AAI_4010=4:0:WARN:4010:400:3000:Invalid X-TransactionId in header:300
+AAI_4011=5:4:ERROR:4011:500:3002:Missing data for REST error response:500
+AAI_4014=4:0:WARN:4014:400:3000:Invalid Accept header:300
+AAI_4015=4:0:WARN:4015:400:3000:You must provide at least one indexed property:400
+AAI_4016=4:0:WARN:4016:400:3000:The depth parameter must be a number or the string "all":300
+AAI_4017=5:2:INFO:4017:400:3000:Could not set property:300
+AAI_4018=5:2:WARN:4018:400:3000:Unable to convert the string to integer:500
#--- aaidbmap: 5102-5199
-AAI_5102=5:4:FATAL:5102:500:3002:Graph database is null after open
-AAI_5105=5:4:ERROR:5105:500:3002:Unexpected error reading/updating database
-AAI_5106=5:4:WARN:5106:404:3001:Node not found
-AAI_5107=5:2:WARN:5107:400:3000:Required information missing
-AAI_5108=5:2:WARN:5108:200:0:Unexpected information in request being ignored
+AAI_5102=5:4:FATAL:5102:500:3002:Graph database is null after open:400
+AAI_5105=5:4:ERROR:5105:500:3002:Unexpected error reading/updating database:300
+AAI_5106=5:4:WARN:5106:404:3001:Node not found:300
+AAI_5107=5:2:WARN:5107:400:3000:Required information missing:300
+AAI_5108=5:2:WARN:5108:200:0:Unexpected information in request being ignored:300
#--- aaidbgen: 6101-6199
-AAI_6101=5:4:ERROR:6101:500:3002:null JanusGraph object passed
-AAI_6102=5:4:WARN:6102:400:3000:Passed-in property is not valid for this nodeType
-AAI_6103=5:4:WARN:6103:400:3000:Required Node-property not found in input data
-AAI_6104=5:4:WARN:6104:400:3000:Required Node-property was passed with no data
-AAI_6105=5:4:WARN:6105:400:3000:Node-Key-Property not defined in DbMaps
-AAI_6106=5:4:WARN:6106:400:3000:Passed-in property is not valid for this edgeType
-AAI_6107=5:4:WARN:6107:400:3000:Required Edge-property not found in input data
-AAI_6108=5:4:WARN:6108:400:3000:Required Edge-property was passed with no data
-AAI_6109=5:4:WARN:6109:400:3000:Bad dependent Node value
-AAI_6110=5:4:ERROR:6110:400:3100:Node cannot be deleted
-AAI_6111=5:4:WARN:6111:400:3000:JSON processing error
-AAI_6112=5:4:ERROR:6112:400:3000:More than one node found by getUniqueNode()
-AAI_6114=5:4:INFO:6114:404:3001:Node Not Found
-AAI_6115=5:4:ERROR:6115:400:3000:Unrecognized NodeType
-AAI_6116=5:4:ERROR:6116:400:3000:Unrecognized Property
-AAI_6117=5:4:ERROR:6117:400:3000:Uniqueness constraint violated
-AAI_6118=5:4:WARN:6118:400:3000:Required Field not passed.
-AAI_6120=5:4:WARN:6120:400:3000:Bad Parameter Passed
-AAI_6121=5:4:ERROR:6121:400:3000:Problem with internal AAI reference data
-AAI_6122=5:4:ERROR:6122:400:3000:Data Set not complete in DB for this request
-AAI_6123=5:4:ERROR:6123:500:3000:Bad Data found by DataGrooming Tool - Investigate
-AAI_6124=5:4:ERROR:6124:500:3000:File read/write error
-AAI_6125=5:4:WARN:6125:500:3000:Problem Pulling Data Set
-AAI_6126=5:4:ERROR:6126:400:3000:Edge cannot be deleted
-AAI_6127=5:4:INFO:6127:404:3001:Edge Not Found
-AAI_6128=5:4:INFO:6128:500:3000:Unexpected error
-AAI_6129=5:4:INFO:6129:404:3003:Error making edge to target node
-AAI_6130=5:4:WARN:6130:412:3000:Precondition Required
-AAI_6131=5:4:WARN:6131:412:3000:Precondition Failed
-AAI_6132=5:4:WARN:6132:400:3000:Bad Model Definition
-AAI_6133=5:4:WARN:6133:400:3000:Bad Named Query Definition
-AAI_6134=5:4:ERROR:6134:500:6134:Could not persist transaction to storage back end. Exhausted retry amount
-AAI_6135=5:4:WARN:6135:412:3000:Resource version specified on create
-AAI_6136=5:4:ERROR:6136:400:3000:Object cannot hold multiple items
-AAI_6137=5:4:ERROR:6137:400:3000:Cannot perform writes on multiple vertices
-AAI_6138=5:4:ERROR:6138:400:3000:Cannot delete multiple vertices
-AAI_6139=5:4:ERROR:6139:404:3000:Attempted to add edge to vertex that does not exist
-AAI_6140=5:4:ERROR:6140:400:3000:Edge multiplicity violated
-AAI_6141=5:4:WARN:6141:400:3000:Please Refine Query
-AAI_6142=5:4:INFO:6142:400:3000:Retrying transaction
-AAI_6143=5:4:INFO:6143:400:3000:Ghost vertex found
-AAI_6144=5:4:WARN:6144:400:3000:Cycle found in graph
-AAI_6145=5:4:ERROR:6145:400:3000:Cannot create a nested/containment edge via relationship
-AAI_6146=5:4:ERROR:6146:400:3000:Ambiguous identity map found, use a URI instead
-AAI_6147=5:4:ERROR:6147:400:3000:Payload Limit Reached, reduce payload
+AAI_6101=5:4:ERROR:6101:500:3002:null JanusGraph object passed:400
+AAI_6102=5:4:WARN:6102:400:3000:Passed-in property is not valid for this nodeType:400
+AAI_6103=5:4:WARN:6103:400:3000:Required Node-property not found in input data:400
+AAI_6104=5:4:WARN:6104:400:3000:Required Node-property was passed with no data:400
+AAI_6105=5:4:WARN:6105:400:3000:Node-Key-Property not defined in DbMaps:400
+AAI_6106=5:4:WARN:6106:400:3000:Passed-in property is not valid for this edgeType:400
+AAI_6107=5:4:WARN:6107:400:3000:Required Edge-property not found in input data:400
+AAI_6108=5:4:WARN:6108:400:3000:Required Edge-property was passed with no data:400
+AAI_6109=5:4:WARN:6109:400:3000:Bad dependent Node value:400
+AAI_6110=5:4:ERROR:6110:400:3100:Node cannot be deleted:500
+AAI_6111=5:4:WARN:6111:400:3000:JSON processing error:300
+AAI_6112=5:4:ERROR:6112:400:3000:More than one node found by getUniqueNode():400
+AAI_6114=5:4:INFO:6114:404:3001:Node Not Found:300
+AAI_6115=5:4:ERROR:6115:400:3000:Unrecognized NodeType:400
+AAI_6116=5:4:ERROR:6116:400:3000:Unrecognized Property:400
+AAI_6117=5:4:ERROR:6117:400:3000:Uniqueness constraint violated:400
+AAI_6118=5:4:WARN:6118:400:3000:Required Field not passed.:400
+AAI_6120=5:4:WARN:6120:400:3000:Bad Parameter Passed:300
+AAI_6121=5:4:ERROR:6121:400:3000:Problem with internal AAI reference data:400
+AAI_6122=5:4:ERROR:6122:400:3000:Data Set not complete in DB for this request:400
+AAI_6123=5:4:ERROR:6123:500:3000:Bad Data found by DataGrooming Tool - Investigate:300
+AAI_6124=5:4:ERROR:6124:500:3000:File read/write error:500
+AAI_6125=5:4:WARN:6125:500:3000:Problem Pulling Data Set:500
+AAI_6126=5:4:ERROR:6126:400:3000:Edge cannot be deleted:400
+AAI_6127=5:4:INFO:6127:404:3001:Edge Not Found:400
+AAI_6128=5:4:INFO:6128:500:3000:Unexpected error:900
+AAI_6129=5:4:INFO:6129:404:3003:Error making edge to target node:400
+AAI_6130=5:4:WARN:6130:412:3000:Precondition Required:300
+AAI_6131=5:4:WARN:6131:412:3000:Precondition Failed:300
+AAI_6132=5:4:WARN:6132:400:3000:Bad Model Definition:500
+AAI_6133=5:4:WARN:6133:400:3000:Bad Named Query Definition:500
+AAI_6134=5:4:ERROR:6134:500:6134:Could not persist transaction to storage back end. Exhausted retry amount:500
+AAI_6135=5:4:WARN:6135:412:3000:Resource version specified on create:300
+AAI_6136=5:4:ERROR:6136:400:3000:Object cannot hold multiple items:400
+AAI_6137=5:4:ERROR:6137:400:3000:Cannot perform writes on multiple vertices:400
+AAI_6138=5:4:ERROR:6138:400:3000:Cannot delete multiple vertices:400
+AAI_6139=5:4:ERROR:6139:404:3000:Attempted to add edge to vertex that does not exist:400
+AAI_6140=5:4:ERROR:6140:400:3000:Edge multiplicity violated:400
+AAI_6141=5:4:WARN:6141:400:3000:Please Refine Query:400
+AAI_6142=5:4:INFO:6142:400:3000:Retrying transaction:900
+AAI_6143=5:4:INFO:6143:400:3000:Ghost vertex found:400
+AAI_6144=5:4:WARN:6144:400:3000:Cycle found in graph:400
+AAI_6145=5:4:ERROR:6145:400:3000:Cannot create a nested/containment edge via relationship:400
+AAI_6146=5:4:ERROR:6146:400:3000:Ambiguous identity map found, use a URI instead:300
+AAI_6147=5:4:ERROR:6147:400:3000:Payload Limit Reached, reduce payload:300
#--- aaicsvp: 7101-7199
-AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing
-AAI_7102=5:4:ERROR:7102:500:3002:Error in cleanup temporary directory
-#AAI_7103=4:2:ERROR:7103:500:3002:Unsupported user
-AAI_7104=5:4:ERROR:7104:500:3002:Failed to create directory
-AAI_7105=5:4:ERROR:7105:500:3002:Temporary directory exists
-AAI_7106=5:4:ERROR:7106:500:3002:Cannot delete
-AAI_7107=5:4:ERROR:7107:500:3002:Input file does not exist
-AAI_7108=5:4:ERROR:7108:500:3002:Output file does not exist
-AAI_7109=5:4:ERROR:7109:500:3002:Error closing file
-AAI_7110=5:4:ERROR:7110:500:3002:Error loading/reading properties file
-AAI_7111=5:4:ERROR:7111:500:3002:Error executing shell script
-AAI_7112=5:4:ERROR:7112:500:3002:Error creating output file
-AAI_7113=5:4:ERROR:7113:500:3002:Trailer record error
-AAI_7114=5:4:ERROR:7114:500:3002:Input file error
-AAI_7115=5:4:ERROR:7115:500:3002:Unexpected error
-AAI_7116=5:4:ERROR:7116:500:3002:Request error
-AAI_7117=5:4:ERROR:7117:500:3002:Error in get http client object
-AAI_7118=5:4:ERROR:7118:500:3002:Script Error
-AAI_7119=5:4:ERROR:7119:500:3002:Unknown host
+AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing:900
+AAI_7102=5:4:ERROR:7102:500:3002:Error in cleanup temporary directory:500
+#AAI_7103=4:2:ERROR:7103:500:3002:Unsupported user:100
+AAI_7104=5:4:ERROR:7104:500:3002:Failed to create directory:500
+AAI_7105=5:4:ERROR:7105:500:3002:Temporary directory exists:500
+AAI_7106=5:4:ERROR:7106:500:3002:Cannot delete:500
+AAI_7107=5:4:ERROR:7107:500:3002:Input file does not exist:500
+AAI_7108=5:4:ERROR:7108:500:3002:Output file does not exist:500
+AAI_7109=5:4:ERROR:7109:500:3002:Error closing file:500
+AAI_7110=5:4:ERROR:7110:500:3002:Error loading/reading properties file:500
+AAI_7111=5:4:ERROR:7111:500:3002:Error executing shell script:900
+AAI_7112=5:4:ERROR:7112:500:3002:Error creating output file:500
+AAI_7113=5:4:ERROR:7113:500:3002:Trailer record error:300
+AAI_7114=5:4:ERROR:7114:500:3002:Input file error:300
+AAI_7115=5:4:ERROR:7115:500:3002:Unexpected error:900
+AAI_7116=5:4:ERROR:7116:500:3002:Request error:900
+AAI_7117=5:4:ERROR:7117:500:3002:Error in get http client object:500
+AAI_7118=5:4:ERROR:7118:500:3002:Script Error:900
+AAI_7119=5:4:ERROR:7119:500:3002:Unknown host:900
#--- aaisdnc: 7201-7299
-AAI_7202=5:4:ERROR:7202:500:3002:Error getting connection to odl
-#AAI_7206=5:4:ERROR:7206:500:3002:Invalid data returned from ODL
+AAI_7202=5:4:ERROR:7202:500:3002:Error getting connection to odl:200
+#AAI_7206=5:4:ERROR:7206:500:3002:Invalid data returned from ODL:300
-#--- NotificationEvent, using UEB space
-AAI_7350=5:4:ERROR:7305:500:3002:Notification event creation failed
+#--- DMaaP related errors
+AAI_7304=4:5:ERROR:7304:500:3002:Error reaching DMaaP to send event:200
+AAI_7350=5:4:ERROR:7305:500:3002:Notification event creation failed:500
#--- aairestctlr: 7401-7499
-AAI_7401=5:4:ERROR:7401:500:3002:Error connecting to AAI REST API
-AAI_7402=5:4:ERROR:7402:500:3002:Unexpected error
-AAI_7403=5:4:WARN:7403:400:3001:Request error
-AAI_7404=5:4:INFO:7404:404:3001:Node not found
-AAI_7405=5:4:WARN:7405:200:0:UUID not formatted correctly, generating UUID
-AAI_7406=5:4:ERROR:7406:400:7406:Request Timed Out
+AAI_7401=5:4:ERROR:7401:500:3002:Error connecting to AAI REST API:200
+AAI_7402=5:4:ERROR:7402:500:3002:Unexpected error:900
+AAI_7403=5:4:WARN:7403:400:3001:Request error:900
+AAI_7404=5:4:INFO:7404:404:3001:Node not found:300
+AAI_7405=5:4:WARN:7405:200:0:UUID not formatted correctly, generating UUID:300
+AAI_7406=5:4:ERROR:7406:400:7406:Request Timed Out:500
#--- aaicsiovals: 7501-7599
-#AAI_7501=5:4:WARN:7501:500:3002:Error getting connection to CSI-OVALS
-AAI_7502=5:4:WARN:7502:500:3002:Bad parameter when trying to build request for CSI-OVALS
-AAI_7503=5:4:WARN:7503:500:3002:Error returned by CSI-OVALS
+#AAI_7501=5:4:WARN:7501:500:3002:Error getting connection to CSI-OVALS:200
+AAI_7502=5:4:WARN:7502:500:3002:Bad parameter when trying to build request for CSI-OVALS:300
+AAI_7503=5:4:WARN:7503:500:3002:Error returned by CSI-OVALS:500
#--- aaiauth: 9101-9199
-AAI_9101=5:0:WARN:9101:403:3300:User is not authorized to perform function
-#AAI_9102=5:0:WARN:9102:401:3301:Refresh credentials from source
-#AAI_9103=5:0:WARN:9103:403:3300:User not found
-#AAI_9104=5:0:WARN:9104:401:3302:Authentication error
-#AAI_9105=5:0:WARN:9105:403:3300:Authorization error
-#AAI_9106=5:0:WARN:9106:403:3300:Invalid AppId
-#AAI_9107=5:0:WARN:9107:403:3300:No Username in Request
-AAI_9107=5:0:WARN:9107:403:3300:SSL is not provided in request, please contact admin
-AAI_9108=5:0:WARN:9107:403:3300:Basic auth credentials is not provided in the request
+AAI_9101=5:0:WARN:9101:403:3300:User is not authorized to perform function:100
+#AAI_9102=5:0:WARN:9102:401:3301:Refresh credentials from source:100
+#AAI_9103=5:0:WARN:9103:403:3300:User not found:100
+#AAI_9104=5:0:WARN:9104:401:3302:Authentication error:100
+#AAI_9105=5:0:WARN:9105:403:3300:Authorization error:100
+#AAI_9106=5:0:WARN:9106:403:3300:Invalid AppId:300
+#AAI_9107=5:0:WARN:9107:403:3300:No Username in Request:100
+AAI_9107=5:0:WARN:9107:403:3300:SSL is not provided in request, please contact admin:100
+AAI_9108=5:0:WARN:9107:403:3300:Basic auth credentials is not provided in the request:100
#--- aaiinstar: 9201-9299
-#AAI_9201=5:4:ERROR:9201:500:3002:Unable to send notification
-AAI_9202=5:4:ERROR:9202:500:3002:Unable to start a thread
+#AAI_9201=5:4:ERROR:9201:500:3002:Unable to send notification:200
+AAI_9202=5:4:ERROR:9202:500:3002:Unable to start a thread:500
#--- GRM DME2: 9501-9599
-AAI_9501=5:4:WARN:9501:500:3002:Unable to register with GRM retrying
-AAI_9502=5:4:ERROR:9502:500:3002:Unable to register with GRM after exhausting all retries
-AAI_9503=5:4:WARN:9503:500:3002:Unable to successfully unpublish with GRM, recommend manual cleanup but not necessary
+AAI_9501=5:4:WARN:9501:500:3002:Unable to register with GRM retrying:200
+AAI_9502=5:4:ERROR:9502:500:3002:Unable to register with GRM after exhausting all retries:200
+AAI_9503=5:4:WARN:9503:500:3002:Unable to successfully unpublish with GRM, recommend manual cleanup but not necessary:200
diff --git a/aai-schema-service/src/main/resources/logback.xml b/aai-schema-service/src/main/resources/logback.xml
index 8cc2c27..cf54995 100644
--- a/aai-schema-service/src/main/resources/logback.xml
+++ b/aai-schema-service/src/main/resources/logback.xml
@@ -30,12 +30,30 @@
<property name="AJSC_HOME" value="${AJSC_HOME:-.}"/>
<property name="logDirectory" value="${AJSC_HOME}/logs"/>
+ <!-- Old patterns
<property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
<property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
<property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
- <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> -->
+ //<property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
<property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%ecompServiceName|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
<property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%ecompServiceName|%X{partnerName}|%ecompStatusCode|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/>
+ -->
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+ <property name="p_lvl" value="%level"/>
+ <property name="p_log" value="%logger"/>
+ <property name="p_mdc" value="%replace(%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}){'\\|', '!'}"/>
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_thr" value="%thread"/>
+ <property name="pattern" 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"/>
+ <!-- Patterns from onap demo -->
+ <property name="errorPattern" value="%X{LogTimestamp}|%X{RequestID}|%thread|%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{TargetEntity}|%replace(%X{TargetServiceName}){'\\|', '!'}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+ <property name="debugPattern" value="%X{LogTimestamp}|%X{RequestID}|%msg\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t|^%n" />
+
+ <property name="auditPattern" value="%X{EntryTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||${p_mak}|${p_mdc}|||%msg%n" />
+ <property name="metricPattern" value="%X{InvokeTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%replace(%X{ServiceName}){'\\|', '!'}|%X{PartnerName}|%X{TargetEntity}|%replace(%X{TargetServiceName}){'\\|', '!'}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|${p_mak}|${p_mdc}|||%msg%n" />
+ <property name="transLogPattern" value="%X{LogTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{RequestID}|%X{ServiceInstanceID}|%-10t|%X{ServerFQDN}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%replace(%replace(%X{ResponseDesc}){'\\|', '!'}){'\r|\n', '^'}|%X{InstanceUUID}|%level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{clientIpAddress}||%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{PartnerName}:%m%n"/>
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
@@ -65,20 +83,13 @@
<appender-ref ref="SANE"/>
</appender>
- <appender name="METRIC"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>INFO</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
+ <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDirectory}/rest/metrics.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}
- </fileNamePattern>
+ <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfMetricLogPattern}</pattern>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
</encoder>
</appender>
<appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender">
@@ -99,35 +110,34 @@
<fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
</encoder>
</appender>
<appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>1000</queueSize>
- <includeCallerData>true</includeCallerData>
<appender-ref ref="DEBUG"/>
+ <includeCallerData>true</includeCallerData>
</appender>
<appender name="ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>WARN</level>
- </filter>
<file>${logDirectory}/rest/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfErrorLogPattern}</pattern>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
+ </filter>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
</encoder>
</appender>
<appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>1000</queueSize>
- <includeCallerData>true</includeCallerData>
<appender-ref ref="ERROR"/>
</appender>
@@ -138,8 +148,8 @@
<fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfAuditLogPattern}</pattern>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
</encoder>
</appender>
@@ -161,8 +171,8 @@
<fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfTransLogPattern}</pattern>
+ <encoder>
+ <pattern>${transLogPattern}</pattern>
</encoder>
</appender>
@@ -182,14 +192,33 @@
<fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
</encoder>
</appender>
+
+ <appender name="auth"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>DEBUG</level>
+ </filter>
+ <file>${logDirectory}/auth/auth.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/auth/auth.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}[%thread] %-5level %logger{1024} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncAUTH" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="auth" />
+ </appender>
+
<logger name="org.onap.aai" level="DEBUG" additivity="false">
<appender-ref ref="asyncDEBUG"/>
- <appender-ref ref="asyncERROR"/>
- <appender-ref ref="asyncMETRIC"/>
<appender-ref ref="asyncSANE"/>
</logger>
@@ -234,32 +263,29 @@
<logger name="org.eclipse.jetty" level="WARN"/>
- <logger name="org.onap.aai.schemaservice.interceptors.post" level="DEBUG"
- additivity="false">
- <appender-ref ref="asynctranslog"/>
+ <logger name="org.onap.aai.aaf.auth" level="DEBUG" additivity="false">
+ <appender-ref ref="asyncAUTH" />
</logger>
-
- <logger name="org.onap.aai.schemaservice.interceptors.pre.SetLoggingContext" level="DEBUG">
+ <logger name="org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog" level="INFO">
<appender-ref ref="asyncAUDIT"/>
</logger>
- <logger name="org.onap.aai.schemaservice.interceptors.post.ResetLoggingContext" level="DEBUG">
+ <logger name="org.onap.logging.filter.base.AbstractAuditLogFilter" level="INFO">
<appender-ref ref="asyncAUDIT"/>
</logger>
+ <logger name="org.onap.aai.logging.ErrorLogHelper" level="WARN">
+ <appender-ref ref="asyncERROR"/>
+ </logger>
+ <logger name="org.onap.aai.schemaservice.interceptors.post" level="DEBUG" additivity="false">
+ <appender-ref ref="asynctranslog" />
+ </logger>
+
<logger name="org.apache" level="OFF"/>
<logger name="org.zookeeper" level="OFF"/>
<logger name="org.janusgraph" level="WARN"/>
<logger name="com.att.aft.dme2" level="WARN"/>
- <!-- ============================================================================ -->
- <!-- General EELF logger -->
- <!-- ============================================================================ -->
- <logger name="com.att.eelf" level="WARN" additivity="false">
- <appender-ref ref="asyncDEBUG"/>
- <appender-ref ref="asyncERROR"/>
- <appender-ref ref="asyncMETRIC"/>
- </logger>
<root level="DEBUG">
<appender-ref ref="external"/>
diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
index 231fecc..308f43b 100644
--- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
+++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
@@ -105,7 +105,7 @@ public class SchemaServiceTest {
ResponseEntity responseEntity;
responseEntity = restTemplate.exchange(
- baseUrl + "/aai/schema-service/v1/nodes?version=v15",
+ baseUrl + "/aai/schema-service/v1/nodes?version=v19",
HttpMethod.GET,
httpEntity,
String.class
@@ -117,7 +117,7 @@ public class SchemaServiceTest {
httpEntity = new HttpEntity(headers);
responseEntity = restTemplate.exchange(
- baseUrl + "/aai/schema-service/v1/edgerules?version=v15",
+ baseUrl + "/aai/schema-service/v1/edgerules?version=v19",
HttpMethod.GET,
httpEntity,
String.class
diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
index 1e2de5e..f712b79 100644
--- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
+++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.schemaservice;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
@@ -46,7 +46,7 @@ import java.security.KeyStore;
@TestConfiguration
public class SchemaServiceTestConfiguration {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(SchemaServiceTestConfiguration.class);
+ private static final Logger logger = LoggerFactory.getLogger(SchemaServiceTestConfiguration.class);
@Autowired
private Environment env;
diff --git a/aai-schema-service/src/test/resources/etc/appprops/aaiconfig.properties b/aai-schema-service/src/test/resources/etc/appprops/aaiconfig.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/aai-schema-service/src/test/resources/etc/appprops/aaiconfig.properties
diff --git a/aai-schema-service/src/test/resources/logback.xml b/aai-schema-service/src/test/resources/logback.xml
index 2dd8021..e18e358 100644
--- a/aai-schema-service/src/test/resources/logback.xml
+++ b/aai-schema-service/src/test/resources/logback.xml
@@ -31,14 +31,25 @@
<property name="AJSC_HOME" value="${AJSC_HOME:-.}"/>
<jmxConfigurator/>
<property name="logDirectory" value="${AJSC_HOME}/logs"/>
- <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
- <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
- <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
- <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> -->
- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
- <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/>
-
- <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
+
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+ <property name="p_lvl" value="%level"/>
+ <property name="p_log" value="%logger"/>
+ <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_thr" value="%thread"/>
+ <property name="pattern" 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"/>
+ <!-- Patterns from onap demo -->
+ <property name="errorPattern" value="%X{LogTimestamp}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+ <property name="debugPattern" value="%X{LogTimestamp}|%X{RequestID}|%msg\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t|%n" />
+
+ <property name="auditPattern" value="%X{EntryTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||${p_mak}|${p_mdc}|||%msg%n" />
+ <property name="metricPattern" value="%X{InvokeTimestamp}|%X{LogTimestamp}|%X{RequestID}|%X{ServiceInstanceID}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|${p_mak}|${p_mdc}|||%msg%n" />
+ <property name="transLogPattern" value="%X{LogTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{RequestID}|%X{ServiceInstanceID}|%-10t|%X{ServerFQDN}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%replace(%replace(%X{ResponseDesc}){'\\|', '!'}){'\r|\n', '^'}|%X{InstanceUUID}|%level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{clientIpAddress}||%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{PartnerName}:%m%n"/>
+ <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
@@ -68,18 +79,13 @@
<appender name="METRIC"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>INFO</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
<file>${logDirectory}/rest/metrics.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfMetricLogPattern}</pattern>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
</encoder>
</appender>
<appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender">
@@ -100,8 +106,8 @@
<fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
</encoder>
</appender>
@@ -113,22 +119,21 @@
<appender name="ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>WARN</level>
- </filter>
<file>${logDirectory}/rest/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfErrorLogPattern}</pattern>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
+ </filter>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
</encoder>
</appender>
<appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>1000</queueSize>
- <includeCallerData>true</includeCallerData>
<appender-ref ref="ERROR"/>
</appender>
@@ -139,8 +144,8 @@
<fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfAuditLogPattern}</pattern>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
</encoder>
</appender>
@@ -162,8 +167,8 @@
<fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfTransLogPattern}</pattern>
+ <encoder>
+ <pattern>${transLogPattern}</pattern>
</encoder>
</appender>
@@ -183,8 +188,8 @@
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
</encoder>
</appender>
@@ -200,10 +205,28 @@
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="dmaapAAIEventConsumerInfo"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>INFO</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <File>${logDirectory}/dmaapAAIEventConsumer/dmaap-transaction.log</File>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/dmaap-transaction.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
</encoder>
</appender>
+
<appender name="dmaapAAIEventConsumerMetric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -216,8 +239,8 @@
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfMetricLogPattern}</pattern>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
</encoder>
</appender>
<appender name="external"
@@ -230,139 +253,58 @@
<fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
</encoder>
</appender>
- <logger name="org.onap.aai" level="DEBUG" additivity="true">
- <appender-ref ref="asyncDEBUG"/>
- <appender-ref ref="asyncERROR"/>
- <appender-ref ref="asyncMETRIC"/>
- <appender-ref ref="asyncSANE"/>
- </logger>
+
+ <logger name="ch.qos.logback.classic" level="WARN" />
+ <logger name="ch.qos.logback.core" level="WARN" />
+
+ <logger name="com.att.aft.dme2" level="WARN" />
+ <logger name="com.jayway.jsonpath" level="WARN" />
+
+ <logger name="org.apache" level="OFF" />
+ <logger name="org.apache.commons" level="WARN" />
+ <logger name="org.apache.zookeeper" level="OFF" />
+ <logger name="org.codehaus.groovy" level="WARN" />
+ <logger name="org.eclipse.jetty" level="WARN" />
<!-- Spring related loggers -->
<logger name="org.springframework" level="WARN"/>
<logger name="org.springframework.beans" level="WARN"/>
<logger name="org.springframework.web" level="WARN"/>
- <logger name="com.blog.spring.jms" level="WARN"/>
- <logger name="com.jayway.jsonpath" level="WARN"/>
-
- <!-- AJSC Services (bootstrap services) -->
- <logger name="ajsc" level="WARN"/>
- <logger name="ajsc.RouteMgmtService" level="WARN"/>
- <logger name="ajsc.ComputeService" level="WARN"/>
- <logger name="ajsc.VandelayService" level="WARN"/>
- <logger name="ajsc.FilePersistenceService" level="WARN"/>
- <logger name="ajsc.UserDefinedJarService" level="WARN"/>
- <logger name="ajsc.UserDefinedBeansDefService" level="WARN"/>
- <logger name="ajsc.LoggingConfigurationService" level="WARN"/>
-
- <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet
- logging) -->
- <logger name="org.codehaus.groovy" level="WARN"/>
- <logger name="com.att.scamper" level="WARN"/>
- <logger name="ajsc.utils" level="WARN"/>
- <logger name="ajsc.utils.DME2Helper" level="WARN"/>
- <logger name="ajsc.filters" level="WARN"/>
- <logger name="ajsc.beans.interceptors" level="WARN"/>
- <logger name="ajsc.restlet" level="WARN"/>
- <logger name="ajsc.servlet" level="WARN"/>
- <logger name="com.att.ajsc" level="WARN"/>
- <logger name="com.att.ajsc.csi.logging" level="WARN"/>
- <logger name="com.att.ajsc.filemonitor" level="WARN"/>
- <logger name="com.netflix.loadbalancer" level="WARN"/>
-
- <logger name="org.apache.zookeeper" level="WARN"/>
-
- <!-- Other Loggers that may help troubleshoot -->
- <logger name="net.sf" level="WARN"/>
- <logger name="org.apache.commons.httpclient" level="WARN"/>
- <logger name="org.apache.commons" level="WARN"/>
- <logger name="org.apache.coyote" level="WARN"/>
- <logger name="org.apache.jasper" level="WARN"/>
-
- <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging.
- May aid in troubleshooting) -->
- <logger name="org.apache.camel" level="WARN"/>
- <logger name="org.apache.cxf" level="WARN"/>
- <logger name="org.apache.camel.processor.interceptor" level="WARN"/>
- <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN"/>
- <logger name="org.apache.cxf.service" level="WARN"/>
- <logger name="org.restlet" level="WARN"/>
- <logger name="org.apache.camel.component.restlet" level="WARN"/>
-
- <logger name="org.hibernate.validator" level="WARN"/>
- <logger name="org.hibernate" level="WARN"/>
- <logger name="org.hibernate.ejb" level="OFF"/>
-
- <!-- logback internals logging -->
- <logger name="ch.qos.logback.classic" level="WARN"/>
- <logger name="ch.qos.logback.core" level="WARN"/>
+
+
+ <logger name="org.janusgraph" level="WARN" />
+ <logger name="org.zookeeper" level="OFF" />
+
<logger name="org.eclipse.jetty" level="WARN"/>
- <!-- 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"/>
- <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log
- </file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
- </encoder>
- </appender>
- <appender name="perfLogs"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"/>
- <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log
- </file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
- </encoder>
- </appender>
- <logger name="AuditRecord" level="INFO" additivity="false">
- <appender-ref ref="auditLogs"/>
+ <logger name="org.onap.aai" level="DEBUG" additivity="false">
+ <appender-ref ref="asyncDEBUG" />
+ <appender-ref ref="asyncSANE" />
+ <appender-ref ref="STDOUT" />
</logger>
- <logger name="AuditRecord_DirectCall" level="INFO" additivity="false">
- <appender-ref ref="auditLogs"/>
+ <logger name="org.onap.aai.aailog.logs.AaiScheduledTaskAuditLog" level="INFO">
+ <appender-ref ref="asyncAUDIT"/>
</logger>
- <logger name="PerfTrackerRecord" level="INFO" additivity="false">
- <appender-ref ref="perfLogs"/>
+ <logger name="org.onap.logging.filter.base.AbstractAuditLogFilter" level="INFO">
+ <appender-ref ref="asyncAUDIT"/>
</logger>
<!-- logback jms appenders & loggers definition ends here -->
- <logger name="org.onap.aai.schemaservice.interceptors.post" level="DEBUG"
- additivity="false">
- <appender-ref ref="asynctranslog"/>
+ <logger name="org.onap.aai.aailog.logs.AaiDBMetricLog" level="INFO">
+ <appender-ref ref="asyncMETRIC"/>
</logger>
- <logger name="org.onap.aai.schemaservice.interceptors.pre.SetLoggingContext" level="DEBUG">
- <appender-ref ref="asyncAUDIT"/>
+ <logger name="org.onap.aai.logging.ErrorLogHelper" level="WARN">
+ <appender-ref ref="asyncERROR"/>
</logger>
- <logger name="org.onap.aai.schemaservice.interceptors.post.ResetLoggingContext" level="DEBUG">
- <appender-ref ref="asyncAUDIT"/>
+ <logger name="org.onap.aai.interceptors.post" level="DEBUG" additivity="false">
+ <appender-ref ref="asynctranslog" />
</logger>
<logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false">
@@ -371,10 +313,9 @@
<appender-ref ref="dmaapAAIEventConsumerMetric"/>
</logger>
- <logger name="org.apache" level="WARN"/>
- <logger name="org.zookeeper" level="WARN"/>
- <logger name="org.janusgraph" level="WARN"/>
- <logger name="com.att.aft.dme2" level="WARN"/>
+ <logger name="com.att.nsa.mr" level="INFO" >
+ <appender-ref ref="dmaapAAIEventConsumerInfo" />
+ </logger>
<!-- ============================================================================ -->
<!-- General EELF logger -->
diff --git a/aai-schema/pom.xml b/aai-schema/pom.xml
index 518ea41..1e49f7d 100644
--- a/aai-schema/pom.xml
+++ b/aai-schema/pom.xml
@@ -66,6 +66,10 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java b/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
index 0dcf1b3..527e6b7 100644
--- a/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
+++ b/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
@@ -19,16 +19,18 @@
*/
package org.onap.aai.schema;
-
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.FileFileFilter;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.RegexFileFilter;
import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.junit.Ignore;
+import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
@@ -45,86 +47,99 @@ import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class ValidateOXMTest {
- @Test
- public void testFindXmlPropContainingSpace() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
- boolean foundIssue = false;
- List<File> fileList = getLatestFiles();
-
- StringBuilder msg = new StringBuilder();
- for (File file : fileList) {
- msg.append(file.getAbsolutePath().replaceAll(".*aai-schema", ""));
- msg.append("\n");
- Document xmlDocument = getDocument(file);
- XPath xPath = XPathFactory.newInstance().newXPath();
- String expression = "/xml-bindings/java-types/java-type/xml-properties/xml-property[@name!='description' and contains(@value,' ')]";
- NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- foundIssue = true;
- msg.append("\t");
- msg.append(nodeList.item(i).getParentNode().getParentNode().getAttributes().getNamedItem("name").getNodeValue());
- msg.append("\n");
- msg.append("\t");
- msg.append("\n");
- }
-
- }
-
- if (foundIssue) {
- System.out.println(msg.toString());
- fail("Node type xml-property should have space.");
- }
-
- }
-
- /**
- * Verifies that all of the node types in the oxm's have their uri templates.
- * @throws XPathExpressionException
- * @throws IOException
- * @throws SAXException
- * @throws ParserConfigurationException
- */
- @Test
- public void allNodeTypesHaveAAIUriTemplate() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
- boolean foundIssue = false;
- List<File> fileList = getFiles();
-
- StringBuilder msg = new StringBuilder();
- for (File file : fileList) {
- msg.append(file.getAbsolutePath().replaceAll(".*aai-schema", ""));
- msg.append("\n");
- Document xmlDocument = getDocument(file);
- XPath xPath = XPathFactory.newInstance().newXPath();
- String expression = "/xml-bindings/java-types/java-type[" +
- "(" +
- "count(xml-properties/xml-property[@name='container']) > 0 " +
- "or count(xml-properties/xml-property[@name='dependentOn']) > 0" +
- ") " +
- "and count(xml-properties/xml-property[@name='uriTemplate']) = 0 " +
- "]";
- NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- String name = nodeList.item(i).getAttributes().getNamedItem("name").getNodeValue();
- if (name.equals("InstanceFilter") || name.equals("InventoryResponseItems") || name.equals("InventoryResponseItem")) {
- continue;
- }
- foundIssue = true;
- msg.append("\t");
- msg.append(name);
- msg.append("\n");
- }
- }
- if (foundIssue) {
- System.out.println(msg.toString());
- fail("Missing uriTemplate in oxm.");
- }
-
- }
+ private String DBEDGERULES_RULES = "rules";
+ private String DBEDGERULES_FROM = "from";
+ private String DBEDGERULES_TO = "to";
+ private String DBEDGERULES_DIRECTION = "direction";
+ private String DBEDGERULES_CONTAINS_OTHER_V = "contains-other-v";
+ private String DBEDGERULES_OUT = "OUT";
+ private String DBEDGERULES_IN = "IN";
+ private String XMLROOTELEMENT = "xml-root-element";
+ private String ECOMP = "ecomp";
+ private String NARAD = "narad";
+ private String ONAP = "onap";
+
+ @Test
+ public void testFindXmlPropContainingSpace() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
+ boolean foundIssue = false;
+ List<File> fileList = getLatestFiles();
+
+ StringBuilder msg = new StringBuilder();
+ for (File file : fileList) {
+ msg.append(file.getAbsolutePath().replaceAll(".*aai-schema", ""));
+ msg.append("\n");
+ Document xmlDocument = getDocument(file);
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ String expression = "/xml-bindings/java-types/java-type/xml-properties/xml-property[@name!='description' and contains(@value,' ')]";
+ NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ foundIssue = true;
+ msg.append("\t");
+ msg.append(nodeList.item(i).getParentNode().getParentNode().getAttributes().getNamedItem("name").getNodeValue());
+ msg.append("\n");
+ msg.append("\t");
+ msg.append("\n");
+ }
+
+ }
+
+ if (foundIssue) {
+ System.out.println(msg.toString());
+ fail("Node type xml-property should have space.");
+ }
+
+ }
+
+ /**
+ * Verifies that all of the node types in the oxm's have their uri templates.
+ * @throws XPathExpressionException
+ * @throws IOException
+ * @throws SAXException
+ * @throws ParserConfigurationException
+ */
+ @Test
+ public void allNodeTypesHaveAAIUriTemplate() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException {
+ boolean foundIssue = false;
+ List<File> fileList = getFiles();
+
+ StringBuilder msg = new StringBuilder();
+ for (File file : fileList) {
+ msg.append(file.getAbsolutePath().replaceAll(".*aai-schema", ""));
+ msg.append("\n");
+ Document xmlDocument = getDocument(file);
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ String expression = "/xml-bindings/java-types/java-type[" +
+ "(" +
+ "count(xml-properties/xml-property[@name='container']) > 0 " +
+ "or count(xml-properties/xml-property[@name='dependentOn']) > 0" +
+ ") " +
+ "and count(xml-properties/xml-property[@name='uriTemplate']) = 0 " +
+ "]";
+ NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ String name = nodeList.item(i).getAttributes().getNamedItem("name").getNodeValue();
+ if (name.equals("InstanceFilter") || name.equals("InventoryResponseItems") || name.equals("InventoryResponseItem")) {
+ continue;
+ }
+ foundIssue = true;
+ msg.append("\t");
+ msg.append(name);
+ msg.append("\n");
+ }
+ }
+ if (foundIssue) {
+ System.out.println(msg.toString());
+ fail("Missing uriTemplate in oxm.");
+ }
+
+ }
/**
@@ -186,17 +201,309 @@ public class ValidateOXMTest {
}
- private List<File> getFiles() {
- Path currentRelativePath = Paths.get("../aai-schema/src/main/resources/").toAbsolutePath();
- return FileUtils.listFiles(
- currentRelativePath.toFile(),
- new RegexFileFilter(".*\\.xml"),
- DirectoryFileFilter.DIRECTORY)
- .stream()
- .filter(file -> file.getAbsolutePath().contains("oxm"))
- .filter(file -> !file.getAbsolutePath().contains("onap")) // skips onap for checks
- .collect(Collectors.toList());
- }
+ /**
+ * Check schema versions against their respective dbEdgeRules file and check if the
+ * dependentOn relationship matches what is listed in the edge rules.
+ *
+ */
+ @Test
+ @Ignore
+ public void testSchemaValidationAgainstEdgeRules() throws XPathExpressionException, IOException, SAXException, ParserConfigurationException, ParseException {
+ Path currentRelativePath = Paths.get("../aai-schema/src/main/resources/").toAbsolutePath();
+ List<File> subDirs = Arrays.asList(currentRelativePath.toFile().listFiles(File::isDirectory));
+ boolean success = true;
+ for (File subDir : subDirs) {
+ List<String> oxmSchemaList = new ArrayList<>();
+ List<String> dbEdgeRulesList = new ArrayList<>();
+ String oxm = subDir.getAbsolutePath() + "/oxm";
+ File[] oxms = new File(oxm).listFiles(File::isDirectory);
+ Arrays.stream(oxms).map(File::getAbsolutePath).max(new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return extractInt(o1) - extractInt(o2);
+ }
+
+ int extractInt(String s) {
+ String num = s.replaceAll("\\D", "");
+ return num.isEmpty() ? 0 : Integer.parseInt(num);
+ }
+ }).ifPresent(oxmSchemaList::add);
+
+ String edgeRule = subDir.getAbsolutePath() + "/dbedgerules";
+ File[] edgeRules = new File(edgeRule).listFiles(File::isDirectory);
+ Arrays.stream(edgeRules).map(File::getAbsolutePath).max(new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return extractInt(o1) - extractInt(o2);
+ }
+
+ int extractInt(String s) {
+ String num = s.replaceAll("\\D", "");
+ return num.isEmpty() ? 0 : Integer.parseInt(num);
+ }
+ }).ifPresent(dbEdgeRulesList::add);
+
+
+ List<File> oxmSchemaFileList = new ArrayList<>();
+ List<File> dbEdgeRulesFileList = new ArrayList<>();
+ oxmSchemaList.forEach(s ->
+ FileUtils.listFiles(
+ new File(s),
+ new RegexFileFilter(".*\\.xml"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("oxm"))
+ .forEach(oxmSchemaFileList::add));
+
+ dbEdgeRulesList.forEach(s ->
+ FileUtils.listFiles(
+ new File(s),
+ new RegexFileFilter(".*\\.json"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("DbEdgeRules"))
+ .forEach(dbEdgeRulesFileList::add));
+
+ // Map the dbEdgeRules json file into a HashMap for reference
+ Map<String, Set<String>> dbEdgeRules = new HashMap<>();
+ JSONParser jsonParser = new JSONParser();
+ for (File file : dbEdgeRulesFileList) {
+ FileReader reader = new FileReader(file);
+ // Read JSON file. Expecting JSON file to read an object with a JSONArray names "rules"
+ JSONObject jsonObj = (JSONObject) jsonParser.parse(reader);
+ JSONArray rules = (JSONArray) jsonObj.get(DBEDGERULES_RULES);
+ for (int i = 0; i < rules.size(); i++) {
+ JSONObject rule = (JSONObject) rules.get(i);
+ String fromNode = rule.get(DBEDGERULES_FROM).toString();
+ String toNode = rule.get(DBEDGERULES_TO).toString();
+ String direction = rule.get(DBEDGERULES_DIRECTION).toString();
+ String containsOtherV = rule.get(DBEDGERULES_CONTAINS_OTHER_V).toString();
+
+ // special case - cvlan-tag should be replaced with cvlan-tag-entry
+ if (fromNode.equals("cvlan-tag"))
+ fromNode = "cvlan-tag-entry";
+ if (toNode.equals("cvlan-tag"))
+ toNode = "cvlan-tag-entry";
+ if (containsOtherV.equals("!${direction}")) {
+ if (direction.equals(DBEDGERULES_IN)) {
+ direction = DBEDGERULES_OUT;
+ } else if (direction.equals(DBEDGERULES_OUT)) {
+ direction = DBEDGERULES_IN;
+ }
+ }
+ // If this value is none, the edge rule is for cousin nodes. Ignore.
+ else if (containsOtherV.equals("NONE"))
+ continue;
+ dbEdgeRulesMapPut(dbEdgeRules, fromNode, toNode, direction);
+ }
+ }
+
+ // Iterate through the most recent oxm schema files. Map the parent child relationships
+ Map<String, Set<String>> oxmSchemaFile = new HashMap<>();
+ for (File file : oxmSchemaFileList) {
+ Document xmlDocument = getDocument(file);
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ String parentNodeExpression = "/xml-bindings/java-types/java-type/xml-properties/xml-property[@name='dependentOn']";
+ NodeList parentNodeList = (NodeList) xPath.compile(parentNodeExpression).evaluate(xmlDocument, XPathConstants.NODESET);
+ String childNodeExpression = "/xml-bindings/java-types/java-type[" +
+ "(" +
+ "count(xml-properties/xml-property[@name='dependentOn']) > 0" +
+ ")]";
+ NodeList childNodeList = (NodeList) xPath.compile(childNodeExpression).evaluate(xmlDocument, XPathConstants.NODESET);
+
+ for (int i = 0; i < parentNodeList.getLength(); i++) {
+
+ // Obtain the xml-root-element field by tracing the childNodes from the java-type parent node
+ for (int j = 0; j < childNodeList.item(i).getChildNodes().getLength(); j++) {
+ if (childNodeList.item(i).getChildNodes().item(j).getNodeName().equals(XMLROOTELEMENT)) {
+
+ // The parent node
+ String dependentOn = parentNodeList.item(i).getAttributes().getNamedItem("value").getNodeValue();
+
+ // The child node
+ String xmlRootElement = childNodeList.item(i).getChildNodes().item(j).getAttributes().getNamedItem("name").getNodeValue();
+
+ Set<String> childSet;
+ String[] parents = dependentOn.split(",");
+ for (int k = 0; k < parents.length; k++) {
+ String parent = parents[k];
+ if (oxmSchemaFile.containsKey(parent)) {
+ childSet = oxmSchemaFile.get(parent);
+ } else {
+ childSet = new HashSet<>();
+ }
+ childSet.add(xmlRootElement);
+ oxmSchemaFile.put(parent, childSet);
+ }
+
+ }
+ }
+ }
+ }
+
+ // Compare the OXM file against the dbEdgeRules file. check what is missing in dbEdgeRules from the oxm files.
+ Set<String> oxmKeySet = oxmSchemaFile.keySet();
+ for (String key : oxmKeySet) {
+ Set<String> oxmChildren = oxmSchemaFile.get(key);
+ Set<String> dbEdgeRulesChildren = dbEdgeRules.get(key);
+
+ // Check if the parent vertex exists at all in the dbEdgeRules file
+ if (dbEdgeRulesChildren == null || dbEdgeRulesChildren.isEmpty()) {
+ for (String oxmChild : oxmChildren) {
+ System.out.println("ERROR: dbEdgeRules under directory '" + subDir.toString() + "' does not contain parent '" + key + "' and child '" + oxmChild + "' relationship");
+ }
+ success = false;
+ continue;
+ }
+
+ // Compare both parent-child relationships between both files
+ if (!oxmChildren.equals(dbEdgeRulesChildren)) {
+ for (String oxmChild : oxmChildren) {
+ if (!dbEdgeRulesChildren.contains(oxmChild)) {
+ System.out.println("ERROR: dbEdgeRules under directory '" + subDir.toString() + "' does not contain parent '" + key + "' and child '" + oxmChild + "' relationship");
+ success = false;
+ }
+ }
+ }
+ }
+
+ // Compare the dbEdgeRules against the OXM File
+ Set<String> dbEdgeRuleKeySet = dbEdgeRules.keySet();
+ for (String key : dbEdgeRuleKeySet) {
+ Set<String> dbEdgeRulesChildren = dbEdgeRules.get(key);
+ Set<String> oxmChildren = oxmSchemaFile.get(key);
+
+ // Check if the parent vertex exists at all in the dbEdgeRules file
+ if (oxmChildren == null || oxmChildren.isEmpty()) {
+ for (String dbEdgeRuleChild : dbEdgeRulesChildren) {
+ System.out.println("ERROR: oxms under directory '" + subDir.toString() + "' do not contain parent '" + key + "' and child '" + dbEdgeRuleChild + "' relationship");
+ }
+ success = false;
+ continue;
+ }
+
+ // Compare both parent-child relationships between both files
+ if (!dbEdgeRulesChildren.equals(oxmChildren)) {
+ for (String dbEdgeRuleChild : dbEdgeRulesChildren) {
+ if (!oxmChildren.contains(dbEdgeRuleChild)) {
+ System.out.println("ERROR: oxms under directory '" + subDir.toString() + "' do not contain parent '" + key + "' and child '" + dbEdgeRuleChild + "' relationship");
+ success = false;
+ }
+ }
+ }
+ }
+ }
+ assertTrue(success);
+ }
+
+ /**
+ * Null check for strings
+ * @param s
+ * @return
+ */
+ private boolean isStringEmpty(String s) {
+ return (s == null || s.isEmpty()) ? true : false;
+ }
+
+ /**
+ * Creating a hashmap to map what child nodes are associated to which parent nodes
+ * according to the dbEdgeRules json files. A HashMap was chosen for the value of the map for O(1) lookup time.
+ * @param from this variable will act as the key or value depending on the direction
+ * @param to this variable will act as the key or value depending on the direction
+ * @param direction dictates the direction of which vertex is dependent on which
+ * @return The map returned will act as a dictionary to keep track of the parent nodes. Value of the map is a hashmap to help handle collision of multiple children to one parent
+ */
+ private Map<String, Set<String>> dbEdgeRulesMapPut(Map<String, Set<String>> dbEdgeRules, String from, String to, String direction) {
+ if (isStringEmpty(from) || isStringEmpty(to) || isStringEmpty(direction))
+ return dbEdgeRules;
+
+ // Assigning the strings to parent and child for readability
+ String parent = "", child = "";
+ if (direction.equals(DBEDGERULES_OUT)) {
+ parent = from;
+ child = to;
+ } else if (direction.equals(DBEDGERULES_IN)) {
+ parent = to;
+ child = from;
+ }
+ // Add to the dbEdgeRules mapping
+ Set<String> children;
+ if (!dbEdgeRules.containsKey(parent)) {
+ children = new HashSet<>();
+ children.add(child);
+ dbEdgeRules.put(parent, children);
+ } else {
+ children = dbEdgeRules.get(parent);
+ children.add(child);
+ dbEdgeRules.put(parent, children);
+ }
+ return dbEdgeRules;
+ }
+
+ private List<File> getFiles() {
+ Path currentRelativePath = Paths.get("../aai-schema/src/main/resources/").toAbsolutePath();
+ return FileUtils.listFiles(
+ currentRelativePath.toFile(),
+ new RegexFileFilter(".*\\.xml"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("oxm"))
+ .filter(file -> !file.getAbsolutePath().contains("onap")) // skips onap for checks
+ .collect(Collectors.toList());
+ }
+
+ private List<File> getAaiSchemaOxmFiles() {
+ Path currentRelativePath = Paths.get("../aai-schema/src/main/resources/").toAbsolutePath();
+ return FileUtils.listFiles(
+ currentRelativePath.toFile(),
+ new RegexFileFilter(".*\\.xml"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("oxm"))
+ .filter(file -> !file.getAbsolutePath().contains("onap")) // skips onap for checks
+ .collect(Collectors.toList());
+ }
+
+ private List<File> getDbEdgeRulesFiles() {
+ Path currentRelativePath = Paths.get("../aai-schema/src/main/resources/").toAbsolutePath();
+ return FileUtils.listFiles(
+ currentRelativePath.toFile(),
+ new RegexFileFilter(".*\\.json"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("DbEdgeRules"))
+ .filter(file -> !file.getAbsolutePath().contains("onap")) // skips onap for checks
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Finds all of the oxm files for the latest version.
+ * @return list of the latest version of the oxm files.
+ */
+ private List<File> getLatestDbEdgeRulesFiles(String fileDirectory) {
+ List<String> latest = new ArrayList<>();
+ String currentRelativePath = Paths.get("../aai-schema/src/main/resources/" + fileDirectory + "/dbedgerules").toAbsolutePath().toString();
+ File[] oxms = new File(currentRelativePath).listFiles(File::isDirectory);
+ Arrays.stream(oxms).map(File::getAbsolutePath).max(new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return extractInt(o1) - extractInt(o2);
+ }
+ int extractInt(String s) {
+ String num = s.replaceAll("\\D", "");
+ return num.isEmpty() ? 0 : Integer.parseInt(num);
+ }
+ }).ifPresent(latest::add);
+
+ List<File> latestFiles = new ArrayList<>();
+ latest.forEach(s ->
+ FileUtils.listFiles(
+ new File(s),
+ new RegexFileFilter(".*\\.json"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("DbEdgeRules"))
+ .forEach(latestFiles::add));
+
+ return latestFiles;
+ }
/**
* Finds all of the oxm files for the latest version.
@@ -233,29 +540,60 @@ public class ValidateOXMTest {
return latestFiles;
}
- //TODO test that all oxm xml are valid xml
+ /**
+ * Finds all of the oxm files for the latest version.
+ * @return list of the latest version of the oxm files.
+ */
+ private List<File> getLatestFiles(String fileDirectory) {
+ List<String> latest = new ArrayList<>();
+ String currentRelativePath = Paths.get("../aai-schema/src/main/resources/" + fileDirectory + "/oxm").toAbsolutePath().toString();
+ File[] oxms = new File(currentRelativePath).listFiles(File::isDirectory);
+ Arrays.stream(oxms).map(File::getAbsolutePath).max(new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return extractInt(o1) - extractInt(o2);
+ }
+ int extractInt(String s) {
+ String num = s.replaceAll("\\D", "");
+ return num.isEmpty() ? 0 : Integer.parseInt(num);
+ }
+ }).ifPresent(latest::add);
+ List<File> latestFiles = new ArrayList<>();
+ latest.forEach(s ->
+ FileUtils.listFiles(
+ new File(s),
+ new RegexFileFilter(".*\\.xml"),
+ DirectoryFileFilter.DIRECTORY)
+ .stream()
+ .filter(file -> file.getAbsolutePath().contains("oxm"))
+ .forEach(latestFiles::add));
+ return latestFiles;
+ }
+
+ //TODO test that all oxm xml are valid xml
- public String printNodeList(NodeList nodeList, Document doc) throws IOException {
- StringBuilder stringBuilder = new StringBuilder();
- for (int i = 0; i < nodeList.getLength(); i++) {
- stringBuilder.append(printNode(nodeList.item(i), doc)).append("\n");
- }
- return stringBuilder.toString();
- }
- public String printNode(Node node, Document document) throws IOException {
- StringWriter stringWriter = new StringWriter();
- return stringWriter.toString();
- }
+ public String printNodeList(NodeList nodeList, Document doc) throws IOException {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ stringBuilder.append(printNode(nodeList.item(i), doc)).append("\n");
+ }
+ return stringBuilder.toString();
+ }
- private Document getDocument(File file) throws ParserConfigurationException, SAXException, IOException {
- InputStream fileIS = new FileInputStream(file);
- DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = builderFactory.newDocumentBuilder();
- return builder.parse(fileIS);
- }
+ public String printNode(Node node, Document document) throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ return stringWriter.toString();
+
+ }
+
+ private Document getDocument(File file) throws ParserConfigurationException, SAXException, IOException {
+ InputStream fileIS = new FileInputStream(file);
+ DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ return builder.parse(fileIS);
+ }
}
diff --git a/pom.xml b/pom.xml
index d2e3980..fc04405 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
Nexus Proxy Properties and Snapshot Locations
Ideally this can be overwritten at runtime per internal environment specific values at runtime
-->
- <aai.common.version>1.6.5</aai.common.version>
+ <aai.common.version>1.6.8</aai.common.version>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<site.path>/content/sites/site/org/onap/aai/resources/${project.artifactId}/${project.version}</site.path>
<release.path>/content/repositories/releases/</release.path>