aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKajur, Harish (vk250x) <vk250x@att.com>2020-02-29 22:17:05 -0500
committerjimmy <jf2512@att.com>2020-03-03 13:20:06 -0500
commit3a27813b663c34df52b2b1b50df7f0754dcfe134 (patch)
tree1f962778cd649286f70ae7ec8dbc5d868a668a7b
parent50315fe106b88e0cd556b8b6fab1dbdd4c9856a4 (diff)
Update resources to use aai-common changes
Issue-ID: AAI-2750 Change-Id: I33ea2b3d7b4b706edc59c3d45c9957d05effd306 Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
-rw-r--r--.gitignore3
-rw-r--r--aai-resources/pom.xml8
-rw-r--r--aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java25
-rw-r--r--aai-resources/src/main/java/org/onap/aai/Profiles.java2
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ResourcesApp.java110
-rw-r--r--aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java288
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java68
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/aaf/AafFilter.java69
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/aaf/FilterPriority.java35
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java45
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java4
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java100
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java6
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java92
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java20
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java70
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/TwoWaySslAuthorization.java2
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java67
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java159
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java38
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/VertexIdConsumer.java42
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java119
-rw-r--r--aai-resources/src/main/java/org/onap/aai/service/AuthorizationService.java8
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java11
-rw-r--r--aai-resources/src/main/resources/aaf/onap/bath_config.csv (renamed from aai-resources/src/main/resources/aaf/bath_config.csv)0
-rw-r--r--aai-resources/src/main/resources/aaf/onap/org.onap.aai.keyfile (renamed from aai-resources/src/main/resources/aaf/org.onap.aai.keyfile)0
-rw-r--r--aai-resources/src/main/resources/aaf/onap/org.onap.aai.p12 (renamed from aai-resources/src/main/resources/aaf/org.onap.aai.p12)bin4158 -> 4158 bytes
-rw-r--r--aai-resources/src/main/resources/aaf/onap/org.onap.aai.props (renamed from aai-resources/src/main/resources/aaf/org.onap.aai.props)8
-rw-r--r--aai-resources/src/main/resources/aaf/onap/org.osaaf.location.props (renamed from aai-resources/src/main/resources/aaf/org.osaaf.location.props)0
-rw-r--r--aai-resources/src/main/resources/aaf/onap/truststoreONAPall.jks (renamed from aai-resources/src/main/resources/aaf/truststoreONAPall.jks)bin114865 -> 114865 bytes
-rw-r--r--aai-resources/src/main/resources/application.properties35
-rw-r--r--aai-resources/src/main/resources/cadi.properties2
-rw-r--r--aai-resources/src/main/resources/etc/appprops/aaiconfig.properties49
-rw-r--r--aai-resources/src/main/resources/etc/appprops/datatoolscrons.properties8
-rw-r--r--aai-resources/src/main/resources/etc/appprops/delta-event-publisher.properties4
-rw-r--r--aai-resources/src/main/resources/etc/appprops/error.properties302
-rw-r--r--aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties3
-rw-r--r--aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties3
-rw-r--r--aai-resources/src/main/resources/logback.xml159
-rw-r--r--aai-resources/src/main/scripts/bulkprocess.sh8
-rw-r--r--aai-resources/src/main/scripts/common_functions.sh23
-rw-r--r--aai-resources/src/main/scripts/install/addManualData.sh85
-rw-r--r--aai-resources/src/main/scripts/updatePem.sh20
-rw-r--r--aai-resources/src/main/scripts/updateTool.sh24
-rw-r--r--aai-resources/src/main/scripts/vmExportCloudRegions.sh517
-rw-r--r--aai-resources/src/main/scripts/vmUpdateExport.sh75
-rw-r--r--aai-resources/src/main/scripts/vmValidateCloudRegions.sh328
-rw-r--r--aai-resources/src/test/java/org/onap/aai/AAISetup.java36
-rw-r--r--aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java31
-rw-r--r--aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java15
-rw-r--r--aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java463
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java100
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java6
-rw-r--r--aai-resources/src/test/resources/logback.xml281
-rw-r--r--aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json46
-rw-r--r--aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json41
-rw-r--r--aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json28
-rw-r--r--aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json8
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/cloud-region.json27
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/complex.json9
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/generic-vnf.json28
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/pserver.json4
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json63
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/tenant.json4
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/vf-module.json3
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/vnfc.json7
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json19
-rw-r--r--aai-resources/src/test/resources/payloads/extensions/vserver.json32
-rw-r--r--aai-resources/src/test/resources/payloads/resource/pserver1.json28
-rw-r--r--aai-resources/src/test/resources/payloads/resource/pserver2.json28
-rw-r--r--aai-resources/src/test/resources/payloads/resource/pserver3.json28
-rw-r--r--aai-resources/src/test/resources/payloads/resource/pserver4.json28
-rw-r--r--aai-resources/src/test/resources/payloads/resource/pserver5.json28
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver.json19
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver1.json19
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver2.json19
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver3.json19
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver4.json19
-rw-r--r--aai-resources/src/test/resources/payloads/resource/vserver5.json19
-rw-r--r--onap-java-formatter.xml12
-rw-r--r--pom.xml3
91 files changed, 3265 insertions, 1351 deletions
diff --git a/.gitignore b/.gitignore
index d0ff8c4..2d0b5eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,4 +11,5 @@ fitnesse/
test_csvWriter.csv
**/.idea/
*/.idea
-*.iml \ No newline at end of file
+*.iml
+aai-resources/debug-logs/EELF/
diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml
index 42fd235..be06a26 100644
--- a/aai-resources/pom.xml
+++ b/aai-resources/pom.xml
@@ -436,12 +436,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
index 23814bf..614d16f 100644
--- a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
+++ b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
@@ -24,17 +24,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphTransaction;
-import org.onap.aai.config.PropertyPasswordConfiguration;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.dbmap.AAIGraph;
-import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
@@ -42,7 +41,6 @@ import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.logging.LoggingContext;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.util.AAISystemExitUtil;
import org.onap.aai.util.PositiveNumValidator;
@@ -65,7 +63,7 @@ public class IncreaseNodesTool {
protected TransactionalGraphEngine engine;
Vertex parentVtx;
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(IncreaseNodesTool.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(IncreaseNodesTool.class);
public IncreaseNodesTool(LoaderFactory loaderFactory, SchemaVersions schemaVersions){
this.loaderFactory = loaderFactory;
@@ -84,11 +82,14 @@ public class IncreaseNodesTool {
);
context.refresh();
} catch (Exception e) {
- AAIException aai = ResourcesApp.schemaServiceExceptionTranslator(e);
- LOGGER.error("Problems running the tool "+aai.getMessage());
- LoggingContext.statusCode(LoggingContext.StatusCode.ERROR);
- LoggingContext.responseCode(LoggingContext.DATA_ERROR);
- ErrorLogHelper.logError(aai.getCode(), e.getMessage() + ", resolve and retry");
+ AAIException aai = null;
+ if(e.getCause() instanceof AAIException){
+ aai = (AAIException)e.getCause();
+ } else {
+ aai = ResourcesApp.schemaServiceExceptionTranslator(e);
+ }
+ LOGGER.error("Problems starting the Increase Nodes Tool due to {}", aai.getMessage());
+ ErrorLogHelper.logException(aai);
throw aai;
}
@@ -141,7 +142,7 @@ public class IncreaseNodesTool {
GraphTraversalSource g = transaction.traversal();
for (long i = 1; i <= nodeCount; i++) {
String randomId = UUID.randomUUID().toString();
- Vertex v = g.addV().next();
+ Vertex v = g.addV(nodeType).next();
v.property("aai-node-type", nodeType);
v.property("source-of-truth", "IncreaseNodesTool");
diff --git a/aai-resources/src/main/java/org/onap/aai/Profiles.java b/aai-resources/src/main/java/org/onap/aai/Profiles.java
index ea65b9a..f35a4c9 100644
--- a/aai-resources/src/main/java/org/onap/aai/Profiles.java
+++ b/aai-resources/src/main/java/org/onap/aai/Profiles.java
@@ -25,7 +25,7 @@ public final class Profiles {
public static final String DME2 = "dme2";
public static final String ONE_WAY_SSL = "one-way-ssl";
- public static final String AAF_AUTHENTICATION = "aaf-auth";
+
public static final String TWO_WAY_SSL = "two-way-ssl";
private Profiles(){}
diff --git a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
index f653487..6377af8 100644
--- a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
+++ b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
@@ -19,23 +19,17 @@
*/
package org.onap.aai;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.onap.aai.config.PropertyPasswordConfiguration;
+import org.onap.aai.aailog.logs.AaiDebugLog;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
-
import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.logging.LoggingContext.StatusCode;
+import org.onap.aai.nodes.NodeIngestor;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.util.AAIConfig;
-import org.slf4j.MDC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -45,36 +39,42 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
-import org.onap.aai.nodes.NodeIngestor;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
-@SpringBootApplication
+@SpringBootApplication(
+ exclude = {
+ DataSourceAutoConfiguration.class,
+ DataSourceTransactionManagerAutoConfiguration.class,
+ HibernateJpaAutoConfiguration.class
+ }
+)
// Component Scan provides a way to look for spring beans
// It only searches beans in the following packages
// Any method annotated with @Bean annotation or any class
// with @Component, @Configuration, @Service will be picked up
@ComponentScan(basePackages = {
- "org.onap.aai.config",
- "org.onap.aai.web",
- "org.onap.aai.setup",
- "org.onap.aai.tasks",
- "org.onap.aai.service",
- "org.onap.aai.rest"
-})
-@EnableAutoConfiguration(exclude = {
- DataSourceAutoConfiguration.class,
- DataSourceTransactionManagerAutoConfiguration.class,
- HibernateJpaAutoConfiguration.class
+ "org.onap.aai.config",
+ "org.onap.aai.web",
+ "org.onap.aai.setup",
+ "org.onap.aai.tasks",
+ "org.onap.aai.service",
+ "org.onap.aai.rest",
+ "org.onap.aai.aaf",
+ "org.onap.aai.TenantIsolation",
+ "org.onap.aai.aailog",
+ "org.onap.aai.prevalidation"
})
public class ResourcesApp {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourcesApp.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(ResourcesApp.class.getName());
private static final String APP_NAME = "aai-resources";
- private static Map<String,String> contextMap;
+ private static AaiDebugLog debugLog = new AaiDebugLog();
+ static {
+ debugLog.setupMDC();
+ }
@Autowired
private Environment env;
@@ -93,17 +93,6 @@ public class ResourcesApp {
private void init() throws AAIException {
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("AAI Server initialization started...");
// Setting this property to allow for encoded slash (/) in the path parameter
@@ -116,7 +105,6 @@ public class ResourcesApp {
logger.warn("You have seriously misconfigured your application");
}
- LoggingContext.restoreIfPossible();
}
@PreDestroy
@@ -129,15 +117,6 @@ public class ResourcesApp {
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);
-
Environment env =null;
AAIConfig.init();
try {
@@ -148,21 +127,21 @@ public class ResourcesApp {
env = app.run(args).getEnvironment();
}
catch(Exception ex){
- AAIException aai = schemaServiceExceptionTranslator(ex);
- LoggingContext.statusCode(LoggingContext.StatusCode.ERROR);
- LoggingContext.responseCode(LoggingContext.DATA_ERROR);
- logger.error("Problems starting ResourcesApp "+aai.getMessage());
+ AAIException aai = null;
+ if(ex.getCause() instanceof AAIException){
+ aai = (AAIException)ex.getCause();
+ } else {
+ aai = schemaServiceExceptionTranslator(ex);
+ }
+ logger.error("Problems starting the ResourcesApp due to {}", aai.getMessage());
ErrorLogHelper.logException(aai);
- ErrorLogHelper.logError(aai.getCode(), ex.getMessage() + ", resolve and restart Resources");
- //ErrorLogHelper.logError(aai.getCode(), aai.getMessage() + aai.getCause().toString());
throw aai;
}
- MDC.setContextMap (contextMap);
logger.info(
- "Application '{}' is running on {}!" ,
- env.getProperty("spring.application.name"),
- env.getProperty("server.port")
+ "Application '{}' is running on {}!" ,
+ env.getProperty("spring.application.name"),
+ env.getProperty("server.port")
);
// The main reason this was moved from the constructor is due
@@ -173,12 +152,10 @@ public class ResourcesApp {
AAIGraph.getInstance();
logger.info("Resources MicroService Started");
- logger.error("Resources MicroService Started");
logger.debug("Resources MicroService Started");
System.out.println("Resources Microservice Started");
- LoggingContext.restoreIfPossible();
}
public static void setDefaultProps(){
@@ -206,17 +183,18 @@ public class ResourcesApp {
}
public static AAIException schemaServiceExceptionTranslator(Exception ex) {
AAIException aai = null;
- if(ExceptionUtils.getRootCause(ex).getMessage().contains("NodeIngestor")){
+ String message = ExceptionUtils.getRootCause(ex).getMessage();
+ if(message.contains("NodeIngestor")){
aai = new AAIException("AAI_3026","Error reading OXM from SchemaService - Investigate");
}
- else if(ExceptionUtils.getRootCause(ex).getMessage().contains("EdgeIngestor")){
+ else if(message.contains("EdgeIngestor")){
aai = new AAIException("AAI_3027","Error reading EdgeRules from SchemaService - Investigate");
}
- else if(ExceptionUtils.getRootCause(ex).getMessage().contains("Connection refused")){
+ else if(message.contains("Connection refused")){
aai = new AAIException("AAI_3025","Error connecting to SchemaService - Investigate");
}
else {
- aai = new AAIException("AAI_3025","Error connecting to SchemaService - Please Investigate");
+ aai = new AAIException("AAI_3025","Unable to determine what the error is, please check external.log");
}
return aai;
diff --git a/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java b/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java
new file mode 100644
index 0000000..917146f
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java
@@ -0,0 +1,288 @@
+/**
+ * ============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.TenantIsolation;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import com.att.eelf.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.commons.io.comparator.LastModifiedFileComparator;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.commons.io.filefilter.FileFileFilter;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.RegexFileFilter;
+
+/**
+ * DataImportTasks
+ *
+ */
+@Component
+@PropertySource("file:${server.local.startpath}/etc/appprops/datatoolscrons.properties")
+public class DataImportTasks {
+
+ private static final Logger LOGGER;
+ private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
+
+ private static final List<String> EXTS = Arrays.asList("tar.gz", "tgz");
+
+ static {
+ Properties props = System.getProperties();
+ props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS);
+ props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG);
+ LOGGER = LoggerFactory.getLogger(DataImportTasks.class);
+ }
+ /**
+ * Scheduled task to invoke importTask
+ */
+ @Scheduled(cron = "${dataimporttask.cron}" )
+ public void import1() {
+ try {
+ importTask();
+ }
+ catch (Exception e) {
+ }
+ }
+ /**
+ * The importTask method.
+ *
+ * @throws AAIException, Exception
+ */
+ public void importTask() throws AAIException, Exception {
+
+
+ if (AAIConfig.get("aai.dataimport.enable").equalsIgnoreCase("false")) {
+ LOGGER.info("Data Import is not enabled");
+ return;
+ }
+ // Check if the process was started via command line
+ if (isDataImportRunning()) {
+ LOGGER.info("There is a dataImport process already running");
+ return;
+ }
+
+ LOGGER.info("Started importTask: " + dateFormat.format(new Date()));
+
+ String inputLocation = AAIConstants.AAI_HOME_BUNDLECONFIG + AAIConfig.get("aai.dataimport.input.location");
+
+ // Check that the input location exist
+ File targetDirFile = new File(inputLocation);
+ if ( targetDirFile.exists() ) {
+ //Delete any existing payload file directories
+ deletePayload(targetDirFile);
+ }
+
+ File payloadFile = findExportedPayload();
+ if (payloadFile == null)
+ return; // already logged error in the findExportedPayload function
+
+ if ( unpackPayloadFile(payloadFile.getAbsolutePath())) {
+ String[] command = new String[2];
+ command[0] = AAIConstants.AAI_HOME + AAIConstants.AAI_FILESEP + "bin" + AAIConstants.AAI_FILESEP + "install" + AAIConstants.AAI_FILESEP + "addManualData.sh";
+ command[1] = "tenant_isolation";
+ runAddManualDataScript(command);
+ }
+
+ //clean up
+ payloadFile.delete();
+
+ }
+ /**
+ * The isDataImportRunning method, checks if the data import task was started separately via command line
+ * @return true if another process is running, false if not
+ */
+ private static boolean isDataImportRunning(){
+
+ Process process = null;
+
+ int count = 0;
+ try {
+ process = new ProcessBuilder().command("bash", "-c", "ps -ef | grep 'addManualData'").start();
+ InputStream is = process.getInputStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+
+ while (br.readLine() != null){
+ count++;
+ }
+
+ int exitVal = process.waitFor();
+ LOGGER.info("Check if dataImport is running returned: " + exitVal);
+ } catch (Exception e) {
+ ErrorLogHelper.logError("AAI_8002", "Exception while running the check to see if dataImport is running "+ e.getMessage());
+ LOGGER.info("Exception while running the check to see if dataImport is running "+ e.getMessage());
+ }
+
+ if(count > 0){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * The findPayExportedPayload method tries to find the latest exported payload.
+ * Also deletes the old files if any or any other file in this directory
+ */
+ private static File findExportedPayload() throws AAIException {
+ String targetDir = AAIConstants.AAI_HOME_BUNDLECONFIG + AAIConfig.get("aai.dataimport.input.location");
+ File targetDirFile = new File(targetDir);
+ File payloadFile = null;
+
+ File[] allFilesArr = targetDirFile.listFiles((FileFilter) FileFileFilter.FILE);
+ if ( allFilesArr == null || allFilesArr.length == 0 ) {
+ ErrorLogHelper.logError("AAI_8001", "Unable to find payload file at " + targetDir);
+ LOGGER.info ("Unable to find payload at " + targetDir);
+ return null;
+ }
+ if ( allFilesArr.length > 1 ) {
+ Arrays.sort(allFilesArr, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
+ // get the latest payload file
+ boolean foundTheLatestPayload = false;
+ for (File f : allFilesArr) {
+ if (!foundTheLatestPayload && isTargzExtension(f.getAbsolutePath())) {
+ payloadFile = f;
+ foundTheLatestPayload = true;
+ }
+ else // delete all files except the latest payload file!
+ f.delete();
+ }
+ }
+ else {
+ if (isTargzExtension(allFilesArr[0].getAbsolutePath()))
+ payloadFile = allFilesArr[0];
+ }
+
+ return payloadFile;
+ }
+
+ /**
+ * The deletePayload method deletes all the payload files that it finds at targetDirectory
+ * @param targetDirFile the directory that contains payload files
+ * @throws AAIException
+ */
+ private static void deletePayload(File targetDirFile) throws AAIException {
+
+ File[] allFilesArr = targetDirFile.listFiles((FileFilter)DirectoryFileFilter.DIRECTORY);
+ if ( allFilesArr == null || allFilesArr.length == 0 ) {
+ LOGGER.info ("No payload files found at " + targetDirFile.getPath());
+ return;
+ }
+ for ( File f : allFilesArr ) {
+ try {
+ FileUtils.deleteDirectory(f);
+ }
+ catch (IOException e) {
+
+ LOGGER.info ("Unable to delete directory " + f.getAbsolutePath() + " " + e.getMessage());
+ }
+
+ }
+
+ }
+
+ /**
+ * The isDataImportRunning method, checks if the data import task was started separately via command line
+ * @return true if another process is running, false if not
+ */
+ private static boolean unpackPayloadFile(String payLoadFileName){
+
+ Process process = null;
+
+ try {
+ process = new ProcessBuilder().command("bash", "-c", "gzip –d < " + payLoadFileName + " | tar xf -").start();
+ int exitVal = process.waitFor();
+ LOGGER.info("gzip -d returned: " + exitVal);
+ } catch (Exception e) {
+ ErrorLogHelper.logError("AAI_8002", "Exception while running the unzip "+ e.getMessage());
+ LOGGER.info("Exception while running the unzip "+ e.getMessage());
+ return false;
+ }
+ /*
+ if (payLoadFileName.indexOf(".") > 0)
+ payLoadFileName = payLoadFileName.substring(0, payLoadFileName.lastIndexOf("."));
+
+ try {
+ process = new ProcessBuilder().command("bash", "-c", "tar xf " + payLoadFileName).start();
+ int exitVal = process.waitFor();
+ LOGGER.info("tar xf returned: " + exitVal);
+ } catch (Exception e) {
+ ErrorLogHelper.logError("AAI_8002", "Exception while running the tar xf "+ e.getMessage());
+ LOGGER.info("Exception while running the tar xf "+ e.getMessage());
+ return false;
+ }
+ */
+ return true;
+ }
+
+ private static boolean isTargzExtension(String fileName) {
+ boolean found = false;
+ for (String ext : EXTS) {
+ if (fileName.toLowerCase().endsWith("." + ext)) {
+ found = true;
+ }
+ }
+ return found;
+ }
+
+ /**
+ * The runAddManualDataScript method runs a shell script/command with a variable number of arguments
+ * @param script The script/command arguments
+ */
+ private static void runAddManualDataScript(String ...script ) {
+ Process process = null;
+ try {
+ process = new ProcessBuilder().command(script).start();
+ int exitVal = process.waitFor();
+ LOGGER.info("addManualData.sh returned: " + exitVal);
+ } catch (Exception e) {
+ ErrorLogHelper.logError("AAI_8002", "Exception while running addManualData.sh "+ e.getMessage());
+ LOGGER.info("Exception while running addManualData.sh" + e.getMessage());
+ }
+
+ }
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java b/aai-resources/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java
deleted file mode 100644
index 653fc51..0000000
--- a/aai-resources/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java
+++ /dev/null
@@ -1,68 +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.config.aaf;
-
-import org.onap.aai.Profiles;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.filter.OrderedRequestContextFilter;
-import org.springframework.context.annotation.Profile;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-import static org.onap.aai.config.aaf.ResponseFormatter.errorResponse;
-
-/**
- * AAF authorization filter
- */
-
-@Component
-@Profile(Profiles.AAF_AUTHENTICATION)
-@PropertySource("file:${server.local.startpath}/aaf/permissions.properties")
-public class AafAuthorizationFilter extends OrderedRequestContextFilter {
-
- @Value("${permission.type}")
- String type;
-
- @Value("${permission.instance}")
- String instance;
-
- public AafAuthorizationFilter() {
- this.setOrder(FilterPriority.AAF_AUTHORIZATION.getPriority());
- }
-
- @Override
- protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
- String permission = String.format("%s|%s|%s", type, instance, request.getMethod().toLowerCase());
- if(request.getRequestURI().matches("^.*/util/echo$")){
- filterChain.doFilter(request, response);
- }
- if(!request.isUserInRole(permission)){
- errorResponse(request, response);
- }else{
- filterChain.doFilter(request,response);
- }
- }
- }
diff --git a/aai-resources/src/main/java/org/onap/aai/config/aaf/AafFilter.java b/aai-resources/src/main/java/org/onap/aai/config/aaf/AafFilter.java
deleted file mode 100644
index f1aa7c1..0000000
--- a/aai-resources/src/main/java/org/onap/aai/config/aaf/AafFilter.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.config.aaf;
-
-import org.onap.aaf.cadi.PropAccess;
-import org.onap.aaf.cadi.filter.CadiFilter;
-import org.onap.aai.Profiles;
-import org.onap.aai.ResourcesApp;
-import org.springframework.boot.web.filter.OrderedRequestContextFilter;
-import org.springframework.context.annotation.Profile;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Properties;
-
-import static org.onap.aai.config.aaf.ResponseFormatter.*;
-
-/**
- * AAF authentication filter
- */
-
-@Component
-@Profile(Profiles.AAF_AUTHENTICATION)
-public class AafFilter extends OrderedRequestContextFilter {
-
- private final CadiFilter cadiFilter;
-
- public AafFilter() throws IOException, ServletException {
- Properties cadiProperties = new Properties();
- cadiProperties.load(ResourcesApp.class.getClassLoader().getResourceAsStream("cadi.properties"));
- cadiFilter = new CadiFilter(new PropAccess(cadiProperties));
- this.setOrder(FilterPriority.AAF_AUTHENTICATION.getPriority());
- }
-
- @Override
- protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
- if(!request.getRequestURI().matches("^.*/util/echo$")){
- cadiFilter.doFilter(request, response, filterChain);
- if(response.getStatus() >=400 && response.getStatus() < 500){
- errorResponse(request, response);
- }
- } else {
- filterChain.doFilter(request, response);
- }
- }
-
-
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/aaf/FilterPriority.java b/aai-resources/src/main/java/org/onap/aai/config/aaf/FilterPriority.java
deleted file mode 100644
index 910db69..0000000
--- a/aai-resources/src/main/java/org/onap/aai/config/aaf/FilterPriority.java
+++ /dev/null
@@ -1,35 +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.config.aaf;
-
-import org.springframework.core.Ordered;
-
-public enum FilterPriority {
- AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE),
- AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1); //higher number = lower priority
-
- private final int priority;
-
- FilterPriority(final int p) {
- priority = p;
- }
-
- public int getPriority() { return priority; }
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java b/aai-resources/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java
deleted file mode 100644
index 9e09827..0000000
--- a/aai-resources/src/main/java/org/onap/aai/config/aaf/ResponseFormatter.java
+++ /dev/null
@@ -1,45 +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.config.aaf;
-
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-
-class ResponseFormatter {
-
- private static final String ACCEPT_HEADER = "accept";
-
- static void errorResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String accept = request.getHeader(ACCEPT_HEADER) == null ? MediaType.APPLICATION_XML : request.getHeader(ACCEPT_HEADER);
- AAIException aaie = new AAIException("AAI_3300");
- response.setStatus(aaie.getErrorObject().getHTTPResponseCode().getStatusCode());
- response.getWriter().write(ErrorLogHelper.getRESTAPIErrorResponse(Collections.singletonList(MediaType.valueOf(accept)), aaie, new ArrayList<>()));
- response.getWriter().flush();
- response.getWriter().close();
- }
-
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
index 6801aee..8783ed2 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
@@ -30,7 +30,9 @@ public final class AAIHeaderProperties {
public static final String TRANSACTION_ID = "X-TransactionId";
public static final String FROM_APP_ID = "X-FromAppId";
-
+
+ public static final String SOURCE_OF_TRUTH = "X-SourceOfTruth";
+
public static final String AAI_TX_ID = "X-AAI-TXID";
public static final String AAI_REQUEST = "X-REQUEST";
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java
deleted file mode 100644
index 04f0391..0000000
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java
+++ /dev/null
@@ -1,100 +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.interceptors.post;
-
-import java.io.IOException;
-
-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 org.onap.aai.interceptors.AAIContainerFilter;
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.logging.LoggingContext.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@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-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java
index 4a47658..bfc1636 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.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.interceptors.AAIContainerFilter;
@@ -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;
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java
index dfc4376..8113fa7 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java
@@ -36,6 +36,10 @@ import org.onap.aai.exceptions.AAIException;
import org.onap.aai.interceptors.AAIContainerFilter;
import org.onap.aai.interceptors.AAIHeaderProperties;
import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.SimpleMap;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
@PreMatching
@Priority(AAIRequestFilterPriority.HEADER_VALIDATION)
@@ -45,36 +49,28 @@ public class HeaderValidation extends AAIContainerFilter implements ContainerReq
public void filter(ContainerRequestContext requestContext) throws IOException {
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<>()))
@@ -83,5 +79,77 @@ 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) {
+
+ // CDM header overrides everything else for source of truth
+ String sourceOfTruth = requestContext.getHeaderString(AAIHeaderProperties.SOURCE_OF_TRUTH);
+ String partnerName = requestContext.getHeaderString(ONAPLogConstants.Headers.PARTNER_NAME);
+ if ( sourceOfTruth == null || sourceOfTruth.isEmpty()) {
+
+ if (partnerName != null && !(partnerName.isEmpty())) {
+ String components[] = partnerName.split("\\.");
+ if (components.length > 1) {
+ if (!(ONAPComponents.AAI.toString().equalsIgnoreCase(components[0]))) {
+ sourceOfTruth = components[0];
+ } else {
+ // request is coming internally from AAI, check X-FromAppId
+ partnerName = null;
+ }
+ }
+ }
+ if (sourceOfTruth == null || sourceOfTruth.isEmpty()) {
+ 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();
+ }
+ if ((sourceOfTruth != null) && !(sourceOfTruth.isEmpty())) {
+ requestContext.getHeaders().add(AAIHeaderProperties.FROM_APP_ID, sourceOfTruth);
+ partnerName = sourceOfTruth;
+ }
+ else {
+ requestContext.getHeaders().add(AAIHeaderProperties.FROM_APP_ID, partnerName);
+ }
+ return partnerName;
+ }
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
index f9976c2..54f2695 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
@@ -33,6 +33,8 @@ 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.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
import org.glassfish.jersey.message.internal.ReaderWriter;
import org.glassfish.jersey.server.ContainerException;
@@ -60,6 +62,8 @@ public class RequestTransactionLogging extends AAIContainerFilter implements Con
private static final String CONTENT_TYPE = "Content-Type";
private static final String ACCEPT = "Accept";
private static final String TEXT_PLAIN = "text/plain";
+ private static final String WILDCARD = "*/*";
+ private static final String APPLICATION_JSON = "application/json";
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
@@ -85,8 +89,20 @@ public class RequestTransactionLogging extends AAIContainerFilter implements Con
requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
}
- if(StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)){
- requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
+ if(WILDCARD.equals(acceptType) || StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)){
+ UriInfo uriInfo = requestContext.getUriInfo();
+ if(uriInfo != null){
+ MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
+ if(queryParameters != null && queryParameters.containsKey("format")){
+ // Add application/json as the default header if request contains query parameter format
+ // Since clients are assuming the default response to be application json for when format is specified
+ requestContext.getHeaders().putSingle(ACCEPT, APPLICATION_JSON);
+ } else {
+ requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
+ }
+ } else {
+ requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
+ }
}
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java
deleted file mode 100644
index 368d071..0000000
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java
+++ /dev/null
@@ -1,70 +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.interceptors.pre;
-
-import java.io.IOException;
-
-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 org.onap.aai.interceptors.AAIContainerFilter;
-import org.onap.aai.interceptors.AAIHeaderProperties;
-import org.onap.aai.logging.LoggingContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-
-@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-resources/src/main/java/org/onap/aai/interceptors/pre/TwoWaySslAuthorization.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/TwoWaySslAuthorization.java
index d4e8c4f..6c1c9f8 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/TwoWaySslAuthorization.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/TwoWaySslAuthorization.java
@@ -33,7 +33,7 @@ import javax.ws.rs.container.PreMatching;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.aai.auth.AAIAuthCore;
+import org.onap.aai.aaf.auth.AAIAuthCore;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.interceptors.AAIContainerFilter;
import org.onap.aai.interceptors.AAIHeaderProperties;
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
index 8033278..3f595d1 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java
@@ -19,40 +19,15 @@
*/
package org.onap.aai.rest;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.PUT;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
+import com.google.gson.*;
import org.javatuples.Pair;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.introspection.exceptions.AAIUnmarshallingException;
import org.onap.aai.logging.ErrorObjectNotFoundException;
-import org.onap.aai.logging.LoggingContext;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.rest.bulk.BulkOperation;
import org.onap.aai.rest.bulk.BulkOperationResponse;
@@ -63,18 +38,24 @@ import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.util.AAIConfig;
import org.onap.aai.util.AAIConstants;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.google.gson.JsonSyntaxException;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.*;
+import javax.ws.rs.core.Response.Status;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
/**
* The Class BulkAddConsumer.
@@ -120,26 +101,11 @@ public abstract class BulkConsumer extends RESTAPI {
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
SchemaVersion version = new SchemaVersion(versionParam);
Response response = null;
try {
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
-
- String serviceName = req.getMethod() + " " + req.getRequestURI().toString();
- LoggingContext.requestId(transId);
- LoggingContext.partnerName(sourceOfTruth);
- LoggingContext.serviceName(serviceName);
- LoggingContext.targetEntity(TARGET_ENTITY);
- LoggingContext.targetServiceName(serviceName);
-
/* A Response will be generated for each object in each transaction.
* To keep track of what came from where to give organized feedback to the client,
@@ -152,7 +118,7 @@ public abstract class BulkConsumer extends RESTAPI {
for (int i = 0; i < transactions.size(); i++){
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
Loader loader = resourceHttpEntry.getLoader();
TransactionalGraphEngine dbEngine = resourceHttpEntry.getDbEngine();
URI thisUri = null;
@@ -515,8 +481,7 @@ public abstract class BulkConsumer extends RESTAPI {
* @param headers the headers
* @param info the info
* @param templateAction the template action
- * @param logline Generates a Response based on the given exception and adds it to the collection of responses for this request.
- * @throws ErrorObjectNotFoundException
+ * @throws ErrorObjectNotFoundException
*/
private void addExceptionCaseFailureResponse(List<List<BulkOperationResponse>> allResponses, Exception e, int index, URI thisUri, HttpHeaders headers, UriInfo info, HttpMethod templateAction) {
AAIException ex = null;
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
index 0b544f4..e6dcc77 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
@@ -19,46 +19,13 @@
*/
package org.onap.aai.rest;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.Encoded;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
import io.swagger.jaxrs.PATCH;
import org.javatuples.Pair;
-import org.json.JSONArray;
-import org.json.JSONObject;
import org.onap.aai.concurrent.AaiCallable;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
-import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.rest.db.DBRequest;
import org.onap.aai.rest.db.HttpEntry;
@@ -67,13 +34,19 @@ import org.onap.aai.rest.util.ValidateEncoding;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.onap.aai.util.AAIConfig;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.util.AAIConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.google.common.base.Joiner;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* The Class LegacyMoxyConsumer.
@@ -82,18 +55,7 @@ import com.google.common.base.Joiner;
@Path("{version: v[1-9][0-9]*|latest}")
public class LegacyMoxyConsumer extends RESTAPI {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumer.class.getName());
-
-// private HttpEntry traversalUriHttpEntry;
-
-// @Autowired
-// public LegacyMoxyConsumer(HttpEntry traversalUriHttpEntry){
-// this.traversalUriHttpEntry = traversalUriHttpEntry;
-// }
-
- public LegacyMoxyConsumer(){
-
- }
+ private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumer.class.getName());
/**
*
@@ -133,24 +95,18 @@ public class LegacyMoxyConsumer extends RESTAPI {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
MediaType inputMediaType = headers.getMediaType();
- Response response = null;
- Loader loader = null;
+ Response response;
+ Loader loader;
TransactionalGraphEngine dbEngine = null;
boolean success = true;
try {
validateRequest(info);
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
loader = traversalUriHttpEntry.getLoader();
dbEngine = traversalUriHttpEntry.getDbEngine();
@@ -262,22 +218,16 @@ public class LegacyMoxyConsumer extends RESTAPI {
public Response getLegacy(String content, String versionParam, String uri, String depthParam, String cleanUp, HttpHeaders headers, UriInfo info, HttpServletRequest req, Set<String> removeQueryParams, String resultIndex, String resultSize) {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
- Response response = null;
+ Response response;
TransactionalGraphEngine dbEngine = null;
- Loader loader = null;
+ Loader loader;
try {
validateRequest(info);
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
dbEngine = traversalUriHttpEntry.getDbEngine();
loader = traversalUriHttpEntry.getLoader();
MultivaluedMap<String, String> params = info.getQueryParameters();
@@ -301,7 +251,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
new DBRequest.Builder(HttpMethod.GET, uriObject, uriQuery, obj, headers, info, transId).build();
List<DBRequest> requests = new ArrayList<>();
requests.add(request);
- if (resultIndex != null && resultIndex != "-1" && resultSize != null && resultSize != "-1") {
+ if (resultIndex != null && !"-1".equals(resultIndex) && resultSize != null && !"-1".equals(resultSize)) {
traversalUriHttpEntry.setPaginationIndex(Integer.parseInt(resultIndex));
traversalUriHttpEntry.setPaginationBucket(Integer.parseInt(resultSize));
}
@@ -330,11 +280,11 @@ public class LegacyMoxyConsumer extends RESTAPI {
private MultivaluedMap<String, String> removeNonFilterableParams(MultivaluedMap<String, String> params) {
- String[] toRemove = { "depth", "cleanup", "nodes-only", "format", "resultIndex", "resultSize"};
+ String[] toRemove = { "depth", "cleanup", "nodes-only", "format", "resultIndex", "resultSize", "skip-related-to"};
Set<String> toRemoveSet = Arrays.stream(toRemove).collect(Collectors.toSet());
MultivaluedMap<String, String> cleanedParams = new MultivaluedHashMap<>();
- params.keySet().stream().forEach(k -> {
+ params.keySet().forEach(k -> {
if (!toRemoveSet.contains(k)) {
cleanedParams.addAll(k, params.get(k));
}
@@ -362,11 +312,9 @@ public class LegacyMoxyConsumer extends RESTAPI {
String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
TransactionalGraphEngine dbEngine = null;
- Response response = Response.status(404)
- .type(outputMediaType).build();
+ Response response;
boolean success = true;
@@ -374,14 +322,9 @@ public class LegacyMoxyConsumer extends RESTAPI {
validateRequest(info);
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
dbEngine = traversalUriHttpEntry.getDbEngine();
Loader loader = traversalUriHttpEntry.getLoader();
@@ -437,30 +380,20 @@ public class LegacyMoxyConsumer extends RESTAPI {
public Response deleteRelationship (String content, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @Context HttpHeaders headers, @Context UriInfo info, @Context HttpServletRequest req) {
MediaType inputMediaType = headers.getMediaType();
-
- String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
-
- Loader loader = null;
+ Loader loader;
TransactionalGraphEngine dbEngine = null;
- Response response = Response.status(404)
- .type(outputMediaType).build();
+ Response response;
boolean success = true;
try {
this.validateRequest(info);
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
loader = traversalUriHttpEntry.getLoader();
dbEngine = traversalUriHttpEntry.getDbEngine();
@@ -533,7 +466,6 @@ public class LegacyMoxyConsumer extends RESTAPI {
public Response getRelationshipList(String versionParam, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
Response response = null;
TransactionalGraphEngine dbEngine = null;
Loader loader = null;
@@ -541,14 +473,9 @@ public class LegacyMoxyConsumer extends RESTAPI {
try {
validateRequest(info);
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
dbEngine = traversalUriHttpEntry.getDbEngine();
loader = traversalUriHttpEntry.getLoader();
MultivaluedMap<String, String> params = info.getQueryParameters();
@@ -572,7 +499,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
new DBRequest.Builder(HttpMethod.GET_RELATIONSHIP, uriObject, uriQuery, obj, headers, info, transId).build();
List<DBRequest> requests = new ArrayList<>();
requests.add(request);
- if (resultIndex != null && resultIndex != "-1" && resultSize != null && resultSize != "-1") {
+ if (resultIndex != null && !"-1".equals(resultIndex) && resultSize != null && !"-1".equals(resultSize)) {
traversalUriHttpEntry.setPaginationIndex(Integer.parseInt(resultIndex));
traversalUriHttpEntry.setPaginationBucket(Integer.parseInt(resultSize));
}
@@ -627,8 +554,8 @@ public class LegacyMoxyConsumer extends RESTAPI {
parmList.add(key + "=" + value);
}
}
- String queryParams = Joiner.on("&").join(parmList);
- if (map.keySet().size() > 0) {
+ String queryParams = String.join("&", parmList);
+ if (!map.isEmpty()) {
path += params + queryParams;
}
@@ -650,27 +577,21 @@ public class LegacyMoxyConsumer extends RESTAPI {
*/
private Response handleWrites(MediaType mediaType, HttpMethod method, String content, String versionParam, String uri, HttpHeaders headers, UriInfo info) {
- Response response = null;
+ Response response;
TransactionalGraphEngine dbEngine = null;
- Loader loader = null;
- SchemaVersion version = null;
+ Loader loader;
+ SchemaVersion version;
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
- Boolean success = true;
+ boolean success = true;
try {
validateRequest(info);
version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
+
HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- traversalUriHttpEntry.setHttpEntryProperties(version, type);
+ traversalUriHttpEntry.setHttpEntryProperties(version);
loader = traversalUriHttpEntry.getLoader();
dbEngine = traversalUriHttpEntry.getDbEngine();
URI uriObject = UriBuilder.fromPath(uri).build();
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
index b9e5aa8..041952b 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java
@@ -19,43 +19,35 @@
*/
package org.onap.aai.rest;
-import java.net.URI;
-import java.util.Iterator;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.ModelType;
-import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.rest.db.HttpEntry;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.serialization.db.DBSerializer;
-import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.util.AAIConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.*;
+import javax.ws.rs.core.Response.Status;
+import java.net.URI;
+import java.util.Iterator;
+
/**
* The Class URLFromVertexIdConsumer.
*/
@Path("{version: v[1-9][0-9]*|latest}/generateurl")
public class URLFromVertexIdConsumer extends RESTAPI {
private ModelType introspectorFactoryType = ModelType.MOXY;
- private QueryStyle queryStyle = QueryStyle.TRAVERSAL_URI;
-
+
private final String ID_ENDPOINT = "/id/{vertexid: \\d+}";
/**
@@ -75,16 +67,14 @@ public class URLFromVertexIdConsumer extends RESTAPI {
public Response generateUrlFromVertexId(String content, @PathParam("version")String versionParam, @PathParam("vertexid")long vertexid, @Context HttpHeaders headers, @Context UriInfo info, @Context HttpServletRequest req) {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
SchemaVersion version = new SchemaVersion(versionParam);
StringBuilder result = new StringBuilder();
- Response response = null;
+ Response response;
TransactionalGraphEngine dbEngine = null;
try {
- DBConnectionType type = this.determineConnectionType(sourceOfTruth, realTime);
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
dbEngine = resourceHttpEntry.getDbEngine();
DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth);
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/VertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/VertexIdConsumer.java
index 3451528..6637d41 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/VertexIdConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/VertexIdConsumer.java
@@ -19,31 +19,10 @@
*/
package org.onap.aai.rest;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.javatuples.Pair;
import org.onap.aai.config.SpringContextAware;
import org.onap.aai.db.props.AAIProperties;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
@@ -54,11 +33,17 @@ import org.onap.aai.rest.db.DBRequest;
import org.onap.aai.rest.db.HttpEntry;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
-import org.onap.aai.serialization.db.DBSerializer;
-import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersion;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* The Class VertexIdConsumer.
*/
@@ -66,7 +51,6 @@ import org.onap.aai.setup.SchemaVersion;
public class VertexIdConsumer extends RESTAPI {
private ModelType introspectorFactoryType = ModelType.MOXY;
- private QueryStyle queryStyle = QueryStyle.TRAVERSAL_URI;
private final String ID_ENDPOINT = "/id/{vertexid: \\d+}";
@@ -92,22 +76,16 @@ public class VertexIdConsumer extends RESTAPI {
String outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
SchemaVersion version = new SchemaVersion(versionParam);
- Status status = Status.NOT_FOUND;
- String result = "";
Response response = null;
TransactionalGraphEngine dbEngine = null;
try {
- int depth = setDepth(depthParam);
- DBConnectionType type = this.determineConnectionType(sourceOfTruth, realTime);
resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
dbEngine = resourceHttpEntry.getDbEngine();
Loader loader = resourceHttpEntry.getLoader();
- DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth);
-
+
//get type of the object represented by the given id
Vertex thisVertex = null;
Iterator<Vertex> itr = dbEngine.asAdmin().getTraversalSource().V(vertexid);
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
index b06abaa..b7b4873 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java
@@ -19,18 +19,16 @@
*/
package org.onap.aai.rest.bulk;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
import org.javatuples.Pair;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.logging.LoggingContext;
import org.onap.aai.rest.bulk.pojos.Operation;
import org.onap.aai.rest.bulk.pojos.OperationResponse;
import org.onap.aai.rest.bulk.pojos.Transaction;
@@ -44,6 +42,8 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.util.AAIConfig;
import org.onap.aai.util.AAIConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@@ -57,11 +57,21 @@ import java.util.*;
@Path(value = "{version: v[1-9][0-9]*|latest}/bulk/single-transaction")
public class BulkSingleTransactionConsumer extends RESTAPI {
- private static final String TARGET_ENTITY = "aai-resources";
private static final Set<String> validOperations = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("put", "patch", "delete")));
+ private static final JsonParser parser = new JsonParser();
private int allowedOperationCount = 30;
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(BulkSingleTransactionConsumer.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(BulkSingleTransactionConsumer.class);
+
+ private final String uriPrefix;
+
+ public BulkSingleTransactionConsumer() {
+ uriPrefix = SpringContextAware.getApplicationContext().getEnvironment().getProperty("schema.uri.base.path", "");
+ }
+
+ public BulkSingleTransactionConsumer(String uriPrefix) {
+ this.uriPrefix = uriPrefix;
+ }
@POST
@Consumes(value = javax.ws.rs.core.MediaType.APPLICATION_JSON)
@@ -70,11 +80,8 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
- String realTime = headers.getRequestHeaders().getFirst("Real-Time");
SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type;
- initLogging(req, transId, sourceOfTruth);
boolean success = true;
TransactionalGraphEngine dbEngine = null;
@@ -82,11 +89,6 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
Response response;
try {
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
- } else {
- type = this.determineConnectionType(sourceOfTruth, realTime);
- }
// unmarshall the payload.
Gson gson = new Gson();
@@ -107,7 +109,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
//init http entry
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
Loader loader = resourceHttpEntry.getLoader();
dbEngine = resourceHttpEntry.getDbEngine();
@@ -123,16 +125,19 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
//process db requests
Pair<Boolean, List<Pair<URI, Response>>> results = resourceHttpEntry.process(dbRequests, sourceOfTruth, this.enableResourceVersion());
- //process result of db requests
- transactionResponse = buildTransactionResponse(transaction, results.getValue1());
-
//commit/rollback based on results
success = results.getValue0();
- response = Response
- .status(Response.Status.CREATED)
- .entity(new GsonBuilder().serializeNulls().create().toJson(transactionResponse))
- .build();
+ if (success) { //process result of db requests if all are successful
+ transactionResponse = buildTransactionResponse(transaction, results.getValue1());
+ response = Response
+ .status(Response.Status.CREATED)
+ .entity(new GsonBuilder().serializeNulls().create().toJson(transactionResponse))
+ .build();
+ } else {
+ response = getErrorResponseForFirstFailure(transaction, results.getValue1(), info, javax.ws.rs.HttpMethod.POST, headers);
+
+ }
} catch (AAIException e) {
response = consumerExceptionResponseGenerator(headers, info, javax.ws.rs.HttpMethod.POST, e);
@@ -152,6 +157,44 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
return response;
}
+ private Response getErrorResponseForFirstFailure(Transaction transaction, List<Pair<URI, Response>> results, UriInfo info, String action, HttpHeaders headers) throws AAIException {
+ final String failureInResponse = "Operation %s with action (%s) on uri (%s) failed with status code (%s), error code (%s) and msg (%s)";
+ for (int i = 0; i < transaction.getOperations().size(); i++) {
+ if (!Response.Status.Family.familyOf(results.get(i).getValue1().getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
+ final JsonArray vars = parser.parse(results.get(i).getValue1().getEntity().toString()).getAsJsonObject()
+ .getAsJsonObject("requestError")
+ .getAsJsonObject("serviceException")
+ .getAsJsonArray("variables");
+ StringBuilder sb = new StringBuilder();
+ for (int j = 2; j < vars.size() - 1; j++) {
+ if (j != 2) {
+ sb.append(": ");
+ }
+ sb.append(vars.get(j).getAsString());
+ }
+ final AAIException e = new AAIException("AAI_3000",
+ String.format(
+ failureInResponse,
+ i,
+ vars.get(0).getAsString(),
+ vars.get(1).getAsString(),
+ results.get(i).getValue1().getStatus(),
+ vars.get(vars.size()-1).getAsString(),
+ sb.toString()
+ ));
+ ArrayList<String> templateVars = new ArrayList<>();
+ templateVars.add(action); //GET, PUT, etc
+ templateVars.add(info.getPath());
+ return Response
+ .status(results.get(i).getValue1().getStatus())
+ .entity(ErrorLogHelper.getRESTAPIErrorResponseWithLogging(headers.getAcceptableMediaTypes(), e, templateVars))
+ .build();
+ }
+ }
+ LOGGER.error("Transaction Process reported failure, none found.");
+ throw new AAIException("AAI_3000", "Transaction Process reported failure, none found.");
+ }
+
/**
* Builds the response
@@ -297,11 +340,9 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
List<BulkOperation> bulkOperations = new ArrayList<>(transaction.getOperations().size());
BulkOperation bulkOperation;
- for (int i = 0; i < transaction.getOperations().size(); i++) {
- final Operation operation = transaction.getOperations().get(i);
+ for (Operation operation : transaction.getOperations()) {
bulkOperation = new BulkOperation();
-
- UriComponents uriComponents = UriComponentsBuilder.fromUriString(operation.getUri()).build();
+ UriComponents uriComponents = UriComponentsBuilder.fromUriString(getUri(operation)).build();
bulkOperation.setUri(UriBuilder.fromPath(uriComponents.getPath()).build());
bulkOperation.addUriInfoQueryParams(uriComponents.getQueryParams());
bulkOperation.setHttpMethod(getHttpMethod(operation.getAction(), bulkOperation.getUri()));
@@ -312,6 +353,17 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
return bulkOperations;
}
+ private String getUri(Operation operation) {
+ String uri = operation.getUri();
+ if (uri == null || uri.isEmpty()) {
+ return uri;
+ } else if (uri.charAt(0) != '/') {
+ uri = '/' + uri;
+ }
+ return uri.replaceAll("^" + uriPrefix + "/v\\d+", "");
+ }
+
+
/**
* Map action to httpmethod
* @param action action to be mapped
@@ -386,21 +438,6 @@ public class BulkSingleTransactionConsumer extends RESTAPI {
}
- /**
- * Initialize logging context
- * @param req requestContext
- * @param transId transaction id
- * @param sourceOfTruth application source
- */
- private void initLogging(@Context HttpServletRequest req, String transId, String sourceOfTruth) {
- String serviceName = req.getMethod() + " " + req.getRequestURI().toString();
- LoggingContext.requestId(transId);
- LoggingContext.partnerName(sourceOfTruth);
- LoggingContext.serviceName(serviceName);
- LoggingContext.targetEntity(TARGET_ENTITY);
- LoggingContext.targetServiceName(serviceName);
- }
-
protected boolean enableResourceVersion() {
return true;
}
diff --git a/aai-resources/src/main/java/org/onap/aai/service/AuthorizationService.java b/aai-resources/src/main/java/org/onap/aai/service/AuthorizationService.java
index d2597d0..9b5a614 100644
--- a/aai-resources/src/main/java/org/onap/aai/service/AuthorizationService.java
+++ b/aai-resources/src/main/java/org/onap/aai/service/AuthorizationService.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.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.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-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
index 9592639..c5f3e08 100644
--- a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
+++ b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
@@ -28,6 +28,8 @@ import java.util.Comparator;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.Priority;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ContainerResponseFilter;
import jersey.repackaged.com.google.common.collect.Sets;
@@ -41,6 +43,7 @@ import org.onap.aai.rest.URLFromVertexIdConsumer;
import org.onap.aai.rest.VertexIdConsumer;
import org.onap.aai.rest.bulk.BulkSingleTransactionConsumer;
import org.onap.aai.rest.util.EchoResponse;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
import org.reflections.Reflections;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -55,9 +58,11 @@ public class JerseyConfiguration {
private static final String LOGGING_ENABLED_PROPERTY = "aai.request.logging.enabled";
private static final String INTERCEPTOR_PACKAGE = "org.onap.aai.interceptors";
+ private static final String LOGGING_INTERCEPTOR_PACKAGE = "org.onap.aai.aailog.filter";
private static final boolean ENABLE_RESPONSE_LOGGING = false;
private final Reflections reflections = new Reflections(INTERCEPTOR_PACKAGE);
+ private final Reflections loggingReflections = new Reflections(LOGGING_INTERCEPTOR_PACKAGE);
private final Environment environment;
@Autowired
@@ -80,7 +85,7 @@ public class JerseyConfiguration {
URLFromVertexIdConsumer.class
);
resourceConfig.registerClasses(classes);
- registerFiltersForClasses(resourceConfig, ContainerRequestFilter.class, ContainerResponseFilter.class);
+ registerFiltersForClasses(resourceConfig, ContainerRequestFilter.class, ContainerResponseFilter.class, AuditLogContainerFilter.class);
if (isLoggingEnabled()) {
logRequests(resourceConfig);
@@ -96,8 +101,8 @@ public class JerseyConfiguration {
}
private <T> void registerFiltersFor(Class<T> clazz, ResourceConfig resourceConfig) {
- Set<Class<? extends T>> filters = reflections.getSubTypesOf(clazz);
-
+ Set<Class<? extends T>> filters = loggingReflections.getSubTypesOf(clazz);
+ filters.addAll(reflections.getSubTypesOf(clazz));
throwIfPriorityAnnotationAbsent(filters);
filters.stream()
diff --git a/aai-resources/src/main/resources/aaf/bath_config.csv b/aai-resources/src/main/resources/aaf/onap/bath_config.csv
index 433b333..433b333 100644
--- a/aai-resources/src/main/resources/aaf/bath_config.csv
+++ b/aai-resources/src/main/resources/aaf/onap/bath_config.csv
diff --git a/aai-resources/src/main/resources/aaf/org.onap.aai.keyfile b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.keyfile
index 3416d4a..3416d4a 100644
--- a/aai-resources/src/main/resources/aaf/org.onap.aai.keyfile
+++ b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.keyfile
diff --git a/aai-resources/src/main/resources/aaf/org.onap.aai.p12 b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.p12
index 023e2ea..023e2ea 100644
--- a/aai-resources/src/main/resources/aaf/org.onap.aai.p12
+++ b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.p12
Binary files differ
diff --git a/aai-resources/src/main/resources/aaf/org.onap.aai.props b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.props
index 6e683df..33f0f3c 100644
--- a/aai-resources/src/main/resources/aaf/org.onap.aai.props
+++ b/aai-resources/src/main/resources/aaf/onap/org.onap.aai.props
@@ -3,12 +3,12 @@
# @copyright 2016, AT&T
############################################################
cadi_x509_issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US
-cadi_keyfile=aai-resources/src/main/resources/aaf/org.onap.aai.keyfile
-cadi_keystore=aai-resources/src/main/resources/aaf/org.onap.aai.p12
+cadi_keyfile=aai-resources/src/main/resources/aaf/onap/org.onap.aai.keyfile
+cadi_keystore=aai-resources/src/main/resources/aaf/onap/org.onap.aai.p12
cadi_keystore_password=enc:383RDJRFA6yQz9AOxUxC1iIg3xTJXityw05MswnpnEtelRQy2D4r5INQjrea7GTV
#cadi_key_password=enc:<KEY PASSWORD (optional if the same as KEYSTORE PASSWORD)>
cadi_alias=aai@aai.onap.org
-cadi_truststore=aai-resources/src/main/resources/aaf/truststoreONAPall.jks
+cadi_truststore=aai-resources/src/main/resources/aaf/onap/truststoreONAPall.jks
cadi_truststore_password=enc:s77wlnZFoQ08NhnU3OSeWO6uKgRwC6sAK-wTvVubNz2
cadi_loglevel=INFO
-cadi_bath_convert=aai-resources/src/main/resources/aaf/bath_config.csv
+cadi_bath_convert=aai-resources/src/main/resources/aaf/onap/bath_config.csv
diff --git a/aai-resources/src/main/resources/aaf/org.osaaf.location.props b/aai-resources/src/main/resources/aaf/onap/org.osaaf.location.props
index 73a3a1e..73a3a1e 100644
--- a/aai-resources/src/main/resources/aaf/org.osaaf.location.props
+++ b/aai-resources/src/main/resources/aaf/onap/org.osaaf.location.props
diff --git a/aai-resources/src/main/resources/aaf/truststoreONAPall.jks b/aai-resources/src/main/resources/aaf/onap/truststoreONAPall.jks
index 2da1dcc..2da1dcc 100644
--- a/aai-resources/src/main/resources/aaf/truststoreONAPall.jks
+++ b/aai-resources/src/main/resources/aaf/onap/truststoreONAPall.jks
Binary files differ
diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties
index 3cabe4a..d6064d5 100644
--- a/aai-resources/src/main/resources/application.properties
+++ b/aai-resources/src/main/resources/application.properties
@@ -4,7 +4,7 @@ info.build.name=resources
info.build.description=Resources Microservice
info.build.version=1.1.0
-spring.application.name=aai-resources
+spring.application.name=Resources Microservice
spring.jersey.type=filter
server.contextPath=/
@@ -29,7 +29,6 @@ server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
server.certs.location=${server.local.startpath}etc/auth/
#server.keystore.name=keystore.jks
server.keystore.name=aai_keystore
-#server.truststore.name=com.att.ecomp.aai.dev.trust.jks
server.truststore.name=aai_keystore
server.port=8447
server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
@@ -57,7 +56,7 @@ schema.ingest.file=${server.local.startpath}/application.properties
schema.uri.base.path=/aai
# Lists all of the versions in the schema
-schema.version.list=v10,v11,v12,v13,v14,v15,v16
+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
@@ -70,7 +69,10 @@ 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=v16
+schema.version.api.default=v19
+
+
+#schema.translator.list=schema-service
schema.translator.list=config
schema.service.base.url=https://localhost:8452/aai/schema-service/v1/
schema.service.nodes.endpoint=nodes?version=
@@ -82,3 +84,28 @@ schema.service.ssl.trust-store=${server.certs.location}${server.truststore.name}
schema.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
schema.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
schema.service.versions.override=false
+
+# Location of the cadi properties file should be specified here
+aaf.cadi.file=${server.local.startpath}/cadi.properties
+
+delta.events.enabled=false
+
+# Specifies what type of request should it be: one-way-ssl, two-way-ssl, no-auth
+validation.service.client=one-way-ssl
+# Base url for the validation service
+validation.service.base.url=https://localhost:9501/services/validation-service
+# Client certificate to use to make the request to validation
+validation.service.ssl.key-store=${server.local.startpath}/etc/auth/aai-client-cert.p12
+# Truststore to use to make the request to validation
+validation.service.ssl.trust-store=${server.local.startpath}/etc/auth/tomcat_keystore
+# Client certificate password for the validation
+validation.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+# Truststore password for the validation
+validation.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+# Amount of time that the client should wait in milliseconds before request failing
+validation.service.timeout-in-milliseconds=3000
+# List of aai node types that should be send to the validation microservice
+validation.service.node-types=generic-vnf,lag-interface,l-interface,logical-link,newvce,nos-server,p-interface,pnf,pserver,vce,vlan,vnfc,vpls-pe,vserver
+# List of X-FromAppId regexes seperated by comma to ignore the pre validation for
+# Note: please don't add any client id here as this is only for testing tools such as robot
+validation.service.exclusion-regexes=
diff --git a/aai-resources/src/main/resources/cadi.properties b/aai-resources/src/main/resources/cadi.properties
index 269610f..24d46d5 100644
--- a/aai-resources/src/main/resources/cadi.properties
+++ b/aai-resources/src/main/resources/cadi.properties
@@ -1,6 +1,6 @@
cadi_loglevel=INFO
-cadi_prop_files=aai-resources/src/main/resources/aaf/org.osaaf.location.props:aai-resources/src/main/resources/aaf/org.onap.aai.props
+cadi_prop_files=aai-resources/src/main/resources/aaf/onap/org.osaaf.location.props:aai-resources/src/main/resources/aaf/onap/org.onap.aai.props
# OAuth2
aaf_oauth2_token_url=https://AAF_LOCATE_URL/AAF_NS.token:2.0/token
diff --git a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
index d1aace6..f53fca0 100644
--- a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
+++ b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
@@ -45,7 +45,7 @@ aai.tools.username=AAI
aai.tools.password=AAI
aai.server.url.base=https://localhost:8443/aai/
-aai.server.url=https://localhost:8443/aai/v15/
+aai.server.url=https://localhost:8443/aai/v19/
aai.global.callback.url=https://localhost:8443/aai/
aai.truststore.filename=aai_keystore
@@ -53,18 +53,18 @@ aai.truststore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0
aai.keystore.filename=aai-client-cert.p12
aai.keystore.passwd.x=
-aai.notification.current.version=v15
+aai.notification.current.version=v19
aai.notificationEvent.default.status=UNPROCESSED
aai.notificationEvent.default.eventType=AAI-EVENT
aai.notificationEvent.default.domain=devINT1
aai.notificationEvent.default.sourceName=aai
aai.notificationEvent.default.sequenceNumber=0
aai.notificationEvent.default.severity=NORMAL
-aai.notificationEvent.default.version=v15
+aai.notificationEvent.default.version=v19
# This one lets us enable/disable resource-version checking on updates/deletes
aai.resourceversion.enableflag=true
aai.logging.maxStackTraceEntries=10
-aai.default.api.version=v15
+aai.default.api.version=v19
# Used by Model-processing code
aai.model.delete.sleep.per.vtx.msec=500
@@ -96,7 +96,7 @@ aai.jms.enable=false
aai.crud.timeoutenabled=true
#timeout app specific -1 to bypass for that app id, a whole number to override the timeout with that value (in ms)
-aai.crud.timeout.appspecific=JUNITTESTAPP1,1|JUNITTESTAPP2,-1|DCAE-CCS,-1|DCAES,-1|AAIRctFeed,-1|NewvceCreator,-1|IANewvceCreator,-1|AAI-CSIOVALS,-1
+aai.crud.timeout.appspecific=JUNITTESTAPP1,1|JUNITTESTAPP2,-1|DCAE-CCS,-1|DCAES,-1|AAIRctFeed,-1|NewvceCreator,-1|IANewvceCreator,-1|AAI-CSIOVALS,-1|AAI-SAREA,-1
#default timeout limit added for crud if not overridden (in ms)
aai.crud.timeoutlimit=100000
@@ -108,8 +108,11 @@ aai.bulkconsumer.payloadlimit=30
#aai.bulkconsumer.payloadoverride=E6F04B93462CB5B0EDF41C05A9DDF5C3FE59748F
aai.bulkconsumer.payloadoverride=false
-aai.rest.getall.depthparam=asofijaosjf-oijfadao-43jj-a508-8539cd36ecda
-aai.resourceversion.disabled.uuid=ajifsjisajfiasjf-oijfadao-43jj-a508-8539cd36ecda
+aai.rest.getall.depthparam=5807c3c3-92cd-44d7-a508-8539cd36ecda
+#data import task
+aai.dataimport.enable=true
+aai.dataimport.input.location=/etc/scriptdata/addmanualdata/tenant_isolation
+aai.resourceversion.disabled.uuid=38cf3090-6a0c-4e9d-8142-4332a7352846
aai.use.realtime=true
@@ -118,8 +121,38 @@ aai.resource.formatter.threshold=10
# Indicating whether or not to log the implicit delete objects
# Set this property to true if you want to log implicit delete objects
-aai.implied.delete.log.enabled=true
+aai.implied.delete.log.enabled=false
# Specifies how much upper bound the deletable objects should you log
# If this property is not specified it will log everything
# Uncomment it and specify an upper limit if you only want to log up to a certain deletes
#aai.implied.delete.log.limit=10000
+
+#################################################################################
+#
+# aai.implied.delete.whitelist.< X-FromAppId HTTP Header in lowercase >=<List of objects comma seperated in single quotes>
+#
+# Examples:
+#
+# aai.implied.delete.whitelist.so='vserver'
+#
+# Above example, if an HTTP Header X-FromAppId with value SO or So or sO or so
+# made a PUT request with vserver and set the children as empty in payload
+# Then they would be allowed to do so
+# For any other objects SO would not be able to delete children
+# it would fail with an error
+#
+#################################################################################
+# aai.implied.delete.whitelist.sdc=*
+#
+# Above example, if an HTTP header X-FromAppId with value sdc, case insensitive,
+# they are able to implicitly delete any children object on PUT
+#
+#################################################################################
+# aai.implied.delete.whitelist.idf='vserver','vce'
+#
+# Above example, if an HTTP header X-FromAppId with value idf, case insensitive,
+# they are able to implicitly delete on children of vce and vserver on PUT
+#
+#################################################################################
+aai.implied.delete.whitelist.sdnc='vce'
+aai.implied.delete.whitelist.ro='vserver'
diff --git a/aai-resources/src/main/resources/etc/appprops/datatoolscrons.properties b/aai-resources/src/main/resources/etc/appprops/datatoolscrons.properties
new file mode 100644
index 0000000..a4e226e
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/appprops/datatoolscrons.properties
@@ -0,0 +1,8 @@
+#file feed cron expressions
+#please note these must be in Quartz cron syntax
+#column key: seconds minutes hours dayOfMonth month dayOfWeek
+#note: dayOfWeek is optional, the rest are mandatory
+#for more information refer to http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html
+#this site can generate new expressions for you: http://www.cronmaker.com/
+#BUT you must omit the last (seventh) column when you copy its output (spring expects exactly 6 fields and doesn't allow the seventh optional one)
+dataimporttask.cron=0 02 5 * * ?
diff --git a/aai-resources/src/main/resources/etc/appprops/delta-event-publisher.properties b/aai-resources/src/main/resources/etc/appprops/delta-event-publisher.properties
new file mode 100644
index 0000000..1e425a1
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/appprops/delta-event-publisher.properties
@@ -0,0 +1,4 @@
+topic=AAI-DELTA-EVENT
+partition=AAI
+maxBatchSize=100
+maxAgeMs=250
diff --git a/aai-resources/src/main/resources/etc/appprops/error.properties b/aai-resources/src/main/resources/etc/appprops/error.properties
index 30b248b..b2dc448 100644
--- a/aai-resources/src/main/resources/etc/appprops/error.properties
+++ b/aai-resources/src/main/resources/etc/appprops/error.properties
@@ -3,181 +3,187 @@
#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_3025=5:4:FATAL:3025:500:3025:Error connecting to Schema Service
-AAI_3026=5:4:FATAL:3026:500:3026:Error reading OXM from Schema Service
-AAI_3027=5:4:FATAL:3026:500:3026:Error reading EdgeRules from Schema Service
+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:ERROR: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_3025=5:4:FATAL:3025:500:3025:Error connecting to Schema Service:400
+AAI_3026=5:4:FATAL:3026:500:3026:Error reading OXM from Schema Service:400
+AAI_3027=5:4:FATAL:3026:500:3026:Error reading EdgeRules from Schema Service:400
# 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:300
+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
+AAI_4019=4:0:WARN:4019:400:3000:Request failed due to violations:400
+AAI_4020=5:4:ERROR:4020:500:3000:Unknown exception to calling validation service:500
+AAI_4021=5:4:FATAL:3025:500:4021:Error connecting to Validation Service:400
+
#--- 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_6148=5:4:ERROR:6148:400:3000:More than one node found %1
-AAI_6149=5:4:ERROR:6149:404:3000:No relationship was found
+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
+AAI_6148=5:4:ERROR:6148:400:3000:More than one node found %1:300
+AAI_6149=5:4:ERROR:6149:404:3000:No relationship was found: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:200
#--- 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
+AAI_9109=5:0:WARN:9109:403:3300:User is not allowed to perform implicit delete:500
#--- 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-resources/src/main/resources/etc/appprops/janusgraph-cached.properties b/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties
index c90816d..a0926e7 100644
--- a/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties
+++ b/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties
@@ -18,6 +18,7 @@
# ============LICENSE_END=========================================================
query.fast-property=true
+query.smart-limit=false
# the following parameters are not reloaded automatically and require a manual bounce
storage.backend=inmemory
storage.hostname=localhost
@@ -33,4 +34,4 @@ cache.db-cache-time = 180000
cache.db-cache-size = 0.3
#load graphson file on startup
-load.snapshot.file=false \ No newline at end of file
+load.snapshot.file=false
diff --git a/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties b/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties
index 36256c9..3f00b55 100644
--- a/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties
+++ b/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties
@@ -18,6 +18,7 @@
# ============LICENSE_END=========================================================
query.fast-property=true
+query.smart-limit=false
# the following parameters are not reloaded automatically and require a manual bounce
storage.backend=inmemory
storage.hostname=localhost
@@ -30,4 +31,4 @@ storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
cache.db-cache = false
#load graphson file on startup
-load.snapshot.file=false \ No newline at end of file
+load.snapshot.file=false
diff --git a/aai-resources/src/main/resources/logback.xml b/aai-resources/src/main/resources/logback.xml
index cb2f7e9..ee2c903 100644
--- a/aai-resources/src/main/resources/logback.xml
+++ b/aai-resources/src/main/resources/logback.xml
@@ -31,13 +31,29 @@
<property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
<jmxConfigurator />
<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|%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"/>
-
- <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(%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" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
@@ -64,71 +80,63 @@
<includeCallerData>true</includeCallerData>
<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>
+ <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">
<queueSize>1000</queueSize>
<includeCallerData>true</includeCallerData>
- <appender-ref ref="METRIC" />
+ <appender-ref ref="METRIC"/>
</appender>
<appender name="DEBUG"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${logDirectory}/rest/debug.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
- </fileNamePattern>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <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">
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <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>
<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>
+ <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-ref ref="ERROR"/>
</appender>
<appender name="AUDIT"
@@ -138,8 +146,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 +169,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,9 +190,10 @@
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfErrorLogPattern}</pattern>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
</encoder>
+
</appender>
<appender name="dmaapAAIEventConsumerDebug"
@@ -199,8 +208,8 @@
<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"
@@ -215,8 +224,8 @@
<fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/dmaap-transaction.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
</encoder>
</appender>
<appender name="dmaapAAIEventConsumerMetric"
@@ -231,8 +240,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"
@@ -245,10 +254,29 @@
<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>
<!-- logback internals logging -->
<logger name="ch.qos.logback.classic" level="WARN" />
@@ -272,43 +300,40 @@
<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" />
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="org.onap.aai.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.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.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.aailog.logs.AaiDBMetricLog" level="INFO">
+ <appender-ref ref="asyncMETRIC"/>
+ </logger>
+ <logger name="org.onap.aai.aailog.logs.AaiDmaapMetricLog" level="INFO">
+ <appender-ref ref="dmaapAAIEventConsumerMetric"/>
+ </logger>
+ <logger name="org.onap.aai.logging.ErrorLogHelper" level="WARN">
+ <appender-ref ref="asyncERROR"/>
+ </logger>
+ <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">
<appender-ref ref="dmaapAAIEventConsumer" />
<appender-ref ref="dmaapAAIEventConsumerDebug" />
- <appender-ref ref="dmaapAAIEventConsumerMetric" />
</logger>
<logger name="com.att.nsa.mr" level="INFO" >
<appender-ref ref="dmaapAAIEventConsumerInfo" />
</logger>
- <!-- ============================================================================ -->
- <!-- 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" />
<appender-ref ref="STDOUT" />
diff --git a/aai-resources/src/main/scripts/bulkprocess.sh b/aai-resources/src/main/scripts/bulkprocess.sh
index 5611bf7..c4bca27 100644
--- a/aai-resources/src/main/scripts/bulkprocess.sh
+++ b/aai-resources/src/main/scripts/bulkprocess.sh
@@ -43,10 +43,10 @@ if [ -z "$2" ]; then
exit 1
fi
-[[ "$XFROMAPPID" =~ [a-zA-Z0-9][a-zA-Z0-9]*-[a-zA-Z0-9][a-zA-Z0-9]* ]] || {
- echo "XFROMAPPID doesn't match the following regex [a-zA-Z0-9][a-zA-Z0-9]*-[a-zA-Z0-9][a-zA-Z0-9]*";
- exit 1;
-}
+case "${XFROMAPPID}" in
+ [a-zA-Z0-9][a-zA-Z0-9]*-[a-zA-Z0-9][a-zA-Z0-9]*) ;;
+ *) echo "XFROMAPPID doesn't match the following regex [a-zA-Z0-9][a-zA-Z0-9]*-[a-zA-Z0-9][a-zA-Z0-9]*"; exit 1; ;;
+esac
XTRANSID=$3
diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh
index e99746d..14358d9 100644
--- a/aai-resources/src/main/scripts/common_functions.sh
+++ b/aai-resources/src/main/scripts/common_functions.sh
@@ -60,16 +60,19 @@ execute_spring_jar(){
JAVA_OPTS="$JAVA_OPTS -Dlogback.configurationFile=${logbackFile}";
export SOURCE_NAME=$(grep '^schema.source.name=' ${PROJECT_HOME}/resources/application.properties | cut -d"=" -f2-);
- # Needed for the schema ingest library beans
- eval $(grep '^schema\.' ${PROJECT_HOME}/resources/application.properties | \
- sed 's/^\(.*\)$/JAVA_OPTS="$JAVA_OPTS -D\1"/g' | \
- sed 's/${server.local.startpath}/${PROJECT_HOME}\/resources/g'| \
- sed 's/${schema.source.name}/'${SOURCE_NAME}'/g'\
- )
-
- JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
-
- ${JAVA_HOME}/bin/java ${JVM_OPTS} ${JAVA_OPTS} -jar ${EXECUTABLE_JAR} "$@"
+ # Needed for the schema ingest library beans
+ eval $(egrep '^(schema|server)\.' ${PROJECT_HOME}/resources/application.properties | \
+ sed 's/^\(.*\)$/JAVA_OPTS="$JAVA_OPTS -D\1"/g' | \
+ sed 's/${server.local.startpath}/${PROJECT_HOME}\/resources/g'| \
+ sed 's/${schema.source.name}/'${SOURCE_NAME}'/g'\
+ )
+
+ JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
+
+ "${JAVA_HOME}/bin/java" ${JVM_OPTS} ${JAVA_OPTS} -jar ${EXECUTABLE_JAR} "$@" || {
+ echo "Failed to run the tool $0 successfully";
+ exit 1;
+ }
}
# Prints the start date and the script that the user called
diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh
index 016c5c3..bd7f7bd 100644
--- a/aai-resources/src/main/scripts/install/addManualData.sh
+++ b/aai-resources/src/main/scripts/install/addManualData.sh
@@ -75,41 +75,66 @@ error_exit () {
rel="/"$1"/"
k=0
-TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt
-COMMAND=`ls ${TEXT_PATH} | sort -f`
-
-ls ${TEXT_PATH} >/dev/null 2>&1
-if [ $? -ne 0 ]
+if [ "$1" = "tenant_isolation" ]
then
-echo "No manual data to add for $1";
-exit 0;
+ COMPLEX_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f`
+ ZONE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f`
+ CR_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f`
+ TENANT_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/tenant -name "*.txt" -print | sort -f`
+ AZ_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f`
+ PSERVER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f`
+ CUSTOMER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/customer -name "*.txt" -print | sort -f`
+ SERVICESUB_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/service-subscription -name "*.txt" -print | sort -f`
+ SERVICE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/service -name "*.txt" -print | sort -f`
+
+ TEXT_PATH="${COMPLEX_TEXT_PATH} ${ZONE_TEXT_PATH} ${CR_TEXT_PATH} ${CUSTOMER_TEXT_PATH} ${SERVICE_TEXT_PATH} ${SERVICESUB_TEXT_PATH} ${TENANT_TEXT_PATH} ${AZ_TEXT_PATH} ${PSERVER_TEXT_PATH}"
+ COMMAND=${TEXT_PATH}
+elif [ "$1" = "vm_export" ]
+then
+ TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export/*.txt
+ COMMAND=`ls ${TEXT_PATH} | sort -rf`
+else
+ TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt
+ COMMAND=`ls ${TEXT_PATH} | sort -f`
fi
+#ls ${TEXT_PATH} >/dev/null 2>&1
+#if [ $? -ne 0 ]
+#then
+#echo "No manual data to add for $1";
+#exit 0;
+#fi
+
for filepath in ${COMMAND}
do
-contains $filepath $rel
-if [ $? -eq 0 ]
-then
-jsonfile=${filepath%???}json
-j=0
-while IFS=\n read -r i
-do
-echo "##### Begin putTool for $i ##### from file $filepath" | tee -a $OUTFILE
-resource=`echo $i | tr -d '\r'`
-errorcode=412
-$PROJECT_HOME/scripts/putTool.sh $resource $jsonfile $errorcode 1 0 na 1 >> $OUTFILE 2>&1 || error_exit "$resource" $j $filepath
-echo "##### End putTool for $resource #####" | tee -a $OUTFILE
-echo "Begin getTool for $resource" | tee -a $OUTFILE
-$PROJECT_HOME/scripts/getTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$i" $j $filepath
-echo "End getTool for $resource" | tee -a $OUTFILE
-
-j=$(expr "$j" + 1)
-k=$(expr "$k" + 1)
-done < $filepath
-
-fi
-
-done
+ echo "File path ${filepath}"
+ contains $filepath $rel
+ if [ $? -eq 0 ]
+ then
+ jsonfile=${filepath%???}json
+ j=0
+ while IFS=\n read -r i
+ do
+ echo "##### Begin putTool for $i ##### from file $filepath" | tee -a $OUTFILE
+ resource=`echo $i | tr -d '\r'`
+ errorcode=412
+ $PROJECT_HOME/scripts/putTool.sh $resource $jsonfile $errorcode >> $OUTFILE 2>&1 || error_exit "$resource" $j $filepath
+ echo "##### End putTool for $resource #####" | tee -a $OUTFILE
+ contains $resource "relationship-list"
+ if [ $? -eq 0 ]
+ then
+ echo "skip getTool for $resource" | tee -a $OUTFILE
+ else
+ echo "Begin getTool for $resource" | tee -a $OUTFILE
+ $PROJECT_HOME/scripts/getTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$i" $j $filepath
+ echo "End getTool for $resource" | tee -a $OUTFILE
+ fi
+
+ j=$(expr "$j" + 1)
+ k=$(expr "$k" + 1)
+ done < $filepath
+ fi
+ done
if [ $k -eq 0 ]
then
echo "No manual data to add for release $1";
diff --git a/aai-resources/src/main/scripts/updatePem.sh b/aai-resources/src/main/scripts/updatePem.sh
index 6e6ac6f..81ba65b 100644
--- a/aai-resources/src/main/scripts/updatePem.sh
+++ b/aai-resources/src/main/scripts/updatePem.sh
@@ -27,12 +27,24 @@ start_date;
check_user;
source_profile;
-CERTPATH=$PROJECT_HOME/resources/etc/auth/
+prop_file=$PROJECT_HOME/resources/application.properties
+
+CERTPATH=${PROJECT_HOME}/resources/etc/auth/
KEYNAME=aaiClientPrivateKey.pem
CERTNAME=aaiClientPublicCert.pem
+CERTIFICATE_FILE=${CERTPATH}aai-client-cert.p12
+
+CERTMAN_PATH=`grep ^server.certs.location $prop_file |cut -d'=' -f2 |tr -d "\015"`
+if [ -z $CERTMAN_PATH ]; then
+ echo "Property [server.certs.location] not found in file $prop_file, continuing with default"
+ pw=$(execute_spring_jar org.onap.aai.util.AAIConfigCommandLinePropGetter "" "aai.keystore.passwd" 2> /dev/null | tail -1)
+else
+ # Assume AAF certificate container use
+ pw=$(< ${CERTMAN_PATH}/.password)
+ CERTIFICATE_FILE=${CERTMAN_PATH}/certificate.pkcs12
+fi
-pw=$(execute_spring_jar org.onap.aai.util.AAIConfigCommandLinePropGetter "" "aai.keystore.passwd" 2> /dev/null | tail -1)
-openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$CERTNAME -clcerts -nokeys -passin pass:$pw
-openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$KEYNAME -nocerts -nodes -passin pass:$pw
+openssl pkcs12 -in ${CERTIFICATE_FILE} -out $CERTPATH$CERTNAME -nokeys -nodes -passin pass:$pw
+openssl pkcs12 -in ${CERTIFICATE_FILE} -nocerts -out $CERTPATH$KEYNAME -nodes -passin pass:$pw
end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh
index e79edd1..ce0a8f6 100644
--- a/aai-resources/src/main/scripts/updateTool.sh
+++ b/aai-resources/src/main/scripts/updateTool.sh
@@ -129,36 +129,34 @@ fi
#or
#'physical-location-id:complex-id, city:New York'
thirdarg=$3
-isjson = false
+isjson=false
if [[ "$thirdarg" == *json || "$thirdarg" == *JSON ]]; then
- isjson = true
+ isjson=true
else
#For Usage 2, format input into JSON string format
JSONSTRING="{"
INPUT=$3
#replace any spaces with %20
- INPUT=${INPUT// /%20}
+ INPUT=$(echo ${INPUT} | sed 's/ /%20/g');
- for i in ${INPUT//,/ };
+ for i in $(echo ${INPUT} | sed 's/,/ /g');
do
#change any %20 back to space )
- i=${i//%20/ }
- #echo "after change to space=$i"
+ i=$(echo ${i} | sed 's/%20/ /g');
#trim modstring to remove any beginning spaces (" city" becomes "city")
- i="${i##*( )}"
-
+ i=$(echo ${i} | sed 's/^[ \t]*//');
+
#add JSON quotes
MODSTRING=" \"$i\","
- MODSTRING=${MODSTRING//[:]/'": "'}
- #echo "MODSTRING=$MODSTRING"
+ MODSTRING=$(echo ${MODSTRING} | sed 's/:/": "/g');
- JSONSTRING+=$MODSTRING
+ JSONSTRING="${JSONSTRING}${MODSTRING}"
done
JSONSTRING="${JSONSTRING%?}"
- JSONSTRING+=" }"
+ JSONSTRING="${JSONSTRING} }"
echo "JSON string is $JSONSTRING"
fi
@@ -225,4 +223,4 @@ else
fi
echo `date` " Done $0, returning $RC"
-exit $RC \ No newline at end of file
+exit $RC
diff --git a/aai-resources/src/main/scripts/vmExportCloudRegions.sh b/aai-resources/src/main/scripts/vmExportCloudRegions.sh
new file mode 100644
index 0000000..95ec969
--- /dev/null
+++ b/aai-resources/src/main/scripts/vmExportCloudRegions.sh
@@ -0,0 +1,517 @@
+#!/bin/ksh
+#
+###
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright (C) 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=========================================================
+###
+
+#
+# vmExportCloudRegions.sh -- This tool is used to generate script payloads of
+# vm and interfaces linked to a specific cloud-owner to be imported
+# to the same cloud-region in a instance with its own data model and existing
+# dependent objects. This script maps predefined objects and relationsships
+# beteen the two instances. An archive is generated and manually
+# copied to the target instance. A second script, vmValidateCloudRegions.sh,
+# is run on the target instance that applies validations and replaces
+# values needed in the generated scripss.
+# generated files. The script takes 2 arguments
+
+# usage: $0 <cloud-owner> <target-basepath> <target-version>
+# <cloud-owner> is the cloud-region-owner
+# <target-version> is the replacement to be applied to aai/$version in
+# resource links from the source instance.
+
+# scriptdata/addmanualdata/vm_export/payload is populated with the target
+# files, that include json/txt files applied by addManualData script and tx
+# files which represent validations to be applied before running addManualData.
+# The naming convention of json/txt files ensures the ordering used to correctly
+# apply dependent objects. The archive is generated in
+# scriptdata/addmanualdata/vm_export/archive
+
+addTemplates() {
+ jq -n --arg related vlan-tag --arg rlabel org.onap.relationships.inventory.Uses \
+--arg rlink /aai/v1x/cloud-infrastructure/cloud-regions/cloud-region/change-this-to-cloud-owner/change-this-to-cloud-region-id/vlan-ranges/vlan-range/change-this-to-vlan-range-id/vlan-tags/vlan-tag/change-this-to-vlan-tag-id \
+'{"related-to": "\($related)", "relationship-label": "\($rlabel)", "related-link": "\($rlink)"}' > $TARGETDIR/vlan-tag-relationship-template.json
+
+ jq -n --arg related lag-interface --arg rlabel org.onap.relationships.inventory.Uses \
+--arg rlink /aai/v1x/cloud-infrastructure/pservers/pserver/change-this-to-hostname/lag-interfaces/lag-interface/bond1 \
+'{"related-to": "\($related)", "relationship-label": "\($rlabel)", "related-link": "\($rlink)"}' > $TARGETDIR/lag-interface-relationship-template.json
+
+ jq -n --arg dsl "cloud-region('cloud-owner','change-this-to-cloud-owner')('cloud-region-id','change-this-to-cloud-region-id') > vlan-range > [ vlan-tag*('vlan-id-inner', change-this-to-inner), vlan-tag*('vlan-id-outer', change-this-to-outer) ]" \
+'{"dsl": "\($dsl)"}' > $TARGETDIR/vlantagquery-template.json
+}
+
+getFileSize() {
+ echo `wc -c < $1`
+}
+
+getCloudRegions() {
+ res="cloud-infrastructure/cloud-regions?cloud-owner="$1"&format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh "${res}" | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-cloud-region"
+ fi
+ if [ "$hasResults" = "No-cloud-region" ]; then
+ echo "No-cloud-region"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getTenants() {
+ res=""$1"/tenants?format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-tenant"
+ fi
+ if [ "$hasResults" = "No-tenant" ]; then
+ echo "No-tenant"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getVservers() {
+ res=""$1"/vservers?format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-vserver"
+ fi
+ if [ "$hasResults" = "No-vserver" ]; then
+ echo "No-vserver"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getLInterfaces() {
+ res=""$1"/l-interfaces?format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-l-interface"
+ fi
+ if [ "$hasResults" = "No-l-interface" ]; then
+ echo "No-l-interface"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getVlans() {
+ res=""$1"/vlans?format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-vlan"
+ fi
+ if [ "$hasResults" = "No-vlan" ]; then
+ echo "No-vlan"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getSriovVfs() {
+ res=""$1"/sriov-vfs?format=pathed"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-sriov-vfs"
+ fi
+ if [ "$hasResults" = "No-sriov-vfs" ]; then
+ echo "No-sriov-vfs"
+ else
+ echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-
+ fi
+}
+
+getTenant() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-tenant
+ echo "/"$1 > ${filepath}.txt
+ echo $cloudres | jq 'del(."resource-version")' > ${filepath}.json
+ echo $filepath
+}
+
+getVserver() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-1-vserver
+ echo "/"$1 > ${filepath}.txt
+ echo $cloudres | jq 'del(."resource-version")|del(."relationship-list")' > ${filepath}.json
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate-notexists
+ echo "/"$1 > ${validatepath}.tx
+ echo $filepath
+}
+
+getVfModule() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ heatStackId=`echo $cloudres | jq '."heat-stack-id"' | sed 's/\"//g'`
+ if [ "$heatStackId" = "null" ]
+ then
+ echo $heatStackId
+ else
+ heatStackIdUri=`echo $heatStackId | jq -sRr @uri`
+ uri=`echo ${heatStackIdUri%???}`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-1-instance-group-$vfmodulecnt
+ echo "/network/instance-groups/instance-group/$uri" > ${filepath}.txt
+ # no need to validate, since instance-group is created if not present
+ #validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate-vfmodule-$vfmodulecnt.tx
+ echo $cloudres | jq '{"heat-stack-id": ."heat-stack-id", "vf-module-name": ."vf-module-name"} | .["id"] = ."heat-stack-id" | .["instance-group-name"] = ."vf-module-name" | del(."heat-stack-id", ."vf-module-name") | .+ {"instance-group-type": "HEAT-STACK"}' > ${filepath}.json
+ echo $uri
+ fi
+}
+
+getVserverRelatedTo() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."relationship-list"'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-related-vf-module-or-pserver"
+ fi
+ if [ "$hasResults" = "No-related-vf-module-or-pserver" ]; then
+ echo "No-related-vf-module-or-pserver"
+ else
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate.tx
+ echo $cloudres | jq '[ ."relationship-list".relationship[] | select(."related-to" | contains("pserver")) ]' > ${validatepath}
+ sz=`getFileSize $validatepath`
+ pservercnt=0
+ if [ $sz = "3" ]; then
+ rm ${validatepath}
+ else
+ PSERVERS=`cat ${validatepath} | jq '.[]|."related-link"'|sed -e 's/\"//g' | cut -d"/" -f4-`
+ rm ${validatepath}
+ for pserver in ${PSERVERS}
+ do
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate-pserver-$pservercnt-exists.tx
+ echo $pserver > $validatepath
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-0-vserver-related-to-pserver-$pservercnt
+ #echo $cloudres | jq '."relationship-list".relationship[] | select(."related-to" | contains("pserver"))' > ${filepath}.json
+ echo $cloudres | jq '."relationship-list".relationship[] | select(."related-to" | contains("pserver"))' | jq 'del(."relationship-data")' | jq 'del(."related-to-property")' > ${filepath}.json
+ echo "/"$1/relationship-list/relationship > ${filepath}.txt
+ pservercnt=$(expr "$pservercnt" + 1)
+ done
+ fi
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate.tx
+ echo $cloudres | jq '[ ."relationship-list".relationship[] | select(."related-to" | contains("vf-module")) ]' > ${validatepath}
+ sz=`getFileSize ${validatepath}`
+ if [ $sz = "3" ]; then
+ rm ${validatepath}
+ else
+ VFMODULES=`cat ${validatepath} | jq '.[]|."related-link"'|sed -e 's/\"//g' | cut -d"/" -f4-`
+ vfmodulecnt=0
+ rm ${validatepath}
+ for vfmodule in ${VFMODULES}
+ do
+ heatId=`getVfModule $vfmodule`
+ # add instance-group and keep pserver relationships
+ if [ `expr $pservercnt` -ne 0 ]; then
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-0-vserver-related-to-instance-group
+ echo $cloudres | jq '."relationship-list".relationship |= .+ [{ "related-to": "instance-group", "relationship-label": "org.onap.relationships.inventory.MemberOf", "related-link": "/aai/v1x/network/instance-groups/instance-group/change-this-instance-group-id" }]' | jq '."relationship-list".relationship[] | select(."related-to" | contains("instance-group"))' | sed "s#change-this-instance-group-id#$heatId#" > ${filepath}.json
+echo $cloudres | jq '."relationship-list".relationship |= .+ [{ "related-to": "instance-group", "relationship-label": "org.onap.relationships.inventory.MemberOf", "related-link": "/aai/v1x/network/instance-groups/instance-group/change-this-instance-group-id" }]' | jq '."relationship-list".relationship[] | select(."related-to" | contains("instance-group"))'
+ echo "/"$1/relationship-list/relationship > ${filepath}.txt
+ vfmodulecnt=$(expr "$vfmodulecnt" + 1)
+ fi
+ done
+ fi
+ echo $filepath
+ fi
+}
+
+getLInterface() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-1-l-interface
+ echo "/"$1 > ${filepath}.txt
+ echo $cloudres | jq 'del(."resource-version")|del(."relationship-list")' > ${filepath}.json
+ echo "/"$1 > ${filepath}.txt
+ echo $cloudres | jq 'del(."resource-version")|del(."relationship-list")' > ${filepath}.json
+ echo $filepath
+}
+
+getVlan() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-0-$vlancnt-vlan-validate-vlantag.tx
+ echo $cloudres | jq 'del(."resource-version")|del(."relationship-list")' > ${filepath}
+ relpath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-0-$vlancnt-vlantag-related-to
+ echo "$2/relationship-list/relationship" > ${relpath}.txt
+ # payload
+ cloudreg=`cat $TARGETDIR/$regioncnt-cloud-region.validate.exists.tx`
+ owner=`echo $cloudreg | cut -f 5 -d "/"`
+ cid=`echo $cloudreg | cut -f 6 -d "/"`
+ cat $TEMPLATEDIR/vlan-tag-relationship-template.json | sed -e "s/change-this-path-element/$targetVersion/" -e "s/change-this-to-cloud-owner/$owner/" -e "s/change-this-to-cloud-region-id/$cid/" > ${relpath}.json
+ echo $filepath
+}
+
+getSriovVf() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-$sriovvfcnt-1-sriov-vf
+ echo "/"$1 > ${filepath}.txt
+ echo $cloudres | jq 'del(."resource-version")|del(."relationship-list")' > ${filepath}.json
+ echo $filepath
+}
+
+getLagInterfaceRelatedTo() {
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-0-laginterface-related-to
+ pserverpath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-vserver-validate-pserver-0-exists.tx
+ if [ -s $pserverpath ];
+ then
+ server=`cat $pserverpath`
+ echo "$1/relationship-list/relationship" > ${filepath}.txt
+ hostname=`echo $server | cut -f4 -d"/"`
+ cat $TEMPLATEDIR/lag-interface-relationship-template.json | sed -e "s/change-this-path-element/$targetVersion/" -e "s/change-this-to-hostname/$hostname/" > ${filepath}.json
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-laginterface-validate-exists
+ echo "/cloud-infrastructure/pservers/pserver/$hostname/lag-interfaces/lag-interface/bond1" > ${validatepath}.tx
+ fi
+}
+
+getSriovVfRelatedTo() {
+ res=""$1"?depth=0"
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."relationship-list"'`
+ if [ "$hasResults" = null ]; then
+ hasResults="No-related-to-sriov-pf"
+ fi
+ if [ "$hasResults" = "No-related-to-sriov-pf" ]; then
+ echo "No-related-to-sriov-pf"
+ else
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-$sriovvfcnt-sriovvf-validate-sriov-pf.tx
+ #echo "getSrioVfRelatedTo:" $validatepath $res >> /tmp/test.out
+ #echo "getSrioVfRelatedTo:" $validatepath $cloudres >> /tmp/test.out
+ echo $cloudres | jq '[ ."relationship-list".relationship[] | select(."related-to" | contains("sriov-pf")) ]' > ${validatepath}
+ sz=`getFileSize ${validatepath}`
+ sriovpfcnt=0
+ if [ $sz = "3" ]; then
+ rm ${validatepath}
+ else
+ SRIOVPFS=`cat ${validatepath} | jq '.[]|."related-link"'|sed -e 's/\"//g' | cut -d"/" -f4-`
+ rm ${validatepath}
+ for sriovpf in ${SRIOVPFS}
+ do
+ validatepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-$sriovvfcnt-sriovvf-validate-sriov-pf-$sriovpfcnt.tx
+ echo $sriovpf > $validatepath
+ #echo "getSrioVfRelatedTo:" $validatepath $sriovpf >> /tmp/test.out
+ filepath=$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-$linterfacecnt-$sriovvfcnt-0-sriovvf-related-to-sriov-pf-$sriovpfcnt
+ echo $cloudres | jq '."relationship-list".relationship[] | select(."related-to" | contains("sriov-pf"))' | jq 'del(."relationship-label")' | jq 'del(."relationship-data")' > ${filepath}.json
+ echo "/"$1/relationship-list/relationship > ${filepath}.txt
+ #echo "getSrioVfRelatedTo:" $filepath $cloudres >> /tmp/test.out
+ sriovpfcnt=$(expr "$sriovpfcnt" + 1)
+ done
+ fi
+ echo $filepath
+ fi
+}
+
+addValidateCloudRegion() {
+ filepath=$TARGETDIR/$regioncnt-cloud-region
+ echo "/"$1 > ${filepath}.validate.exists.tx
+}
+
+addValidateVserver() {
+ filepath=$TARGETDIR/$regioncnt-cloud-region
+ echo "/"$1 > ${filepath}.validate.exists.tx
+}
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+. /etc/profile.d/aai.sh
+
+PROJECT_HOME=/opt/app/aai-resources
+PROGNAME=$(basename $0)
+
+TS=$(date "+%Y_%m_%d_%H_%M_%S")
+
+CHECK_USER="aaiadmin"
+userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+if [ "${userid}" != $CHECK_USER ]; then
+ echo "You must be $CHECK_USER to run $0. The id used $userid."
+ exit 1
+fi
+TARGETDIR=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export/payload
+TEMPLATEDIR=$TARGETDIR
+mkdir -p $TARGETDIR
+rm -f $TARGETDIR/*
+
+if [ "$#" -ne 3 ]; then
+ echo "usage: $0 <cloud-owner> <target-basepath> <target-verson>"
+ exit 1
+fi
+
+addTemplates
+
+targetVersion="$2\/$3"
+
+echo "${TS}, getting vms and interfaces for cloud-region-owner: $1 with targetVersion $2/$3"
+regioncnt=0
+tenantcnt=0
+vservercnt=0
+linterfacecnt=0
+vlancnt=0
+sriovvfcnt=0
+totaltenants=0
+totalvms=0
+totalinterfaces=0
+totalvlans=0
+totalsriovvfs=0
+
+missingvms=0
+missinginterfaces=0
+missingvlans=0
+missingsriovvfs=0
+
+
+
+CLOUDS=`getCloudRegions $1`
+for cloud in ${CLOUDS}
+do
+ if [ $cloud = "No-cloud-region" ]; then
+ echo "No cloud-region found for owner " $1
+ else
+ addValidateCloudRegion $cloud
+ TENANTS=`getTenants $cloud`
+ for tenant in ${TENANTS}
+ do
+ if [ $tenant = "No-tenant" ]; then
+ echo "No tenant found for cloud-region " $cloud
+ else
+ #echo "Process tenant " $tenant
+ add=`getTenant $tenant`
+ #echo "adding tenant: " $add
+ VSERVERS=`getVservers $tenant`
+ for vserver in ${VSERVERS}
+ do
+ if [ $vserver = "No-vserver" ]; then
+ #echo "No vserver found for tenant " $tenant
+ missingvms=$(expr "$missingvms" + 1)
+ else
+ #echo "Process vserver " $vserver
+ add=`getVserver $vserver`
+ #echo "adding vserver: " $add
+ add=`getVserverRelatedTo $vserver`
+ #echo "adding vserver: related-to " $add
+ LINTERFACES=`getLInterfaces $vserver`
+ linterfacecnt=0
+ for linterface in ${LINTERFACES}
+ do
+ if [ $linterface = "No-l-interface" ]; then
+ #echo "No l-interface found for vserver " $vserver
+ missinginterfaces=$(expr "$missinginterfaces" + 1)
+ else
+ #echo "Process l-interface " $linterface
+ add=`getLInterface $linterface`
+ #echo "adding l-interface: " $add
+ VLANS=`getVlans $linterface`
+ for vlan in ${VLANS}
+ do
+ if [ $vlan = "No-vlan" ]; then
+ #echo "No vlan found for l-interface " $linterface
+ missingvlans=$(expr "$missingvlans" + 1)
+ else
+ #echo "Process vlan " $vlan
+ add=`getVlan $vlan $linterface`
+ #echo "adding vlan: " $add
+ vlancnt=$(expr "$vlancnt" + 1)
+ totalvlans=$(expr "$totalvlans" + 1)
+ fi
+ done
+ SRIOVVFS=`getSriovVfs $linterface`
+ for sriovvf in ${SRIOVVFS}
+ do
+ if [ $sriovvf = "No-sriov-vfs" ]; then
+ #echo "No sriov-vf found for l-interface " $linterface
+ # need to add relationship for pserver/lag-interface bond1
+ getLagInterfaceRelatedTo $linterface
+ missingsriovvfs=$(expr "$missingsriovvfs" + 1)
+ else
+ #echo "Processing l-interface" $linterface >> /tmp/test.out
+ #echo "Processing with sriov-vf" $sriovvf >> /tmp/test.out
+ add=`getSriovVf $sriovvf`
+ #echo "adding sriovvf: " $add
+ add=`getSriovVfRelatedTo $sriovvf`
+ #echo "adding sriovvf: related-to " $add
+ sriovvfcnt=$(expr "$sriovvfcnt" + 1)
+ totalsriovvfs=$(expr "$totalsriovvfs" + 1)
+ fi
+ done
+ vlancnt=0
+ sriovvfcnt=0
+ linterfacecnt=$(expr "$linterfacecnt" + 1)
+ totalinterfaces=$(expr "$totalinterfaces" + 1)
+ fi
+ done
+ linterfacecnt=0
+ # check that vserver related-to is present
+ if [ -e "$TARGETDIR/$regioncnt-$tenantcnt-$vservercnt-0-vserver-related-to-instance-group.json" ]; then
+ vservercnt=$(expr "$vservercnt" + 1)
+ totalvms=$(expr "$totalvms" + 1)
+ else
+ rm $TARGETDIR/$regioncnt-$tenantcnt-$vservercnt*
+ echo "no related vf-module, skip export for $vserver"
+ fi
+ fi
+ done
+ vservercnt=0
+ tenantcnt=$(expr "$tenantcnt" + 1)
+ totaltenants=$(expr "$totaltenants" + 1)
+ fi
+ done
+ tenantcnt=0
+ regioncnt=$(expr "$regioncnt" + 1)
+ fi
+done
+sed -i "s/aai\/v1./$targetVersion/g" $TARGETDIR/*related-to*.json
+echo "Total cloud-regions to process " $regioncnt
+echo "Total tenants to add " $totaltenants
+echo "Total vms to add " $totalvms
+#echo "Total interfaces to add " $totalinterfaces
+#echo "Total vlans to add " $totalvlans
+#echo "Total sriovvfs to add " $totalsriovvfs
+
+TS=$(date "+%Y_%m_%d_%H_%M_%S")
+ARCHIVEDIR=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export/archive
+if [ ! -d ${ARCHIVEDIR} ]
+then
+ mkdir -p ${ARCHIVEDIR}
+ chown aaiadmin:aaiadmin ${ARCHIVEDIR}
+ chmod u+w ${ARCHIVEDIR}
+fi
+cd ${TARGETDIR}
+tar c * -f ${ARCHIVEDIR}/vmExportArchive_${TS}.tar --exclude=payload
+if [ $? -ne 0 ]
+then
+ echo " Unable to tar ${TARGETDIR}"
+ exit 1
+fi
+cd ${ARCHIVEDIR}
+gzip ${ARCHIVEDIR}/vmExportArchive_${TS}.tar
+
+if [ $? -ne 0 ]
+then
+ echo " Unable to gzip ${ARCHIVE_DIRECTORY}/vmExportArchive_${TS}.tar"
+ exit 1
+fi
+echo "Completed successfully: ${ARCHIVE_DIRECTORY}/vmExportArchive_${TS}.tar"
+exit 0 \ No newline at end of file
diff --git a/aai-resources/src/main/scripts/vmUpdateExport.sh b/aai-resources/src/main/scripts/vmUpdateExport.sh
new file mode 100644
index 0000000..f492d2c
--- /dev/null
+++ b/aai-resources/src/main/scripts/vmUpdateExport.sh
@@ -0,0 +1,75 @@
+#!/bin/ksh
+#
+###
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright (C) 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=========================================================
+###
+
+#
+# vmUpdateExport.sh -- This tool updates the files generated in A&AI to
+# match what is expected in narad
+# The script takes no arguments
+
+addTemplates() {
+ jq -n --arg dsl "pserver('hostname','change-this-to-hostname') > p-interface > [ sriov-pf* ]" \
+'{"dsl": "\($dsl)"}' > sriovpfquery-template.json
+}
+
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+. /etc/profile.d/aai.sh
+
+PROJECT_HOME=/opt/app/aai-resources
+PROGNAME=$(basename $0)
+
+CHECK_USER="aaiadmin"
+userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+if [ "${userid}" != $CHECK_USER ]; then
+ echo "You must be $CHECK_USER to run $0. The id used $userid."
+ exit 1
+fi
+VMEXPORTDIR=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export
+cd $VMEXPORTDIR
+addTemplates
+URIS=`cat *vserver-validate-pserver*tx | sort -u`
+for uri in $URIS
+do
+ hostname=`echo $uri | cut -d "/" -f 4`
+ shortname=`echo $hostname | cut -d "." -f1`
+ sed -i -e "s#relationship-value\": \"$hostname#relationship-value\" : \"$shortname#" *json
+ sed -i -e "s#property-value\": \"$hostname#property-value\" : \"$shortname#" *json
+ sed -i -e "s#pserver/$hostname#pserver/$shortname#" *json
+ sed -i -e "s#pserver/$hostname#pserver/$shortname#" *tx
+ cat sriovpfquery-template.json | sed -e "s/change-this-to-hostname/$shortname/" > sriovf.query.$shortname.json
+ res=`$PROJECT_HOME/scripts/putTool.sh "/dsl?format=pathed" sriovf.query.$shortname.json -display | sed '1d;$d'`
+ echo $res | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4- > sriovf.result.$shortname
+done
+txfiles=`ls *sriovvf-validate-sriov-pf-*tx`
+for txfile in $txfiles
+do
+ uri=`cat $txfile`
+ hostname=`echo $uri | cut -d "/" -f 4`
+ pfPciId=`echo $uri | cut -d "/" -f 10`
+ interfacename=`echo $uri | cut -d "/" -f 7`
+ newuri=`grep $pfPciId sriovf.result.$hostname`
+ #echo "old uri " + $uri
+ #echo "new uri " + $newuri
+ sed -i -e "s#$uri#$newuri#" *sriovvf-related-to-sriov-pf*.json
+ sed -i -e "s#$uri#$newuri#" *sriovvf-validate-sriov-pf*.tx
+done \ No newline at end of file
diff --git a/aai-resources/src/main/scripts/vmValidateCloudRegions.sh b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh
new file mode 100644
index 0000000..a8189e3
--- /dev/null
+++ b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh
@@ -0,0 +1,328 @@
+#!/bin/ksh
+
+###
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright (C) 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=========================================================
+###
+
+# this script now requires a release parameter.
+# the tool finds and sorts *.txt files within the
+# resources/etc/scriptdata/addmanualdata/$release directory containing
+# one resource to be added to the graph. The directory contains a second
+# file with the same name, but the extension is .json. This json file
+# is passed to the PutTool as the payload. The parameters passed to the
+# PutTool will have 412 failures ignored. After calling the PutTool, the
+# GetTool is called to include the object put into the graph.
+# this script is run at every installation, logging the manual data applied.
+
+# Returns 0 if the specified string contains the specified substring,
+# otherwise returns 1.
+contains() {
+ string="$1"
+ substring="$2"
+ if test "${string#*$substring}" != "$string"
+ then
+ return 0 # $substring is in $string
+ else
+ return 1 # $substring is not in $string
+ fi
+}
+
+updateRenames () {
+ echo $1 >> $PAYLOADDIR/rename.txt
+}
+
+renamefiles() {
+ FILESTORENAME=`ls $PAYLOADDIR/$1*$2`
+ for f in $FILESTORENAME
+ do
+ mv $f $f.bak
+ done
+
+}
+
+. /etc/profile.d/aai.sh
+PROJECT_HOME=/opt/app/aai-resources
+
+PROGNAME=$(basename $0)
+OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d)
+#OUTFILE=/c/temp/${PROGNAME}.log.$(date +\%Y-\%m-\%d)
+
+TS=$(date "+%Y-%m-%d %H:%M:%S")
+
+CHECK_USER="aaiadmin"
+userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+if [ "${userid}" != $CHECK_USER ]; then
+ echo "You must be $CHECK_USER to run $0. The id used $userid."
+ exit 1
+fi
+
+error_exit () {
+ echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2 in $3" 1>&2
+ echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2 in $3" >> $OUTFILE
+# exit ${2:-"1"}
+}
+
+notfound="not-found"
+found="found"
+
+getCloudRegion() {
+ res=$1?depth=0
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."cloud-owner"'`
+ if [ "$hasResults" = null ]; then
+ echo $notfound
+ else
+ echo $found
+ fi
+}
+
+getVserver() {
+ res=$1?depth=0
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."vserver-id"'`
+ if [ "$hasResults" = null ]; then
+ echo $notfound
+ else
+ echo $found
+ fi
+}
+
+getPserver() {
+ res=$1?depth=0
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."hostname"'`
+ if [ "$hasResults" = null ]; then
+ echo $notfound
+ else
+ echo $found
+ fi
+}
+
+getSriovPf() {
+ res=$1?depth=0
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."pf-pci-id"'`
+ if [ "$hasResults" = null ]; then
+ echo $notfound
+ else
+ echo $found
+ fi
+}
+
+getLagInterface() {
+ res=$1?depth=0
+ cloudres=`$PROJECT_HOME/scripts/getTool.sh $res | sed '1d;$d'`
+ hasResults=`echo $cloudres | jq '."interface-name"'`
+ if [ "$hasResults" = null ]; then
+ echo $notfound
+ else
+ echo $found
+ fi
+}
+
+getVlanTag() {
+ vlanindex=`echo $1 | cut -f 10 -d "/" | cut -f 1-6 -d "-"`
+ cloudindex=`echo $vlanindex | cut -f 1 -d "-"`
+ cloudregion=`cat $PAYLOADDIR/$cloudindex-cloud-region.validate.exists.tx`
+ cowner=`echo $cloudregion | cut -f 5 -d "/"`
+ cid=`echo $cloudregion | cut -f 6 -d "/"`
+ inner=`cat $1 | jq '."vlan-id-inner"' | sed 's/\"//g'`
+ outer=`cat $1 | jq '."vlan-id-outer"' | sed 's/\"//g'`
+ cat $TEMPLATEDIR/vlantagquery-template.json | sed -e "s/change-this-to-cloud-owner/$cowner/" -e "s/change-this-to-cloud-region-id/$cid/" -e "s/change-this-to-inner/$inner/" -e "s/change-this-to-outer/$outer/" > $PAYLOADDIR/$vlanindex-vlan-validate-vlantag.json
+ $PROJECT_HOME/scripts/putTool.sh "/dsl?format=pathed" $PAYLOADDIR/$vlanindex-vlan-validate-vlantag.json -display > $PAYLOADDIR/$vlanindex-vlan-validate-vlantag-result.json 2>&1
+ cloudres=`cat $PAYLOADDIR/$vlanindex-vlan-validate-vlantag-result.json | sed '1,4d;$d'`
+ hasResults=`echo $cloudres | jq '.results'`
+ if [ "$hasResults" = null ]; then
+ hasResults=$notfound
+ fi
+ if [ "$hasResoults" = $notfound ]; then
+ echo $notfound
+ else
+ len=`echo $cloudres | jq '.results | length'`
+ if [ $len -eq 0 ];
+ then
+ echo "vlan-tag-not-found"
+ elif [ $len -gt 1 ];
+ then
+ echo "multiple-vlan-tag-found"
+ else
+ vlantag=`echo $cloudres | jq '.results|.[]|."resource-link"' | sed -e 's/\"//g' | cut -d"/" -f4-`
+ rangeId=`echo $vlantag| cut -f 8 -d "/"`
+ tagId=`echo $vlantag | cut -f 11 -d "/"`
+ sed -i -e "s/change-this-to-vlan-range-id/$rangeId/" -e "s/change-this-to-vlan-tag-id/$tagId/" $PAYLOADDIR/$vlanindex-vlantag-related-to.json
+ echo $found
+ fi
+ fi
+
+}
+
+PAYLOADDIR=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export
+TEMPLATEDIR=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/vm_export
+COMMAND=`find $PAYLOADDIR -name "*cloud-region.validate.exists.tx" -print | sort -f`
+
+skipValidations=$1
+if [ -z $skipValidations ]; then
+ skipValidations="1"
+fi
+
+validatecnt=0
+validcnt=0
+
+echo "${TS}, starting validations"
+
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1 -d "-"`
+ while IFS=\n read -r i
+ do
+ cloudregion=`getCloudRegion $i`
+ if [[ $cloudregion == $found ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ else
+ echo "not importing vms under region $i"
+ renamefiles "$cloudindex" "txt"
+ renamefiles "$cloudindex" "tx"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+ done < $filepath
+done
+
+skipvalidate=false
+contains $skipValidations "vserver-validate-notexists"
+if [ $? -eq 0 ] ; then
+ skipvalidate=true
+fi
+
+COMMAND=`find $PAYLOADDIR -name "*vserver-validate-notexists.tx" -print | sort -f`
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1-3 -d "-"`
+ while IFS=\n read -r i
+ do
+ vserver=`getVserver $i`
+ if [[ $vserver == $notfound || $skipvalidate = true ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ else
+ echo "vm exists, $i not importing vm"
+ updateRenames "$cloudindex"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+ done < $filepath
+done
+
+COMMAND=`find $PAYLOADDIR -name "*vserver-validate-pserver-*-exists.tx" -print | sort -f`
+
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1-3 -d "-"`
+ while IFS=\n read -r i
+ do
+ pserver=`getPserver $i`
+ if [[ $pserver == $found ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ else
+ echo "missing pserver, $i, not importing related vms"
+ updateRenames "$cloudindex"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+ done < $filepath
+done
+
+COMMAND=`find $PAYLOADDIR -name "*sriovvf-validate-sriov-pf-*.tx" -print | sort -f`
+
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1-3 -d "-"`
+ while IFS=\n read -r i
+ do
+ pserver=`getSriovPf $i`
+ if [[ $pserver == $found ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ else
+ echo "missing sriov-pf, $i, not importing related vms"
+ updateRenames "$cloudindex"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+ done < $filepath
+done
+
+COMMAND=`find $PAYLOADDIR -name "*laginterface-validate-exists.tx" -print | sort -f`
+
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1-3 -d "-"`
+ while IFS=\n read -r i
+ do
+ laginterface=`getLagInterface $i`
+ if [[ $laginterface == $found ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ else
+ echo "missing lag-interface, $i, not importing related vms"
+ updateRenames "$cloudindex"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+ done < $filepath
+done
+
+COMMAND=`find $PAYLOADDIR -name "*vlan-validate-vlantag.tx" -print | sort -f`
+
+for filepath in ${COMMAND}
+do
+ cloudindex=`echo ${filepath} | cut -f 10 -d "/" | cut -f 1-3 -d "-"`
+ vlantag=`getVlanTag ${filepath}`
+ if [[ $vlantag == $found ]]
+ then
+ validcnt=$(expr $validcnt + 1)
+ elif [[ $vlantag == "vlan-tag-not-found" ]]
+ then
+ echo "no matching vlan-tag, $filepath, not importing related vms"
+ updateRenames "$cloudindex"
+ elif [[ $vlantag == "multiple-vlan-tag-found" ]]
+ then
+ echo "multipe vlan-tag matches, $filepath, not importing related vms"
+ updateRenames "$cloudindex"
+ else
+ echo "missing vlan-tag, $filepath, not importing related vms"
+ updateRenames "$cloudindex"
+ fi
+ validatecnt=$(expr $validatecnt + 1)
+done
+
+if [ -s $PAYLOADDIR/rename.txt ];
+then
+ cat $PAYLOADDIR/rename.txt | sed 's/^$//' | sort -u > $PAYLOADDIR/renamed.txt
+
+ while IFS=\n read -r i
+ do
+ renamefiles $i "txt"
+ renamefiles $i "tx"
+ done < "$PAYLOADDIR/renamed.txt"
+ rm $PAYLOADDIR/rename*
+fi
+TS=$(date "+%Y-%m-%d %H:%M:%S")
+echo "${TS}, validations completed"
+echo "Total validations done " $validatecnt
+echo "Total validations passed " $validcnt
+
+exit 0
diff --git a/aai-resources/src/test/java/org/onap/aai/AAISetup.java b/aai-resources/src/test/java/org/onap/aai/AAISetup.java
index acef23b..9a12007 100644
--- a/aai-resources/src/test/java/org/onap/aai/AAISetup.java
+++ b/aai-resources/src/test/java/org/onap/aai/AAISetup.java
@@ -19,38 +19,32 @@
*/
package org.onap.aai;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
import org.apache.commons.io.IOUtils;
import org.junit.BeforeClass;
-import org.onap.aai.config.ConfigConfiguration;
-import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.config.IntrospectionConfig;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.onap.aai.config.*;
+import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.logging.LoggingContext;
+import org.onap.aai.introspection.MoxyLoader;
import org.onap.aai.nodes.NodeIngestor;
-import org.onap.aai.config.RestBeanConfig;
import org.onap.aai.rest.db.HttpEntry;
-import org.onap.aai.setup.SchemaLocationsBean;
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.onap.aai.setup.AAIConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.SchemaVersions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
-import org.onap.aai.introspection.MoxyLoader;
-
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.onap.aai.edges.EdgeIngestor;
-import org.onap.aai.setup.AAIConfigTranslator;
-import org.onap.aai.serialization.db.EdgeSerializer;
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 = {
ConfigConfiguration.class,
AAIConfigTranslator.class,
@@ -58,7 +52,8 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
EdgeIngestor.class,
EdgeSerializer.class,
SpringContextAware.class,
- IntrospectionConfig.class,
+ IntrospectionConfig.class,
+ XmlFormatTransformerConfiguration.class,
RestBeanConfig.class
})
@TestPropertySource(properties = {
@@ -95,7 +90,6 @@ public abstract class AAISetup {
public static void setupBundleconfig() throws Exception {
System.setProperty("AJSC_HOME", "./");
System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
- LoggingContext.init();
}
public String getPayload(String filename) throws IOException {
diff --git a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
index 6b49b78..bd93f73 100644
--- a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
+++ b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
@@ -19,17 +19,12 @@
*/
package org.onap.aai;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import org.javatuples.Pair;
import org.mockito.Mockito;
import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
-import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.parsers.query.QueryParser;
import org.onap.aai.parsers.uri.URIToObject;
import org.onap.aai.rest.db.DBRequest;
@@ -37,6 +32,10 @@ import org.onap.aai.rest.db.HttpEntry;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.setup.SchemaVersion;
+import org.onap.aai.setup.SchemaVersions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.core.*;
import java.io.UnsupportedEncodingException;
@@ -51,7 +50,7 @@ import static org.mockito.Mockito.when;
public class HttpTestUtil extends RESTAPI {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(HttpTestUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(HttpTestUtil.class);
protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
@@ -100,7 +99,7 @@ public class HttpTestUtil extends RESTAPI {
schemaVersions = SpringContextAware.getBean(SchemaVersions.class);
}
- public Response doPut(String uri, String payload) throws AAIException {
+ public Response doPut(String uri, String payload) {
this.init();
Response response = null;
@@ -116,7 +115,7 @@ public class HttpTestUtil extends RESTAPI {
SchemaVersion version = null;
- if(arr != null && arr.length > 1){
+ if(arr.length > 1){
if(arr[0].matches("^v\\d+")){
version = new SchemaVersion(arr[0]);
uri = uri.replaceAll("^v\\d+", "");
@@ -128,10 +127,8 @@ public class HttpTestUtil extends RESTAPI {
}
Mockito.when(uriInfo.getPath()).thenReturn(uri);
- DBConnectionType type = DBConnectionType.REALTIME;
- //HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type);
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
Loader loader = resourceHttpEntry.getLoader();
dbEngine = resourceHttpEntry.getDbEngine();
@@ -210,7 +207,7 @@ public class HttpTestUtil extends RESTAPI {
SchemaVersion version = null;
- if(arr != null && arr.length > 1){
+ if(arr.length > 1){
if(arr[0].matches("^v\\d+")){
version = new SchemaVersion(arr[0]);
uri = uri.replaceAll("^v\\d+", "");
@@ -221,10 +218,8 @@ public class HttpTestUtil extends RESTAPI {
version = schemaVersions.getDefaultVersion();
}
- DBConnectionType type = DBConnectionType.REALTIME;
- // HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type);
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
Loader loader = resourceHttpEntry.getLoader();
dbEngine = resourceHttpEntry.getDbEngine();
@@ -293,7 +288,7 @@ public class HttpTestUtil extends RESTAPI {
SchemaVersion version = null;
- if(arr != null && arr.length > 1){
+ if(arr.length > 1){
if(arr[0].matches("^v\\d+")){
version = new SchemaVersion(arr[0]);
if(!uri.contains("relationship-list/relationship")){
@@ -307,10 +302,8 @@ public class HttpTestUtil extends RESTAPI {
}
Mockito.when(uriInfo.getPath()).thenReturn(uri);
- DBConnectionType type = DBConnectionType.REALTIME;
- // HttpEntry httpEntry = new HttpEntry(version, ModelType.MOXY, QueryStyle.TRAVERSAL, type);
HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalHttpEntry", HttpEntry.class);
- resourceHttpEntry.setHttpEntryProperties(version, type);
+ resourceHttpEntry.setHttpEntryProperties(version);
Loader loader = resourceHttpEntry.getLoader();
dbEngine = resourceHttpEntry.getDbEngine();
diff --git a/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java b/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java
index 53b162f..47dfdbe 100644
--- a/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java
@@ -21,16 +21,18 @@ package org.onap.aai;
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.Vertex;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphTransaction;
-
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.when;
public class IncreaseNodesToolTest extends AAISetup {
@@ -46,6 +48,9 @@ public class IncreaseNodesToolTest extends AAISetup {
@Mock
Vertex mockVertex;
+ @Captor
+ ArgumentCaptor<String> nodeTypeCapture;
+
@Mock
GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex, org.apache.tinkerpop.gremlin.structure.Vertex> graphTraversalVertex;
private IncreaseNodesTool increaseNodesTool;
@@ -61,13 +66,13 @@ public class IncreaseNodesToolTest extends AAISetup {
when(janusGraph.newTransaction()).thenReturn(janusGraphtransaction);
when(janusGraphtransaction.traversal()).thenReturn(graphTraversalSource);
- when(graphTraversalSource.addV()).thenReturn(graphTraversalVertex);
+ when(graphTraversalSource.addV(nodeTypeCapture.capture())).thenReturn(graphTraversalVertex);
when(graphTraversalVertex.next()).thenReturn(mockVertex);
increaseNodesTool.run(janusGraph,args);
Mockito.verify(janusGraph).newTransaction();
- Mockito.verify(graphTraversalSource,times(5)).addV();
+ Mockito.verify(graphTraversalSource,times(5)).addV(nodeTypeCapture.capture());
}
@Test
diff --git a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
index 8ec82ff..09bb7a5 100644
--- a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
+++ b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai;
-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 ResourcesTestConfiguration {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourcesTestConfiguration.class);
+ private static final Logger logger = LoggerFactory.getLogger(ResourcesTestConfiguration.class);
@Autowired
private Environment env;
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
index c755838..ff985a9 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java
@@ -26,7 +26,7 @@ import org.janusgraph.core.JanusGraphTransaction;
import org.junit.*;
import org.onap.aai.ResourcesApp;
import org.onap.aai.ResourcesTestConfiguration;
-import org.onap.aai.config.PropertyPasswordConfiguration;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.nodes.NodeIngestor;
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
index 6e98a39..5366802 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkAddConsumerTest.java
@@ -29,11 +29,11 @@ import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class BulkAddConsumerTest extends BulkProcessorTestAbstraction {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkAddConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(BulkAddConsumerTest.class.getName());
@Test
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
index 1d8702a..d2dff7d 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
@@ -33,13 +33,13 @@ import org.junit.Test;
import org.onap.aai.dbmap.AAIGraph;
import org.skyscreamer.jsonassert.JSONAssert;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletRequest;
public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkProcessConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(BulkProcessConsumerTest.class.getName());
private LegacyMoxyConsumer legacyMoxyConsumer;
@Test
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
index e735041..d5c112b 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
@@ -42,8 +42,8 @@ import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class BulkProcessorTestAbstraction extends AAISetup {
@@ -73,7 +73,7 @@ public abstract class BulkProcessorTestAbstraction extends AAISetup {
protected String uri;
private boolean initialized = false;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(BulkProcessorTestAbstraction.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(BulkProcessorTestAbstraction.class.getName());
@BeforeClass
public static void setupRest(){
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
index 0e1cbe4..af7d022 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java
@@ -24,7 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.aai.ResourcesApp;
import org.onap.aai.ResourcesTestConfiguration;
-import org.onap.aai.config.PropertyPasswordConfiguration;
+import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.onap.aai.config.SpringContextAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
index 3f50ba3..9d2a519 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.rest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -62,7 +62,7 @@ public class ExampleConsumerTest extends AAISetup {
private List<MediaType> outputMediaTypes;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName());
@BeforeClass
public static void setupRest(){
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
index 028f596..748b032 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
@@ -19,8 +19,10 @@
*/
package org.onap.aai.rest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.json.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -45,8 +47,7 @@ import javax.ws.rs.core.*;
import java.io.IOException;
import java.util.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.when;
@@ -77,7 +78,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
private boolean initialized = false;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName());
@BeforeClass
public static void setupRest(){
@@ -172,7 +173,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
@@ -194,7 +195,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
String pserverEntity = response.getEntity().toString();
@@ -220,7 +221,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
@@ -300,7 +301,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
assertNotNull("Response from the legacy moxy consumer returned null", response);
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals("Expected to return status created from the response",
@@ -320,8 +321,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
@@ -359,7 +359,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
int code = response.getStatus();
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
}
@@ -384,7 +384,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int code = response.getStatus();
assertNotNull("Response from the legacy moxy consumer returned null", response);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
response = legacyMoxyConsumer.updateRelationship(
payload,
@@ -398,7 +398,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
assertNotNull("Response from the legacy moxy consumer returned null", response);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
mockReq = new MockHttpServletRequest("GET", uri);
response = legacyMoxyConsumer.getLegacy(
"",
@@ -459,7 +459,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
int code = response.getStatus();
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
response = legacyMoxyConsumer.updateRelationship(
@@ -472,7 +472,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
code = response.getStatus();
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
mockReq = new MockHttpServletRequest("GET", uri);
@@ -504,7 +504,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
code = response.getStatus();
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
response = legacyMoxyConsumer.deleteRelationship(
@@ -560,7 +560,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
@@ -584,7 +584,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
assertNotNull("Response from the patch returned null", response);
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.OK.getStatusCode(), code);
}
@@ -625,7 +625,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
assertNotNull("Response from the legacy moxy consumer returned null", response);
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals("Expected to return status created from the response",
Response.Status.CREATED.getStatusCode(), response.getStatus());
@@ -676,7 +676,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
int code = response.getStatus();
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
}
@@ -827,7 +827,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
assertNotNull("Response from the legacy moxy consumer returned null", response);
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals("Expected to return status created from the response",
@@ -852,7 +852,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
@@ -890,7 +890,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
assertNotNull("Response from the legacy moxy consumer returned null", response);
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals("Expected to return status created from the response",
@@ -915,7 +915,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
@@ -983,9 +983,420 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int code = response.getStatus();
if(!VALID_HTTP_STATUS_CODES.contains(code)){
- System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
}
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus());
}
+
+ @Test
+ public void testGetWithSkipRelatedToParam() throws IOException, JSONException {
+ String pserverData = getResourcePayload("pserver1");
+ String vserverData = getResourcePayload("vserver1");
+
+ String hostname = "pserver-hostname-test01";
+ String cloudRegionId ="testAIC01";
+ String tenant ="tenant01";
+ String vserver ="vserver01";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname);
+ String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true", cloudRegionId);
+
+ // PUT the resources
+ putResourceWithQueryParam(pserverUri, pserverData);
+ putResourceWithQueryParam(vserverUri, vserverData);
+
+ String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname);
+ String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true",
+ cloudRegionId, tenant, vserver);
+
+ // === GET - related-to-property should not exist ===
+ // pserver
+ Response pserverResponse = getMockResponse(pserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver"));
+
+ // vserver
+ Response vserverResponse = getMockResponse(vserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver"));
+ // ===
+
+ // === Clean up (DELETE) ===
+ // vserver
+ String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ Response response = deleteServerObject(vserverMockRequestUri, deleteUri, "vserver");
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ // pserver
+ deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver");
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ public void testGetWithoutSkipRelatedToParam() throws IOException, JSONException {
+ String pserverData = getResourcePayload("pserver2");
+ String vserverData = getResourcePayload("vserver2");
+
+ String hostname = "pserver-hostname-test02";
+ String cloudRegionId ="testAIC02";
+ String tenant ="tenant02";
+ String vserver ="vserver02";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s", cloudRegionId);
+
+ // PUT the resources
+ doSetupResource(pserverUri, pserverData);
+ doSetupResource(vserverUri, vserverData);
+
+ String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+
+ // === GET - related-to-property should not exist ===
+ // pserver
+ Response pserverResponse = getMockResponse(pserverMockRequestUri);
+ assertFalse(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver"));
+
+ // vserver
+ Response vserverResponse = getMockResponse(vserverMockRequestUri);
+ assertFalse(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver"));
+ // ===
+
+ // === Clean up (DELETE) ===
+ // vserver
+ String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ Response response = deleteServerObject(vserverMockRequestUri, deleteUri, "vserver");
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ // pserver
+ deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver");
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ public void testGetWithSkipRelatedToParamAndFormatResource() throws IOException, JSONException {
+ String pserverData = getResourcePayload("pserver3");
+ String vserverData = getResourcePayload("vserver3");
+
+ String hostname = "pserver-hostname-test03";
+ String cloudRegionId ="testAIC03";
+ String tenant ="tenant03";
+ String vserver ="vserver03";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource", hostname);
+ String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true&format=resource", cloudRegionId);
+
+ // PUT the resources
+ putResourceWithQueryParam(pserverUri, pserverData);
+ putResourceWithQueryParam(vserverUri, vserverData);
+
+ String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource", hostname);
+ String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true&format=resource",
+ cloudRegionId, tenant, vserver);
+
+ // === GET - related-to-property should not exist ===
+ // pserver
+ Response pserverResponse = getMockResponse(pserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver"));
+
+ // vserver
+ Response vserverResponse = getMockResponse(vserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver"));
+ // ===
+
+ // === Clean up (DELETE) ===
+ // vserver
+ String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver");
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ // pserver
+ deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver");
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ }
+
+ @Test
+ public void testGetWithSkipRelatedToParamAndFormatResourceAndUrl() throws IOException, JSONException {
+ String pserverData = getResourcePayload("pserver4");
+ String vserverData = getResourcePayload("vserver4");
+
+ String hostname = "pserver-hostname-test04";
+ String cloudRegionId ="testAIC04";
+ String tenant ="tenant04";
+ String vserver ="vserver04";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource_and_url", hostname);
+ String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true&format=resource_and_url", cloudRegionId);
+
+ // PUT the resources
+ putResourceWithQueryParam(pserverUri, pserverData);
+ putResourceWithQueryParam(vserverUri, vserverData);
+
+ String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true&format=resource_and_url", hostname);
+ String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s?skip-related-to=true&format=resource_and_url",
+ cloudRegionId, tenant, vserver);
+
+ // === GET - related-to-property should not exist ===
+ // pserver
+ Response pserverResponse = getMockResponse(pserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver"));
+
+ // vserver
+ Response vserverResponse = getMockResponse(vserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver"));
+ // ===
+
+ // === Clean up (DELETE) ===
+ // vserver
+ String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver");
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ // pserver
+ deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver");
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ public void testGetVserversWithSkipRelatedToParam() throws IOException, JSONException {
+ String pserverData = getResourcePayload("pserver5");
+ String vserverData = getResourcePayload("vserver5");
+
+ String hostname = "pserver-hostname-test05";
+ String cloudRegionId ="testAIC05";
+ String tenant ="tenant05";
+ String vserver ="vserver05";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname);
+ String vserverUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s?skip-related-to=true", cloudRegionId);
+
+ // PUT the resources
+ putResourceWithQueryParam(pserverUri, pserverData);
+ putResourceWithQueryParam(vserverUri, vserverData);
+
+ String pserverMockRequestUri = String.format("cloud-infrastructure/pservers/pserver/%s?skip-related-to=true", hostname);
+ String vserverMockRequestUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers?vserver-selflink=somelink05&skip-related-to=true",
+ cloudRegionId, tenant, vserver);
+
+ // === GET - related-to-property should not exist ===
+ // pserver
+ Response pserverResponse = getMockResponse(pserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(pserverResponse, "pserver"));
+
+ // vserver
+ Response vserverResponse = getMockResponse(vserverMockRequestUri);
+ assertTrue(isRelatedToPropertiesFieldNullInResponse(vserverResponse, "vserver"));
+ // ===
+
+ // === Clean up (DELETE) ===
+ // vserver
+ String deleteUri = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ String vserverMockRequestUriNoFormat = String.format("cloud-infrastructure/cloud-regions/cloud-region/test-aic/%s/tenants/tenant/%s/vservers/vserver/%s",
+ cloudRegionId, tenant, vserver);
+ Response response = deleteServerObject(vserverMockRequestUriNoFormat, deleteUri, "vserver");
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+
+ // pserver
+ deleteUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = deleteServerObject(pserverMockRequestUri, deleteUri, "pserver");
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ }
+
+ private Response deleteServerObject(String mockUri, String deleteUri, String nodeType) throws IOException, JSONException {
+ Response response = getMockResponse(mockUri);
+ String serverEntity = response.getEntity().toString();
+ JSONObject serverJsonObject = new JSONObject(serverEntity);
+ boolean noResultsArray = false;
+ String resourceVersion = "";
+ try {
+ JSONArray resultsJsonArray = (JSONArray) serverJsonObject.get("results");
+ if (resultsJsonArray != null) {
+ JSONObject servers = (JSONObject) resultsJsonArray.get(0);
+ JSONObject server = (JSONObject) servers.get(nodeType);
+ resourceVersion = server.getString("resource-version");
+ }
+ } catch (Exception e) {
+ noResultsArray = true;
+ }
+ if (noResultsArray)
+ resourceVersion = serverJsonObject.getString("resource-version");
+ queryParameters.clear();
+ queryParameters.add("resource-version", resourceVersion);
+
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("DELETE", deleteUri);
+ Response deleteResponse = legacyMoxyConsumer.delete(
+ schemaVersions.getDefaultVersion().toString(),
+ deleteUri,
+ httpHeaders,
+ uriInfo,
+ resourceVersion,
+ mockReq
+ );
+ return deleteResponse;
+ }
+
+ private void putResourceWithQueryParam(String uri, String payload) {
+
+ String[] uriSplit = uri.split("\\?");
+ if (uriSplit[1] != null && !uriSplit[1].isEmpty()) {
+ String[] params;
+ if (!uriSplit[1].contains("&")) {
+ String param = uriSplit[1];
+ params = new String[]{param};
+ } else {
+ params = uriSplit[1].split("&");
+ }
+ for (String param : params) {
+ String[] splitParam = param.split("=");
+ String key = splitParam[0];
+ String value = splitParam[1];
+ uriInfo.getQueryParameters().add(key, value);
+ }
+ }
+ uri = uriSplit[0];
+
+ when(uriInfo.getPath()).thenReturn(uri);
+ when(uriInfo.getPath(false)).thenReturn(uri);
+
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri);
+ Response response = legacyMoxyConsumer.update(
+ payload,
+ schemaVersions.getDefaultVersion().toString(),
+ uri,
+ httpHeaders,
+ uriInfo,
+ mockReq
+ );
+
+ assertNotNull("Response from the legacy moxy consumer returned null", response);
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+
+ assertEquals("Expected to return status created from the response",
+ Response.Status.CREATED.getStatusCode(), response.getStatus());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+
+ private Response getMockResponse(String mockUri) throws IOException, JSONException {
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("GET", mockUri);
+ Response response = legacyMoxyConsumer.getLegacy(
+ "",
+ null,
+ null,
+ schemaVersions.getDefaultVersion().toString(),
+ mockUri,
+ "10000",
+ "false",
+ httpHeaders,
+ uriInfo,
+ mockReq
+ );
+ String responseEntity = response.getEntity().toString();
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+ return response;
+ }
+
+ private boolean isRelatedToPropertiesFieldNullInResponse(Response response, String nodeType) throws IOException, JSONException {
+ String responseEntity = response.getEntity().toString();
+ boolean noResultsArray = false;
+ JSONObject responseJsonObj = new JSONObject(responseEntity);
+ try {
+ JSONArray resultsJsonArray = (JSONArray) responseJsonObj.get("results");
+ if (resultsJsonArray != null) {
+ JSONObject servers = (JSONObject) resultsJsonArray.get(0);
+ JSONObject server = (JSONObject) servers.get(nodeType);
+ JSONObject relationshipList = (JSONObject) server.get("relationship-list");
+ if (relationshipList != null) {
+ JSONArray relationship = (JSONArray) relationshipList.get("relationship");
+ if (relationship != null) {
+ JSONObject relationshipObj = relationship.getJSONObject(0);
+ JSONArray relatedToProperty = (JSONArray) relationshipObj.get("related-to-property");
+ if (relatedToProperty != null)
+ return false;
+ }
+ }
+ }
+ } catch (Exception e) {
+ noResultsArray = true;
+ }
+
+ if (noResultsArray) {
+ try {
+ JSONObject relationshipList = (JSONObject) responseJsonObj.get("relationship-list");
+ if (relationshipList != null) {
+ JSONArray relationship = (JSONArray) relationshipList.get("relationship");
+ if (relationship != null) {
+ JSONObject relationshipObj = relationship.getJSONObject(0);
+ JSONArray relatedToProperty = (JSONArray) relationshipObj.get("related-to-property");
+ if (relatedToProperty != null)
+ return false;
+ }
+ }
+ } catch (JSONException je) {
+ logger.info("JSON Exception Error: " + je);
+ } catch (Exception e) {
+ logger.info("JSON Exception Error: " + e);
+ }
+ }
+ return true;
+ }
}
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
index 2edec7b..c6885c7 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.rest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.json.JSONException;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -65,7 +65,7 @@ public class URLFromVertexIdConsumerTest extends AAISetup {
private List<MediaType> outputMediaTypes;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName());
private boolean initialized = false;
@BeforeClass
public static void setupRest(){
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
index 8d3f5a8..e4e7340 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.rest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.json.JSONException;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -64,7 +64,7 @@ public class VertexIdConsumerTest extends AAISetup {
private List<MediaType> outputMediaTypes;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LegacyMoxyConsumerTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(LegacyMoxyConsumerTest.class.getName());
private boolean initialized = false;
@BeforeClass
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
index e317297..8c24fb4 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java
@@ -19,6 +19,8 @@
*/
package org.onap.aai.rest.bulk;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -33,6 +35,7 @@ import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.rest.BulkConsumer;
import org.onap.aai.rest.BulkProcessorTestAbstraction;
import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.context.TestPropertySource;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.Response;
@@ -44,9 +47,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
+@TestPropertySource(properties = {
+ "delta.events.enabled=true",
+})
public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstraction {
- private BulkSingleTransactionConsumer bulkSingleTransactionConsumer = new BulkSingleTransactionConsumer();
+ private BulkSingleTransactionConsumer bulkSingleTransactionConsumer = new BulkSingleTransactionConsumer("/aai");
@Rule
public TestName name = new TestName();
@@ -220,6 +226,8 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
assertThat("Response contains 204 status.",
response.getEntity().toString(),
containsString("\"response-status-code\":204"));
+
+
}
@Test
@@ -244,8 +252,10 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
.replaceAll("<methodName>", name.getMethodName());
Response response = executeRequest(payload);
+ System.out.println(response.getEntity().toString());
+
assertEquals("Request failed",
- Response.Status.BAD_REQUEST.getStatusCode(),
+ Response.Status.PRECONDITION_FAILED.getStatusCode(),
response.getStatus());
assertEquals("1 vertex exists after payload due to failure",
@@ -253,13 +263,17 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
AAIGraph.getInstance().getGraph().newTransaction().traversal().
V().has(AAIProperties.SOURCE_OF_TRUTH, sot).count().next());
+ assertThat("Response contains resource version msg for failed transaction.",
+ response.getEntity().toString(),
+ containsString("Precondition Failed:resource-version MISMATCH for delete of generic-vnf"));
+
assertThat("Response contains correct index of failed operation.",
response.getEntity().toString(),
- containsString("Operation 3 failed with status code (412) and msg"));
+ containsString("Operation 3"));
- assertThat("Response contains resource version msg for failed transaction.",
+ assertThat("Response contains correct status code.",
response.getEntity().toString(),
- containsString("Precondition Failed:resource-version MISMATCH for delete of generic-vnf"));
+ containsString("failed with status code (412"));
}
@@ -342,7 +356,81 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
}
+ @Test
+ public void putComplexWithRelToNonExistentPserverBetween() throws IOException {
+
+ String payload = getBulkPayload("single-transaction/put-complex-with-rel-to-non-existent").replaceAll("<methodName>", name.getMethodName());
+ Response response = executeRequest(payload);
+
+ assertEquals("Request success",
+ Response.Status.NOT_FOUND.getStatusCode(),
+ response.getStatus());
+ assertEquals("0 vertex from this test in graph",
+ Long.valueOf(0L),
+ AAIGraph.getInstance().getGraph().newTransaction().traversal().
+ V().has(AAIProperties.SOURCE_OF_TRUTH, sot).count().next());
+ assertEquals("Request fails with 404",
+ Response.Status.NOT_FOUND.getStatusCode(),
+ response.getStatus());
+
+ assertThat("Response contains correct index of failed operation.",
+ response.getEntity().toString(),
+ containsString("Operation 0"));
+
+ assertThat("Response contains correct status code.",
+ response.getEntity().toString(),
+ containsString("failed with status code (404"));
+
+ assertThat("Response contains correct msg.",
+ response.getEntity().toString(),
+ containsString("target node:Node of type pserver. Could not find"));
+ assertThat("Response contains correct Error Code.",
+ response.getEntity().toString(),
+ containsString("ERR.5.4.6129"));
+
+ }
+
+
+ @Test
+ public void deleteChildRecreateChildTest() throws IOException {
+ JsonArray requests = new JsonParser().parse(
+ getBulkPayload("single-transaction/delete-child-recreate-child").replaceAll("<methodName>", name.getMethodName()))
+ .getAsJsonObject().getAsJsonArray("array");
+ String payload = requests.get(0).toString();
+ Response response = executeRequest(payload);
+ System.out.println(response.getEntity().toString());
+ assertEquals("Request success",
+ Response.Status.CREATED.getStatusCode(),
+ response.getStatus());
+
+ payload = requests.get(1).toString();
+ response = executeRequest(payload);
+ System.out.println(response.getEntity().toString());
+ assertEquals("Request success",
+ Response.Status.CREATED.getStatusCode(),
+ response.getStatus());
+ }
+
+ @Test
+ public void deleteNodeRecreateNodeTest() throws IOException {
+ JsonArray requests = new JsonParser().parse(
+ getBulkPayload("single-transaction/delete-node-recreate-node").replaceAll("<methodName>", name.getMethodName()))
+ .getAsJsonObject().getAsJsonArray("array");
+ String payload = requests.get(0).toString();
+ Response response = executeRequest(payload);
+ System.out.println(response.getEntity().toString());
+ assertEquals("Request success",
+ Response.Status.CREATED.getStatusCode(),
+ response.getStatus());
+
+ payload = requests.get(1).toString();
+ response = executeRequest(payload);
+ System.out.println(response.getEntity().toString());
+ assertEquals("Request success",
+ Response.Status.CREATED.getStatusCode(),
+ response.getStatus());
+ }
protected Response executeRequest(String finalPayload) {
@@ -364,6 +452,6 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract
@Override
protected String getUri() {
- return "/aai/" + schemaVersions.getDefaultVersion().toString() + "/bulk-single-transaction-multi-operation";
+ return "/aai/" + schemaVersions.getDefaultVersion().toString() + "/bulk/single-transaction";
}
} \ No newline at end of file
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java
index c629ca7..cdd3a51 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.rest.retired;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Test;
import org.onap.aai.rest.AbstractSpringRestTest;
import org.springframework.http.HttpMethod;
@@ -33,7 +33,7 @@ import java.util.Map;
import static org.junit.Assert.assertEquals;
public class RetiredConsumerSpringTest extends AbstractSpringRestTest {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(RetiredConsumerSpringTest.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(RetiredConsumerSpringTest.class);
private Map<String, HttpStatus> httpStatusMap;
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
index aa60d94..9f55961 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
@@ -19,8 +19,8 @@
*/
package org.onap.aai.rest.util;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -60,7 +60,7 @@ public class EchoResponseTest extends AAISetup {
private List<MediaType> outputMediaTypes;
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(EchoResponseTest.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(EchoResponseTest.class.getName());
@Before
public void setup(){
diff --git a/aai-resources/src/test/resources/logback.xml b/aai-resources/src/test/resources/logback.xml
index 0258f1d..8f0e0d7 100644
--- a/aai-resources/src/test/resources/logback.xml
+++ b/aai-resources/src/test/resources/logback.xml
@@ -31,14 +31,30 @@
<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" />
+ <!-- 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|%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(%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">
@@ -65,71 +81,63 @@
<includeCallerData>true</includeCallerData>
<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>
+ <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">
<queueSize>1000</queueSize>
<includeCallerData>true</includeCallerData>
- <appender-ref ref="METRIC" />
+ <appender-ref ref="METRIC"/>
</appender>
<appender name="DEBUG"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${logDirectory}/rest/debug.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
- </fileNamePattern>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <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">
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <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>
<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>
+ <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-ref ref="ERROR"/>
</appender>
<appender name="AUDIT"
@@ -139,8 +147,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 +170,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,9 +191,10 @@
<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>
<appender name="dmaapAAIEventConsumerDebug"
@@ -200,8 +209,24 @@
<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"
@@ -216,8 +241,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 +255,50 @@
<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>
+ <!-- logback internals logging -->
+ <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.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.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.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 +307,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-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json
new file mode 100644
index 0000000..ca7decc
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-child-recreate-child.json
@@ -0,0 +1,46 @@
+{
+ "array": [
+ {
+ "operations": [
+ {
+ "action": "put",
+ "uri": "/network/pnfs/pnf/pnf-1",
+ "body": {
+ "pnf-name": "pnf-1",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "speed-value": "10",
+ "interface-name": "pint-a",
+ "speed-units": "Mbps",
+ "prov-status": "PROV",
+ "interface-name2": "0-0-2"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "operations": [
+ {
+ "action": "delete",
+ "uri": "/network/pnfs/pnf/pnf-1/p-interfaces/p-interface/pint-a?resource-version=38cf3090-6a0c-4e9d-8142-4332a7352846",
+ "body": {}
+ },
+ {
+ "action": "put",
+ "uri": "/network/pnfs/pnf/pnf-1/p-interfaces/p-interface/pint-a",
+ "body": {
+ "speed-value": "100",
+ "interface-name": "pint-a",
+ "speed-units": "Gbps",
+ "prov-status": "PREPROV",
+ "interface-name2": "0-0-22"
+ }
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json
new file mode 100644
index 0000000..c81547e
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/delete-node-recreate-node.json
@@ -0,0 +1,41 @@
+{
+ "array": [
+ {
+ "operations": [
+ {
+ "action": "put",
+ "uri": "/network/logical-links/logical-link/ll",
+ "body": {
+ "speed-value": "10",
+ "link-type": "INL",
+ "link-name": "ll",
+ "speed-units": "Mbps",
+ "prov-status": "PROV",
+ "routing-protocol": "802.3ah"
+ }
+ }
+ ]
+ },
+ {
+ "operations": [
+ {
+ "action": "delete",
+ "uri": "/network/logical-links/logical-link/ll?resource-version=38cf3090-6a0c-4e9d-8142-4332a7352846",
+ "body": {}
+ },
+ {
+ "action": "put",
+ "uri": "/network/logical-links/logical-link/ll",
+ "body": {
+ "speed-value": "100",
+ "link-type": "INL",
+ "link-name": "ll",
+ "speed-units": "Gbps",
+ "prov-status": "PREPROV",
+ "routing-protocol": "802.3ah"
+ }
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json
new file mode 100644
index 0000000..4c6d1b8
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-complex-with-rel-to-non-existent.json
@@ -0,0 +1,28 @@
+{
+ "operations": [
+ {
+ "action": "put",
+ "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>",
+ "body": {
+ "physical-location-id": "complex-<methodName>",
+ "data-center-code": "code",
+ "identity-url": "N/A",
+ "physical-location-type": "type",
+ "street1": "street",
+ "city": "city",
+ "state": "state",
+ "postal-code": "12345",
+ "country": "NONE",
+ "region": "Earth",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-<methodName>"
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
diff --git a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json
index 52c9599..6d4602b 100644
--- a/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json
+++ b/aai-resources/src/test/resources/payloads/bulk/single-transaction/put-pserver-complex-rel-between-del-existing-gvnf.json
@@ -2,7 +2,7 @@
"operations": [
{
"action": "put",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-<methodName>",
+ "uri": "aai/v15/cloud-infrastructure/pservers/pserver/pserver-<methodName>",
"body": {
"hostname": "pserver-<methodName>",
"fqdn": "pserver-<methodName>-fqdn"
@@ -10,7 +10,7 @@
},
{
"action": "put",
- "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>",
+ "uri": "/aai/v15/cloud-infrastructure/complexes/complex/complex-<methodName>",
"body": {
"physical-location-id": "complex-<methodName>",
"data-center-code": "code",
@@ -27,7 +27,7 @@
},
{
"action": "put",
- "uri": "/cloud-infrastructure/complexes/complex/complex-<methodName>/relationship-list/relationship",
+ "uri": "/aai/v15/cloud-infrastructure/complexes/complex/complex-<methodName>/relationship-list/relationship",
"body": {
"related-to": "pserver",
"related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-<methodName>"
@@ -36,7 +36,7 @@
},
{
"action": "delete",
- "uri": "/network/generic-vnfs/generic-vnf/gvnf-<methodName>?resource-version=0",
+ "uri": "/aai/v15/network/generic-vnfs/generic-vnf/gvnf-<methodName>?resource-version=0",
"body": {}
}
]
diff --git a/aai-resources/src/test/resources/payloads/extensions/cloud-region.json b/aai-resources/src/test/resources/payloads/extensions/cloud-region.json
new file mode 100644
index 0000000..993d3df
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/cloud-region.json
@@ -0,0 +1,27 @@
+{
+ "cloud-owner": "Sample-att-aic",
+ "cloud-region-id": "Sample-AAIAIC25",
+ "tenants": {
+ "tenant": [
+ {
+ "tenant-id" : "Sample-TenantId",
+ "tenant-name" : "Sample-TenantName"
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v12/cloud-infrastructure/complexes/complex/complex1",
+ "related-to": "complex",
+ "relationship-data": [
+ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "complex1"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/complex.json b/aai-resources/src/test/resources/payloads/extensions/complex.json
new file mode 100644
index 0000000..5bafe7e
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/complex.json
@@ -0,0 +1,9 @@
+{
+ "physical-location-id" : "complex1",
+ "physical-location-type" : "uug",
+ "street1" : "kDv5Ge6dr",
+ "city" : "KpEa5IjqY0u82",
+ "postal-code" : "6CRqacfEW2",
+ "country" : "P0ho",
+ "region" : "Sk2QevPYRBjT"
+}
diff --git a/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json b/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json
new file mode 100644
index 0000000..3465c66
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/generic-vnf.json
@@ -0,0 +1,28 @@
+{
+ "vnf-id": "Sample-Vnf-Id",
+ "vnf-name": "example-vnf-name-val-15051",
+ "vnf-name2": "example-vnf-name2-val-19349",
+ "vnf-type": "example-vnf-type-val-21675",
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "SampleVfModule1",
+ "vf-module-name": "example-vf-module-name-val-31932",
+ "heat-stack-id": "example-heat-stack-id-val-98980",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vnfc",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "Sample-VserverName1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/pserver.json b/aai-resources/src/test/resources/payloads/extensions/pserver.json
new file mode 100644
index 0000000..2f2a5f3
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/pserver.json
@@ -0,0 +1,4 @@
+{
+ "hostname": "extension-pserver",
+ "purpose": "gamma-vce"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json b/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json
new file mode 100644
index 0000000..008a39b
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/skeleton-pserver.json
@@ -0,0 +1,63 @@
+{
+ "hostname": "SkeletonPserver.aic.att.com",
+ "pserver-id": "auto-generated-skeleton",
+ "in-maint": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "Sample-att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "Sample-AAIAIC25"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "Sample-TenantId"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "Sample-VserverId"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "Sample-VserverName"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "Sample-att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "Sample-AAIAIC25"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type"
+ }
+ ]
+ },
+ {
+ "related-to": "complex",
+ "relationship-data": [
+ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "complex1"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/tenant.json b/aai-resources/src/test/resources/payloads/extensions/tenant.json
new file mode 100644
index 0000000..8e70472
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/tenant.json
@@ -0,0 +1,4 @@
+{
+ "tenant-id" : "Sample-TenantId",
+ "tenant-name" : "Sample-TenantName"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/vf-module.json b/aai-resources/src/test/resources/payloads/extensions/vf-module.json
new file mode 100644
index 0000000..6880d13
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/vf-module.json
@@ -0,0 +1,3 @@
+{
+ "vf-module-id": "SampleVfModule1"
+}
diff --git a/aai-resources/src/test/resources/payloads/extensions/vnfc.json b/aai-resources/src/test/resources/payloads/extensions/vnfc.json
new file mode 100644
index 0000000..d5adae8
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/vnfc.json
@@ -0,0 +1,7 @@
+{
+ "vnfc-name": "Sample-VserverName1",
+ "nfc-naming-code": "Sample-code",
+ "nfc-function": "Sample-function",
+ "vnfc-function-code": "Sample-code",
+ "vnfc-type": "Sample-function"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json b/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json
new file mode 100644
index 0000000..54e3fd6
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/vserver-without-vf-module.json
@@ -0,0 +1,19 @@
+{
+ "vserver-id": "Sample-VserverId",
+ "vserver-name": "Sample-VserverName",
+ "vserver-selflink": "http://testvserverLink.com/Sample-VserverLink",
+ "in-maint": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "SkeletonPserver.aic.att.com"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/extensions/vserver.json b/aai-resources/src/test/resources/payloads/extensions/vserver.json
new file mode 100644
index 0000000..5f83734
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/extensions/vserver.json
@@ -0,0 +1,32 @@
+{
+ "vserver-id": "Sample-VserverId",
+ "vserver-name": "Sample-VserverName",
+ "vserver-selflink": "http://testvserverLink.com/Sample-VserverLink",
+ "in-maint": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vf-module",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "Sample-Vnf-Id"
+ },
+ {
+ "relationship-key": "vf-module.vf-module-id",
+ "relationship-value": "SampleVfModule1"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "SkeletonPserver.aic.att.com"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/pserver1.json b/aai-resources/src/test/resources/payloads/resource/pserver1.json
new file mode 100644
index 0000000..741183c
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/pserver1.json
@@ -0,0 +1,28 @@
+{
+ "hostname": "pserver-hostname-test01",
+ "ptnii-equip-name": "example-ptnii-equip-name-val-36969",
+ "number-of-cpus": 62220,
+ "disk-in-gigabytes": 872,
+ "ram-in-megabytes": 35331,
+ "equip-type": "example-equip-type-val-22986",
+ "equip-vendor": "example-equip-vendor-val-37452",
+ "equip-model": "example-equip-model-val-14665",
+ "fqdn": "example-fqdn-val-33429",
+ "pserver-selflink": "example-pserver-selflink-val-10125",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-3155",
+ "serial-number": "example-serial-number-val-12010",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977",
+ "inv-status": "example-inv-status-val-3682",
+ "pserver-id": "example-pserver-id-val-82142",
+ "internet-topology": "example-internet-topology-val-56425",
+ "in-maint": true,
+ "pserver-name2": "example-pserver-name2-val-53802",
+ "purpose": "example-purpose-val-90218",
+ "prov-status": "example-prov-status-val-11642",
+ "management-option": "example-management-option-val-91111",
+ "host-profile": "example-host-profile-val-36247"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/pserver2.json b/aai-resources/src/test/resources/payloads/resource/pserver2.json
new file mode 100644
index 0000000..6b2676c
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/pserver2.json
@@ -0,0 +1,28 @@
+{
+ "hostname": "pserver-hostname-test02",
+ "ptnii-equip-name": "example-ptnii-equip-name-val-36969",
+ "number-of-cpus": 62220,
+ "disk-in-gigabytes": 872,
+ "ram-in-megabytes": 35331,
+ "equip-type": "example-equip-type-val-22986",
+ "equip-vendor": "example-equip-vendor-val-37452",
+ "equip-model": "example-equip-model-val-14665",
+ "fqdn": "example-fqdn-val-33429",
+ "pserver-selflink": "example-pserver-selflink-val-10125",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-3155",
+ "serial-number": "example-serial-number-val-12010",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977",
+ "inv-status": "example-inv-status-val-3682",
+ "pserver-id": "example-pserver-id-val-82142",
+ "internet-topology": "example-internet-topology-val-56425",
+ "in-maint": true,
+ "pserver-name2": "example-pserver-name2-val-53802",
+ "purpose": "example-purpose-val-90218",
+ "prov-status": "example-prov-status-val-11642",
+ "management-option": "example-management-option-val-91111",
+ "host-profile": "example-host-profile-val-36247"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/pserver3.json b/aai-resources/src/test/resources/payloads/resource/pserver3.json
new file mode 100644
index 0000000..5f92770
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/pserver3.json
@@ -0,0 +1,28 @@
+{
+ "hostname": "pserver-hostname-test03",
+ "ptnii-equip-name": "example-ptnii-equip-name-val-36969",
+ "number-of-cpus": 62220,
+ "disk-in-gigabytes": 872,
+ "ram-in-megabytes": 35331,
+ "equip-type": "example-equip-type-val-22986",
+ "equip-vendor": "example-equip-vendor-val-37452",
+ "equip-model": "example-equip-model-val-14665",
+ "fqdn": "example-fqdn-val-33429",
+ "pserver-selflink": "example-pserver-selflink-val-10125",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-3155",
+ "serial-number": "example-serial-number-val-12010",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977",
+ "inv-status": "example-inv-status-val-3682",
+ "pserver-id": "example-pserver-id-val-82142",
+ "internet-topology": "example-internet-topology-val-56425",
+ "in-maint": true,
+ "pserver-name2": "example-pserver-name2-val-53802",
+ "purpose": "example-purpose-val-90218",
+ "prov-status": "example-prov-status-val-11642",
+ "management-option": "example-management-option-val-91111",
+ "host-profile": "example-host-profile-val-36247"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/pserver4.json b/aai-resources/src/test/resources/payloads/resource/pserver4.json
new file mode 100644
index 0000000..ee9b25c
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/pserver4.json
@@ -0,0 +1,28 @@
+{
+ "hostname": "pserver-hostname-test04",
+ "ptnii-equip-name": "example-ptnii-equip-name-val-36969",
+ "number-of-cpus": 62220,
+ "disk-in-gigabytes": 872,
+ "ram-in-megabytes": 35331,
+ "equip-type": "example-equip-type-val-22986",
+ "equip-vendor": "example-equip-vendor-val-37452",
+ "equip-model": "example-equip-model-val-14665",
+ "fqdn": "example-fqdn-val-33429",
+ "pserver-selflink": "example-pserver-selflink-val-10125",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-3155",
+ "serial-number": "example-serial-number-val-12010",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977",
+ "inv-status": "example-inv-status-val-3682",
+ "pserver-id": "example-pserver-id-val-82142",
+ "internet-topology": "example-internet-topology-val-56425",
+ "in-maint": true,
+ "pserver-name2": "example-pserver-name2-val-53802",
+ "purpose": "example-purpose-val-90218",
+ "prov-status": "example-prov-status-val-11642",
+ "management-option": "example-management-option-val-91111",
+ "host-profile": "example-host-profile-val-36247"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/pserver5.json b/aai-resources/src/test/resources/payloads/resource/pserver5.json
new file mode 100644
index 0000000..7e7d1e0
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/pserver5.json
@@ -0,0 +1,28 @@
+{
+ "hostname": "pserver-hostname-test05",
+ "ptnii-equip-name": "example-ptnii-equip-name-val-36969",
+ "number-of-cpus": 62220,
+ "disk-in-gigabytes": 872,
+ "ram-in-megabytes": 35331,
+ "equip-type": "example-equip-type-val-22986",
+ "equip-vendor": "example-equip-vendor-val-37452",
+ "equip-model": "example-equip-model-val-14665",
+ "fqdn": "example-fqdn-val-33429",
+ "pserver-selflink": "example-pserver-selflink-val-10125",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-3155",
+ "serial-number": "example-serial-number-val-12010",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-77686",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-17856",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-33665",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-6210",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-40977",
+ "inv-status": "example-inv-status-val-3682",
+ "pserver-id": "example-pserver-id-val-82142",
+ "internet-topology": "example-internet-topology-val-56425",
+ "in-maint": true,
+ "pserver-name2": "example-pserver-name2-val-53802",
+ "purpose": "example-purpose-val-90218",
+ "prov-status": "example-prov-status-val-11642",
+ "management-option": "example-management-option-val-91111",
+ "host-profile": "example-host-profile-val-36247"
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver.json b/aai-resources/src/test/resources/payloads/resource/vserver.json
new file mode 100644
index 0000000..c2b38f5
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC1",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant1",
+ "tenant-name": "tenant1",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver1234",
+ "vserver-name": "vserver1234",
+ "vserver-selflink": "somelink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver1.json b/aai-resources/src/test/resources/payloads/resource/vserver1.json
new file mode 100644
index 0000000..1c2716a
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver1.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC01",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant01",
+ "tenant-name": "tenant01",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver01",
+ "vserver-name": "vserver01",
+ "vserver-selflink": "somelink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test01"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver2.json b/aai-resources/src/test/resources/payloads/resource/vserver2.json
new file mode 100644
index 0000000..834c64f
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver2.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC02",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant02",
+ "tenant-name": "tenant02",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver02",
+ "vserver-name": "vserver02",
+ "vserver-selflink": "somelink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test02"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver3.json b/aai-resources/src/test/resources/payloads/resource/vserver3.json
new file mode 100644
index 0000000..6e57e95
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver3.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC03",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant03",
+ "tenant-name": "tenant03",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver03",
+ "vserver-name": "vserver03",
+ "vserver-selflink": "somelink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test03"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver4.json b/aai-resources/src/test/resources/payloads/resource/vserver4.json
new file mode 100644
index 0000000..e8d825f
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver4.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC04",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant04",
+ "tenant-name": "tenant04",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver04",
+ "vserver-name": "vserver04",
+ "vserver-selflink": "somelink",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test04"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/resource/vserver5.json b/aai-resources/src/test/resources/payloads/resource/vserver5.json
new file mode 100644
index 0000000..973c0ee
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/resource/vserver5.json
@@ -0,0 +1,19 @@
+{
+ "cloud-owner": "test-aic",
+ "cloud-region-id": "testAIC05",
+ "tenants": {"tenant": [ {
+ "tenant-id": "tenant05",
+ "tenant-name": "tenant05",
+ "vservers": {"vserver": [ {
+ "vserver-id": "vserver05",
+ "vserver-name": "vserver05",
+ "vserver-selflink": "somelink05",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "relationship-list": {"relationship": [ {
+ "related-to": "pserver",
+ "related-link": "/aai/v15/cloud-infrastructure/pservers/pserver/pserver-hostname-test05"
+ }]}
+ }]}
+ }]}
+} \ No newline at end of file
diff --git a/onap-java-formatter.xml b/onap-java-formatter.xml
index 920d37b..1dd9de6 100644
--- a/onap-java-formatter.xml
+++ b/onap-java-formatter.xml
@@ -40,7 +40,7 @@
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
@@ -58,7 +58,7 @@
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
@@ -67,13 +67,13 @@
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
@@ -278,7 +278,7 @@
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
diff --git a/pom.xml b/pom.xml
index b45f047..334e2db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.6.5</version>
+ <version>1.6.8</version>
</parent>
<groupId>org.onap.aai.resources</groupId>
<artifactId>resources</artifactId>
@@ -48,6 +48,7 @@
<staging.path>/content/repositories/staging/</staging.path>
<!-- GMaven plugin uses this property to figure out the name of the docker tag -->
<aai.project.version>${project.version}</aai.project.version>
+ <aai.common.version>1.6.8</aai.common.version>
</properties>
<build>
<pluginManagement>