aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources
diff options
context:
space:
mode:
authorKajur, Harish (vk250x) <vk250x@att.com>2019-01-13 12:18:00 -0500
committerKajur, Harish (vk250x) <vk250x@att.com>2019-01-13 12:18:07 -0500
commit3289e79a0f0343cbd380a385d61e21f59ceff85c (patch)
treea74957c74fb41275aede412e5c43307fd3e0c859 /aai-resources
parent92ac3a80c822340c07b9d09189b85c34ac797122 (diff)
Sync up the changes for v15
Issue-ID: AAI-1811 Change-Id: I5c397d5907bb0711977f62ba84abe454f410a3b7 Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'aai-resources')
-rw-r--r--aai-resources/pom.xml22
-rw-r--r--aai-resources/src/main/docker/docker-entrypoint.sh13
-rw-r--r--aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java48
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ResourcesApp.java47
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java198
-rw-r--r--aai-resources/src/main/resources/application.properties16
-rw-r--r--aai-resources/src/main/resources/etc/appprops/aaiEventDMaaPPublisher.properties4
-rw-r--r--aai-resources/src/main/resources/etc/appprops/aaiconfig.properties14
-rw-r--r--aai-resources/src/main/resources/etc/appprops/error.properties5
-rw-r--r--aai-resources/src/main/resources/etc/appprops/preferredRoute.txt1
-rw-r--r--aai-resources/src/main/resources/logback.xml42
-rw-r--r--aai-resources/src/main/resources/retired.properties4
-rw-r--r--aai-resources/src/main/scripts/audit_schema.sh2
-rw-r--r--aai-resources/src/main/scripts/bulkprocess.sh58
-rw-r--r--aai-resources/src/main/scripts/common_functions.sh2
-rw-r--r--aai-resources/src/main/scripts/deleteTool.sh2
-rw-r--r--aai-resources/src/main/scripts/getTool.sh2
-rw-r--r--aai-resources/src/main/scripts/increaseNodes.sh2
-rw-r--r--aai-resources/src/main/scripts/putTool.sh12
-rw-r--r--aai-resources/src/main/scripts/rshipTool.sh2
-rw-r--r--aai-resources/src/main/scripts/updatePem.sh2
-rw-r--r--aai-resources/src/main/scripts/updateTool.sh2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java5
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/DepthTest.java64
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java199
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerSpringTest.java7
-rw-r--r--aai-resources/src/test/resources/application-test.properties8
-rw-r--r--aai-resources/src/test/resources/etc/appprops/aaiconfig.properties8
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/complex2.json16
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/complex3.json16
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/complex4.json16
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list2.json1
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list3.json1
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship2.json8
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship3.json8
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver2.json4
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver3.json4
-rw-r--r--aai-resources/src/test/resources/payloads/relationship/pserver4.json4
38 files changed, 680 insertions, 189 deletions
diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml
index 0b5ef57..9acdd3c 100644
--- a/aai-resources/pom.xml
+++ b/aai-resources/pom.xml
@@ -35,9 +35,9 @@
<java.version>1.8</java.version>
<start-class>org.onap.aai.ResourcesApp</start-class>
- <aai.schema.version>1.4.0</aai.schema.version>
- <aai.core.version>1.4.0</aai.core.version>
- <aai.schema.ingest.version>1.4.0</aai.schema.ingest.version>
+ <aai.schema.version>1.4.1-SNAPSHOT</aai.schema.version>
+ <aai.core.version>1.4.1-SNAPSHOT</aai.core.version>
+ <aai.schema.ingest.version>1.4.1-SNAPSHOT</aai.schema.ingest.version>
<hbase.version>1.0.2</hbase.version>
<spring.boot.version>1.5.18.RELEASE</spring.boot.version>
@@ -141,14 +141,17 @@
<schema.configuration.location>N/A</schema.configuration.location>
<schema.nodes.location>${project.basedir}/src/main/resources/schema/${schema.source.name}/oxm</schema.nodes.location>
<schema.edges.location>${project.basedir}/src/main/resources/schema/${schema.source.name}/dbedgerules</schema.edges.location>
- <schema.version.depth.start>v9</schema.version.depth.start>
+ <schema.version.depth.start>v10</schema.version.depth.start>
<schema.version.related.link.start>v10</schema.version.related.link.start>
<schema.version.app.root.start>v11</schema.version.app.root.start>
<schema.version.namespace.change.start>v12</schema.version.namespace.change.start>
<schema.version.edge.label.start>v12</schema.version.edge.label.start>
- <schema.version.api.default>v14</schema.version.api.default>
- <schema.version.list>v8,v9,v10,v11,v12,v13,v14</schema.version.list>
+ <schema.version.api.default>v15</schema.version.api.default>
+ <schema.version.list>v10,v11,v12,v13,v14,v15</schema.version.list>
<schema.uri.base.path>/aai</schema.uri.base.path>
+ <!-- <schema.translator.list>config</schema.translator.list> -->
+ <schema.ingest.file>${project.basedir}/src/main/resources/application.properties</schema.ingest.file>
+
<!-- End of Default ONAP Schema Properties -->
<!-- Setting some default value to not complain by editor but it will be overridden by gmaven plugin -->
@@ -228,7 +231,8 @@
<properties>
<schema.source.name>onap</schema.source.name>
<schema.version.namespace.change.start>v12</schema.version.namespace.change.start>
- <schema.version.list>v8,v9,v10,v11,v12,v13,v14</schema.version.list>
+ <schema.version.list>v10,v11,v12,v13,v14,v15</schema.version.list>
+ <schema.ingest.file>${project.basedir}/src/main/resources/application.properties</schema.ingest.file>
</properties>
</profile>
<!-- End of ONAP Profile -->
@@ -308,6 +312,10 @@
<key>schema.uri.base.path</key>
<value>${schema.uri.base.path}</value>
</property>
+ <property>
+ <key>schema.ingest.file</key>
+ <value>${schema.ingest.file}</value>
+ </property>
</systemProperties>
<executable>java</executable>
</configuration>
diff --git a/aai-resources/src/main/docker/docker-entrypoint.sh b/aai-resources/src/main/docker/docker-entrypoint.sh
index 1d6e7b8..d2fe989 100644
--- a/aai-resources/src/main/docker/docker-entrypoint.sh
+++ b/aai-resources/src/main/docker/docker-entrypoint.sh
@@ -38,7 +38,7 @@ if [ $(cat /etc/passwd | grep aaiadmin | wc -l) -eq 0 ]; then
}
fi;
-chown -R aaiadmin:aaiadmin /opt/app /opt/aai/logroot
+chown -R aaiadmin:aaiadmin /opt/app /opt/aai/logroot /opt/bulkprocess_load
find /opt/app/ -name "*.sh" -exec chmod +x {} +
if [ -f ${APP_HOME}/aai.sh ]; then
@@ -67,6 +67,13 @@ if [ -f ${APP_HOME}/aai.sh ]; then
exit 0;
fi;
+ if [ ! -f ${APP_HOME}/scripts/updatePem.sh ]; then
+ echo "Unable to find the updatePem script";
+ exit 1;
+ else
+ gosu aaiadmin ${APP_HOME}/scripts/updatePem.sh
+ fi;
+
fi;
mkdir -p /opt/app/aai-resources/logs/gc
@@ -117,12 +124,16 @@ JVM_OPTS="${JVM_OPTS} -Dsun.net.inetaddr.ttl=180";
JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
JVM_OPTS="${JVM_OPTS} ${POST_JVM_ARGS}";
JAVA_OPTS="${PRE_JAVA_OPTS} -DAJSC_HOME=$APP_HOME";
+if [ -f ${INTROSCOPE_LIB}/Agent.jar ] && [ -f ${INTROSCOPE_AGENTPROFILE} ]; then
+ JAVA_OPTS="${JAVA_OPTS} -javaagent:${INTROSCOPE_LIB}/Agent.jar -noverify -Dcom.wily.introscope.agentProfile=${INTROSCOPE_AGENTPROFILE} -Dintroscope.agent.agentName=resources"
+fi
JAVA_OPTS="${JAVA_OPTS} -Dserver.port=${SERVER_PORT}";
JAVA_OPTS="${JAVA_OPTS} -DBUNDLECONFIG_DIR=./resources";
JAVA_OPTS="${JAVA_OPTS} -Dserver.local.startpath=${RESOURCES_HOME}";
JAVA_OPTS="${JAVA_OPTS} -DAAI_CHEF_ENV=${AAI_CHEF_ENV}";
JAVA_OPTS="${JAVA_OPTS} -DSCLD_ENV=${SCLD_ENV}";
JAVA_OPTS="${JAVA_OPTS} -DAFT_ENVIRONMENT=${AFT_ENVIRONMENT}";
+JAVA_OPTS="${JAVA_OPTS} -DlrmName=com.att.ajsc.aai-resources";
JAVA_OPTS="${JAVA_OPTS} -DAAI_BUILD_VERSION=${AAI_BUILD_VERSION}";
JAVA_OPTS="${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom";
JAVA_OPTS="${JAVA_OPTS} -Dlogback.configurationFile=./resources/logback.xml";
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 5f94141..a4c6ef5 100644
--- a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
+++ b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java
@@ -23,7 +23,6 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraph;
@@ -37,18 +36,22 @@ import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.util.AAISystemExitUtil;
import org.onap.aai.util.PositiveNumValidator;
-
+import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+import org.onap.aai.serialization.db.EdgeSerializer;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
-import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class IncreaseNodesTool {
public static long nodeCount = 0;
-
+ protected EdgeSerializer edgeSerializer;
private LoaderFactory loaderFactory;
private SchemaVersions schemaVersions;
+ protected TransactionalGraphEngine engine;
+ Vertex parentVtx;
+
+
public IncreaseNodesTool(LoaderFactory loaderFactory, SchemaVersions schemaVersions){
this.loaderFactory = loaderFactory;
@@ -88,20 +91,18 @@ public class IncreaseNodesTool {
nodeCount = Long.parseLong(cArgs.numberOfNodes);
addVertex(janusGraph, cArgs.nodeType,propList,cArgs);
}
-
/***
* adds a vertex based on user inputs of node type number of nodes and the node uri
* /cloud-infrastructure/pservers/pserver/
* /network/pnfs/pnf/
- * /cloud-infrastructure/pservers/pserver/random-056fd6c4-7313-4fa0-b854-0d9983bdb0ab/DevB/p-interfaces/p-interface/
- * @param nodeType
- * @param propList
+ * /cloud-infrastructure/pservers/pserver/random-056fd6c4-7313-4fa0-b854-0d9983bdb0ab/p-interfaces/p-interface/
+ * @param
+ * @param
* @param cArgs
*/
public void addVertex(JanusGraph janusGraph, String nodeType, List<String> propList,CommandLineArgs cArgs){
long startTime = System.currentTimeMillis();
-
try (JanusGraphTransaction transaction = janusGraph.newTransaction()) {
boolean success = true;
@@ -110,10 +111,27 @@ public class IncreaseNodesTool {
for (long i = 1; i <= nodeCount; i++) {
String randomId = UUID.randomUUID().toString();
Vertex v = g.addV().next();
+
+ if(cArgs.child.equals(true)){
+
+ if(parentVtx == null){
+ String[] uriTokens = cArgs.uri.split("//");
+ String ParentNodeType = uriTokens[uriTokens.length-4]; //parent node type
+ String keyVal = uriTokens[uriTokens.length-3]; // parent unique key
+ parentVtx = g.V().has(ParentNodeType,keyVal).next();
+ edgeSerializer.addTreeEdgeIfPossible(g,parentVtx,v);
+
+ }
+ else{
+ edgeSerializer.addTreeEdgeIfPossible(g,parentVtx,v);
+ }
+ }
+
v.property("aai-node-type", nodeType);
v.property("source-of-truth", "IncreaseNodesTool");
v.property("aai-uri", cArgs.uri+"random-"+randomId);
+
for(String propName : propList){
if(propName.equals("in-maint")){
v.property(propName,"false");
@@ -137,17 +155,23 @@ public class IncreaseNodesTool {
}
}
-}
+ }
+
+
class CommandLineArgs {
@Parameter(names = "-numberOfNodes", description = "how many nodes you would like to enter", required = true , validateWith = PositiveNumValidator.class)
public String numberOfNodes;
- @Parameter(names = "-nodeType", description = "They aai-node-type of the node being entered", required = true)
+ @Parameter(names = "-nodeType", description = "The aai-node-type of the node being entered", required = true)
public String nodeType;
- @Parameter(names = "-uri", description = "uri to be passed for the node")
+ @Parameter(names = "-uri", description = "uri to be passed for the node",required = true)
public String uri;
+
+ @Parameter(names = "-child", description = "is this a child node",required = true)
+ public String child;
+
}
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 988b057..36fcd41 100644
--- a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
+++ b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
@@ -25,11 +25,13 @@ 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.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.util.AAIConfig;
@@ -135,13 +137,27 @@ public class ResourcesApp {
LoggingContext.serviceName(APP_NAME);
LoggingContext.targetServiceName("contextInitialized");
LoggingContext.statusCode(StatusCode.COMPLETE);
-
-
- SpringApplication app = new SpringApplication(ResourcesApp.class);
- app.setLogStartupInfo(false);
- app.setRegisterShutdownHook(true);
- app.addInitializers(new PropertyPasswordConfiguration());
- Environment env = app.run(args).getEnvironment();
+
+ Environment env =null;
+ AAIConfig.init();
+ try {
+ SpringApplication app = new SpringApplication(ResourcesApp.class);
+ app.setLogStartupInfo(false);
+ app.setRegisterShutdownHook(true);
+ app.addInitializers(new PropertyPasswordConfiguration());
+ 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());
+ 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 {}!" ,
@@ -187,4 +203,21 @@ public class ResourcesApp {
}
}
}
+ private static AAIException schemaServiceExceptionTranslator(Exception ex) {
+ AAIException aai = null;
+ if(ExceptionUtils.getRootCause(ex).getMessage().contains("NodeIngestor")){
+ aai = new AAIException("AAI_3026","Error reading OXM from SchemaService - Investigate");
+ }
+ else if(ExceptionUtils.getRootCause(ex).getMessage().contains("EdgeIngestor")){
+ aai = new AAIException("AAI_3027","Error reading EdgeRules from SchemaService - Investigate");
+ }
+ else if(ExceptionUtils.getRootCause(ex).getMessage().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");
+ }
+
+ return aai;
+ }
}
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 7f73362..0b544f4 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
@@ -50,6 +50,8 @@ 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;
@@ -93,6 +95,16 @@ public class LegacyMoxyConsumer extends RESTAPI {
}
+ /**
+ *
+ * @param content
+ * @param versionParam
+ * @param uri
+ * @param headers
+ * @param info
+ * @param req
+ * @return
+ */
@PUT
@Path("/{uri: .+}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@@ -128,17 +140,17 @@ public class LegacyMoxyConsumer extends RESTAPI {
TransactionalGraphEngine dbEngine = null;
boolean success = true;
- try {
+ try {
validateRequest(info);
- SchemaVersion version = new SchemaVersion(versionParam);
- DBConnectionType type = null;
- if(AAIConfig.get("aai.use.realtime", "true").equals("true")){
- type = DBConnectionType.REALTIME;
+ 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);
+ HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class);
+ traversalUriHttpEntry.setHttpEntryProperties(version, type);
loader = traversalUriHttpEntry.getLoader();
dbEngine = traversalUriHttpEntry.getDbEngine();
@@ -199,7 +211,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
return this.handleWrites(mediaType, HttpMethod.MERGE_PATCH, content, versionParam, uri, headers, info);
}
-
+
/**
* Gets the legacy.
*
@@ -230,12 +242,12 @@ public class LegacyMoxyConsumer extends RESTAPI {
return getLegacy(content, versionParam, uri, depthParam, cleanUp, headers, info, req, new HashSet<String>(), resultIndex, resultSize);
}
}
- );
+ );
}
/**
* This method exists as a workaround for filtering out undesired query params while routing between REST consumers
- *
+ *
* @param content
* @param versionParam
* @param uri
@@ -296,7 +308,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = traversalUriHttpEntry.process(requests, sourceOfTruth);
response = responsesTuple.getValue1().get(0).getValue1();
-
+
} catch (AAIException e) {
response = consumerExceptionResponseGenerator(headers, info, HttpMethod.GET, e);
} catch (Exception e ) {
@@ -377,7 +389,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(uriObject);
String objType = uriQuery.getResultType();
- Introspector obj = loader.introspectorFromName(objType);
+ Introspector obj = loader.introspectorFromName(objType);
DBRequest request = new DBRequest.Builder(HttpMethod.DELETE, uriObject, uriQuery, obj, headers, info, transId).build();
List<DBRequest> requests = new ArrayList<>();
@@ -462,7 +474,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
Introspector wrappedEntity = loader.unmarshal("relationship", content, org.onap.aai.restcore.MediaType.getEnum(this.getInputMediaType(inputMediaType)));
- DBRequest request = new DBRequest.Builder(HttpMethod.DELETE_EDGE, uriObject, uriQuery, wrappedEntity, headers, info, transId).build();
+ DBRequest request = new DBRequest.Builder(HttpMethod.DELETE_EDGE, uriObject, uriQuery, wrappedEntity, headers, info, transId).build();
List<DBRequest> requests = new ArrayList<>();
requests.add(request);
Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = traversalUriHttpEntry.process(requests, sourceOfTruth);
@@ -488,7 +500,103 @@ public class LegacyMoxyConsumer extends RESTAPI {
return response;
}
-
+
+ @GET
+ @Path("/{uri: .+}/relationship-list")
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ public Response getRelationshipList (@DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context UriInfo info) {
+ return runner(AAIConstants.AAI_CRUD_TIMEOUT_ENABLED,
+ AAIConstants.AAI_CRUD_TIMEOUT_APP,
+ AAIConstants.AAI_CRUD_TIMEOUT_LIMIT,
+ headers,
+ info,
+ HttpMethod.GET,
+ new AaiCallable<Response>() {
+ @Override
+ public Response process() {
+ return getRelationshipList(versionParam, uri, cleanUp, headers, info, resultIndex, resultSize);
+ }
+ }
+ );
+ }
+
+ /**
+ *
+ * @param versionParam
+ * @param uri
+ * @param cleanUp
+ * @param headers
+ * @param info
+ * @return
+ */
+ 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;
+
+ 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);
+ dbEngine = traversalUriHttpEntry.getDbEngine();
+ loader = traversalUriHttpEntry.getLoader();
+ MultivaluedMap<String, String> params = info.getQueryParameters();
+
+ params = removeNonFilterableParams(params);
+
+ uri = uri.split("\\?")[0];
+
+ URI uriObject = UriBuilder.fromPath(uri).build();
+
+ QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(uriObject, params);
+
+ String objType = "";
+ if (!uriQuery.getContainerType().equals("")) {
+ objType = uriQuery.getContainerType();
+ } else {
+ objType = uriQuery.getResultType();
+ }
+ Introspector obj = loader.introspectorFromName(objType);
+ DBRequest request =
+ 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") {
+ traversalUriHttpEntry.setPaginationIndex(Integer.parseInt(resultIndex));
+ traversalUriHttpEntry.setPaginationBucket(Integer.parseInt(resultSize));
+ }
+ Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = traversalUriHttpEntry.process(requests, sourceOfTruth);
+
+ response = responsesTuple.getValue1().get(0).getValue1();
+ } catch (AAIException e) {
+ response = consumerExceptionResponseGenerator(headers, info, HttpMethod.GET_RELATIONSHIP, e);
+ } catch (Exception e ) {
+ AAIException ex = new AAIException("AAI_4000", e);
+
+ response = consumerExceptionResponseGenerator(headers, info, HttpMethod.GET_RELATIONSHIP, ex);
+ } finally {
+ if (dbEngine != null) {
+ if (cleanUp.equals("true")) {
+ dbEngine.commit();
+ } else {
+ dbEngine.rollback();
+ }
+ }
+ }
+ return response;
+ }
+
/**
* Validate request.
*
@@ -502,7 +610,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
throw new AAIException("AAI_3008", "uri=" + getPath(info));
}
}
-
+
/**
* Gets the path.
*
@@ -523,11 +631,11 @@ public class LegacyMoxyConsumer extends RESTAPI {
if (map.keySet().size() > 0) {
path += params + queryParams;
}
-
+
return path;
-
+
}
-
+
/**
* Handle writes.
*
@@ -568,32 +676,32 @@ public class LegacyMoxyConsumer extends RESTAPI {
URI uriObject = UriBuilder.fromPath(uri).build();
this.validateURI(uriObject);
QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(uriObject);
- String objName = uriQuery.getResultType();
- if (content.length() == 0) {
- if (mediaType.toString().contains(MediaType.APPLICATION_JSON)) {
- content = "{}";
- } else {
- content = "<empty/>";
- }
- }
- Introspector obj = loader.unmarshal(objName, content, org.onap.aai.restcore.MediaType.getEnum(this.getInputMediaType(mediaType)));
- if (obj == null) {
- throw new AAIException("AAI_3000", "object could not be unmarshalled:" + content);
- }
-
- if (mediaType.toString().contains(MediaType.APPLICATION_XML) && !content.equals("<empty/>") && isEmptyObject(obj)) {
- throw new AAIInvalidXMLNamespace(content);
- }
-
- this.validateIntrospector(obj, loader, uriObject, method);
-
- DBRequest request =
+ String objName = uriQuery.getResultType();
+ if (content.length() == 0) {
+ if (mediaType.toString().contains(MediaType.APPLICATION_JSON)) {
+ content = "{}";
+ } else {
+ content = "<empty/>";
+ }
+ }
+ Introspector obj = loader.unmarshal(objName, content, org.onap.aai.restcore.MediaType.getEnum(this.getInputMediaType(mediaType)));
+ if (obj == null) {
+ throw new AAIException("AAI_3000", "object could not be unmarshalled:" + content);
+ }
+
+ if (mediaType.toString().contains(MediaType.APPLICATION_XML) && !content.equals("<empty/>") && isEmptyObject(obj)) {
+ throw new AAIInvalidXMLNamespace(content);
+ }
+
+ this.validateIntrospector(obj, loader, uriObject, method);
+
+ DBRequest request =
new DBRequest.Builder(method, uriObject, uriQuery, obj, headers, info, transId)
- .rawRequestContent(content).build();
+ .rawRequestContent(content).build();
List<DBRequest> requests = new ArrayList<>();
requests.add(request);
Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = traversalUriHttpEntry.process(requests, sourceOfTruth);
-
+
response = responsesTuple.getValue1().get(0).getValue1();
success = responsesTuple.getValue0();
} catch (AAIException e) {
@@ -612,21 +720,21 @@ public class LegacyMoxyConsumer extends RESTAPI {
}
}
}
-
+
return response;
}
-
+
private void validateURI(URI uri) throws AAIException {
if (hasRelatedTo(uri)) {
throw new AAIException("AAI_3010");
}
}
private boolean hasRelatedTo(URI uri) {
-
+
return uri.toString().contains("/" + RestTokens.COUSIN + "/");
}
-
+
protected boolean isEmptyObject(Introspector obj) {
- return "{}".equals(obj.marshal(false));
+ return "{}".equals(obj.marshal(false));
}
}
diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties
index b869262..2e0bb04 100644
--- a/aai-resources/src/main/resources/application.properties
+++ b/aai-resources/src/main/resources/application.properties
@@ -53,9 +53,9 @@ schema.ingest.file=${server.local.startpath}/application.properties
schema.uri.base.path=/aai
# Lists all of the versions in the schema
-schema.version.list=v8,v9,v10,v11,v12,v13,v14
+schema.version.list=v10,v11,v12,v13,v14,v15
# Specifies from which version should the depth parameter to default to zero
-schema.version.depth.start=v9
+schema.version.depth.start=v10
# Specifies from which version should the related link be displayed in response payload
schema.version.related.link.start=v10
# Specifies from which version should the client see only the uri excluding host info
@@ -66,4 +66,14 @@ 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=v14
+schema.version.api.default=v15
+schema.translator.list=config
+schema.service.base.url=https://localhost:8452/aai/schema-service/v1/
+schema.service.nodes.endpoint=nodes?version=
+schema.service.edges.endpoint=edgerules?version=
+schema.service.versions.endpoint=versions
+
+schema.service.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
+schema.service.ssl.trust-store=${server.local.startpath}/etc/auth/aai_keystore
+schema.service.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+schema.service.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
diff --git a/aai-resources/src/main/resources/etc/appprops/aaiEventDMaaPPublisher.properties b/aai-resources/src/main/resources/etc/appprops/aaiEventDMaaPPublisher.properties
new file mode 100644
index 0000000..4b9371f
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/appprops/aaiEventDMaaPPublisher.properties
@@ -0,0 +1,4 @@
+topic=AAI-EVENT
+partition=AAI
+maxBatchSize=100
+maxAgeMs=250
diff --git a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
index b11d8f8..cb8e2b6 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/v14/
+aai.server.url=https://localhost:8443/aai/v15/
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=v14
+aai.notification.current.version=v15
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=v14
+aai.notificationEvent.default.version=v15
# This one lets us enable/disable resource-version checking on updates/deletes
aai.resourceversion.enableflag=true
aai.logging.maxStackTraceEntries=10
-aai.default.api.version=v14
+aai.default.api.version=v15
# Used by Model-processing code
aai.model.delete.sleep.per.vtx.msec=500
@@ -109,3 +109,9 @@ aai.bulkconsumer.payloadlimit=30
aai.bulkconsumer.payloadoverride=false
aai.rest.getall.depthparam=asofijaosjf-oijfadao-43jj-a508-8539cd36ecda
+aai.resourceversion.disabled.uuid=ajifsjisajfiasjf-oijfadao-43jj-a508-8539cd36ecda
+
+aai.use.realtime=true
+
+# Threshold for margin of error (in ms) for resources_with_sot format to derive the most recent http method performed
+aai.resource.formatter.threshold=10 \ No newline at end of file
diff --git a/aai-resources/src/main/resources/etc/appprops/error.properties b/aai-resources/src/main/resources/etc/appprops/error.properties
index 99306d4..30b248b 100644
--- a/aai-resources/src/main/resources/etc/appprops/error.properties
+++ b/aai-resources/src/main/resources/etc/appprops/error.properties
@@ -35,6 +35,9 @@ 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
# pol errors
AAI_3100=5:1:WARN:3100:400:3100:Unsupported operation %1
@@ -116,6 +119,8 @@ 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
#--- aaicsvp: 7101-7199
AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing
diff --git a/aai-resources/src/main/resources/etc/appprops/preferredRoute.txt b/aai-resources/src/main/resources/etc/appprops/preferredRoute.txt
new file mode 100644
index 0000000..5f7aefd
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/appprops/preferredRoute.txt
@@ -0,0 +1 @@
+preferredRouteKey= \ No newline at end of file
diff --git a/aai-resources/src/main/resources/logback.xml b/aai-resources/src/main/resources/logback.xml
index b580353..c903175 100644
--- a/aai-resources/src/main/resources/logback.xml
+++ b/aai-resources/src/main/resources/logback.xml
@@ -204,6 +204,22 @@
<pattern>${eelfLogPattern}</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 class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfLogPattern}</pattern>
+ </encoder>
+ </appender>
<appender name="dmaapAAIEventConsumerMetric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -248,29 +264,9 @@
<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
+ <!-- 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="OFF" />
@@ -371,6 +367,10 @@
<appender-ref ref="dmaapAAIEventConsumerMetric" />
</logger>
+ <logger name="com.att.nsa.mr" level="INFO" >
+ <appender-ref ref="dmaapAAIEventConsumerInfo" />
+ </logger>
+
<logger name="org.apache" level="OFF" />
<logger name="org.zookeeper" level="OFF" />
<logger name="org.janusgraph" level="WARN" />
diff --git a/aai-resources/src/main/resources/retired.properties b/aai-resources/src/main/resources/retired.properties
index b4c0ca4..554e76c 100644
--- a/aai-resources/src/main/resources/retired.properties
+++ b/aai-resources/src/main/resources/retired.properties
@@ -3,7 +3,7 @@ retired.api.pattern.list=\
^/aai/servers/v2/.*$,\
^/aai/v[78]/service-design-and-creation/models.*$,\
^/aai/v[78]/service-design-and-creation/named-queries.*$,\
- ^/aai/v[2-6]+/.*$\
+ ^/aai/v[2-9]+/.*$\
retired.api.all.versions=^/aai/v[0-9]+/search/edge-tag-query.*$,\
- ^/aai/v[0-9]+/search/sdn-zone-query.*$ \ No newline at end of file
+ ^/aai/v[0-9]+/search/sdn-zone-query.*$
diff --git a/aai-resources/src/main/scripts/audit_schema.sh b/aai-resources/src/main/scripts/audit_schema.sh
index ea66092..ed5d71a 100644
--- a/aai-resources/src/main/scripts/audit_schema.sh
+++ b/aai-resources/src/main/scripts/audit_schema.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
#
# ============LICENSE_START=======================================================
# org.onap.aai
diff --git a/aai-resources/src/main/scripts/bulkprocess.sh b/aai-resources/src/main/scripts/bulkprocess.sh
new file mode 100644
index 0000000..5611bf7
--- /dev/null
+++ b/aai-resources/src/main/scripts/bulkprocess.sh
@@ -0,0 +1,58 @@
+#!/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 is used to run the bulkprocess api for resources given the input of a directory, and headers.
+# This script would call bulkprocess for each json file in the directory, using the json file's contents as the payload for the call, and headers would be used accordingly.
+# The output of each run will be saved to a new file.
+# The input files in the directory will be {someKey}-{0-9} for instance cloudRegion-1.json, cloudRegion-2.json etc. these need to be ran in sequential order based on the number.
+# Nomenclature for the output is saved as <jsonfilename without json>.YYYYMMDDhhmmss.results.json
+
+
+inputFolder=$1
+if [ -z "$1" ]; then
+ echo "Input folder string is empty."
+ exit 1
+fi
+
+if [ ! -d "/opt/bulkprocess_load/$1" ]; then
+ echo "Input folder could not be found."
+ exit 1
+fi
+
+XFROMAPPID=$2
+if [ -z "$2" ]; then
+ echo "Missing XFROMAPPID."
+ 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;
+}
+
+XTRANSID=$3
+
+for input_file in $(ls -v /opt/bulkprocess_load/${inputFolder}/*);
+do
+ output_file=$(basename $input_file | sed 's/.json//g');
+ /opt/app/aai-resources/scripts/putTool.sh /bulkprocess ${input_file} -display $XFROMAPPID $XTRANSID > /tmp/${output_file}.$(date +"%Y%m%d%H%M%S").results.json;
+done;
+
diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh
index 9c8e275..e99746d 100644
--- a/aai-resources/src/main/scripts/common_functions.sh
+++ b/aai-resources/src/main/scripts/common_functions.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
#
# ============LICENSE_START=======================================================
# org.onap.aai
diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh
index 6cb27c8..3d7f923 100644
--- a/aai-resources/src/main/scripts/deleteTool.sh
+++ b/aai-resources/src/main/scripts/deleteTool.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh
index b513d0b..e2ca220 100644
--- a/aai-resources/src/main/scripts/getTool.sh
+++ b/aai-resources/src/main/scripts/getTool.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
diff --git a/aai-resources/src/main/scripts/increaseNodes.sh b/aai-resources/src/main/scripts/increaseNodes.sh
index ce84ad6..8fb07da 100644
--- a/aai-resources/src/main/scripts/increaseNodes.sh
+++ b/aai-resources/src/main/scripts/increaseNodes.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh
index cb28413..4e55b0c 100644
--- a/aai-resources/src/main/scripts/putTool.sh
+++ b/aai-resources/src/main/scripts/putTool.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
@@ -46,7 +46,7 @@ display_usage() {
cat <<EOF
Usage: $0 [options]
- 1. Usage: putTool.sh <resource-path> <json payload file> <optional -display>
+ 1. Usage: putTool.sh <resource-path> <json payload file> <optional -display> <optional -XFROMAPPID> <optional -XTRANSID>
2. This script requires two arguments, a resource path and a file path to a json file containing the payload.
3. Example: resource-path and payload for a particular customer is: business/customers/customer/JohnDoe customerpayload.json
4. Adding the optional "-display" argument will display all data returned from the request.
@@ -76,6 +76,14 @@ ALLOWHTTPRESPONSES=$3
XFROMAPPID="AAI-TOOLS"
XTRANSID=`uuidgen`
+if [ ! -z "$4" ]; then
+ XFROMAPPID=$4
+fi
+
+if [ ! -z "$5" ]; then
+ XTRANSID=$5
+fi
+
userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
if [ "${userid}" != "aaiadmin" ]; then
echo "You must be aaiadmin to run $0. The id used $userid."
diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh
index 049ef2e..3952d44 100644
--- a/aai-resources/src/main/scripts/rshipTool.sh
+++ b/aai-resources/src/main/scripts/rshipTool.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
diff --git a/aai-resources/src/main/scripts/updatePem.sh b/aai-resources/src/main/scripts/updatePem.sh
index cb4ca8d..6e6ac6f 100644
--- a/aai-resources/src/main/scripts/updatePem.sh
+++ b/aai-resources/src/main/scripts/updatePem.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
###
# ============LICENSE_START=======================================================
diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh
index c2b788d..e79edd1 100644
--- a/aai-resources/src/main/scripts/updateTool.sh
+++ b/aai-resources/src/main/scripts/updateTool.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ksh
#
# ============LICENSE_START=======================================================
# org.onap.aai
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 5d91fb3..53b162f 100644
--- a/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/IncreaseNodesToolTest.java
@@ -48,11 +48,8 @@ public class IncreaseNodesToolTest extends AAISetup {
@Mock
GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex, org.apache.tinkerpop.gremlin.structure.Vertex> graphTraversalVertex;
-
private IncreaseNodesTool increaseNodesTool;
-
-
- String [] args = {"-numberOfNodes", "5" ,"-nodeType", "pserver", "-uri", "/cloud-infrastructure/pservers/pserver/"};
+ String [] args = {"-numberOfNodes", "5" ,"-nodeType", "pserver", "-uri", "/cloud-infrastructure/pservers/pserver/", "-child", "false"};
@Before
public void setup(){
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/DepthTest.java b/aai-resources/src/test/java/org/onap/aai/rest/DepthTest.java
deleted file mode 100644
index c664c22..0000000
--- a/aai-resources/src/test/java/org/onap/aai/rest/DepthTest.java
+++ /dev/null
@@ -1,64 +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.rest;
-
-import org.hamcrest.MatcherAssert;
-import org.junit.Test;
-import org.onap.aai.PayloadUtil;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-
-import java.io.IOException;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-
-public class DepthTest extends AbstractSpringRestTest {
-
- @Test
- public void testOldVersionReturnAllChildrenAndNewVersionReturnDepthZero() throws IOException {
-
- String id = "customer-987654321-91";
- String endpoint = "/aai/v9/business/customers/customer/"+ id;
-
- String body = PayloadUtil.getResourcePayload("customer.json");
-
- httpEntity = new HttpEntity(body, headers);
-
- ResponseEntity responseEntity;
- responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- assertThat(responseEntity.getStatusCode(), is(HttpStatus.CREATED));
-
- responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.GET, httpEntity, String.class);
- assertThat(responseEntity.getStatusCode(), is(HttpStatus.OK));
- String responseBody = responseEntity.getBody().toString();
- assertThat(responseBody, not(containsString("service-instance-id")));
- endpoint = "/aai/v8/business/customers/customer/"+ id;
-
- responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.GET, httpEntity, String.class);
- assertThat(responseEntity.getStatusCode(), is(HttpStatus.OK));
- responseBody = responseEntity.getBody().toString();
- assertThat(responseBody, containsString("service-instance-id"));
- }
-}
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 3845fb0..028f596 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
@@ -21,6 +21,9 @@ package org.onap.aai.rest;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
+import org.json.JSONArray;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Before;
@@ -121,6 +124,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
Mockito.doReturn(null).when(queryParameters).remove(anyObject());
when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
+
+
}
@Test
@@ -731,6 +736,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int timeout = legacyMoxyConsumer.getTimeoutLimit("JUNITTESTAPP2", AAIConfig.get(AAIConstants.AAI_CRUD_TIMEOUT_APP), AAIConfig.get(AAIConstants.AAI_CRUD_TIMEOUT_LIMIT));
assertEquals(-1, timeout);
}
+ @Ignore("Time sensitive test only times out if the response takes longer than 1 second")
@Test
public void testTimeoutGetCall() throws Exception{
String uri = getUri();
@@ -789,4 +795,197 @@ public class LegacyMoxyConsumerTest extends AAISetup {
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus());
}
+
+ @Test
+ public void testGetRelationshipWithoutFormat() throws IOException, JSONException {
+ String payload = getRelationshipPayload("pserver-complex-relationship-list2");
+ String pserverData = getRelationshipPayload("pserver2");
+ String complexData = getRelationshipPayload("complex2");
+
+ String hostname = "590a8943-1200-43b3-825b-75dde6b8f44b";
+ String physicalLocationId ="e13d4587-19ad-4bf5-80f5-c021efb5b61d";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ String cloudRegionUri = String.format("cloud-infrastructure/complexes/complex/%s", physicalLocationId);
+
+ doSetupResource(pserverUri, pserverData);
+ doSetupResource(cloudRegionUri, complexData);
+
+ String cloudToPserverRelationshipData = getRelationshipPayload("pserver-complex-relationship2");
+ String cloudToPserverRelationshipUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s/relationship-list/relationship", hostname);
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", cloudToPserverRelationshipUri);
+ Response response = legacyMoxyConsumer.updateRelationship(
+ cloudToPserverRelationshipData,
+ schemaVersions.getDefaultVersion().toString(),
+ cloudToPserverRelationshipUri,
+ httpHeaders,
+ uriInfo,
+ mockReq
+ );
+
+ 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());
+ }
+
+ assertEquals("Expected to return status created from the response",
+ Response.Status.OK.getStatusCode(), response.getStatus());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+
+ String getRelationshipMockRequestUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s/relationship-list", hostname);
+ String getRelationshipUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s", hostname);
+ response = legacyMoxyConsumer.getRelationshipList(
+ "1",
+ "1",
+ schemaVersions.getDefaultVersion().toString(),
+ getRelationshipUri,
+ "false",
+ httpHeaders,
+ uriInfo
+ );
+
+ String s = response.getEntity().toString();
+
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ JSONAssert.assertEquals(payload, response.getEntity().toString(), false);
+ }
+
+ @Test
+ public void testGetRelationshipWithFormat() throws IOException, JSONException, ParseException {
+ String payload = getRelationshipPayload("pserver-complex-relationship-list3");
+ String pserverData = getRelationshipPayload("pserver3");
+ String complexData = getRelationshipPayload("complex3");
+
+ String hostname = "590a8943-1200-43b3-825b-75dde6b8f44c";
+ String physicalLocationId ="e13d4587-19ad-4bf5-80f5-c021efb5b61e";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ String cloudRegionUri = String.format("cloud-infrastructure/complexes/complex/%s", physicalLocationId);
+
+ doSetupResource(pserverUri, pserverData);
+ doSetupResource(cloudRegionUri, complexData);
+
+ String cloudToPserverRelationshipData = getRelationshipPayload("pserver-complex-relationship3");
+ String cloudToPserverRelationshipUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s/relationship-list/relationship", hostname);
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", cloudToPserverRelationshipUri);
+ Response response = legacyMoxyConsumer.updateRelationship(
+ cloudToPserverRelationshipData,
+ schemaVersions.getDefaultVersion().toString(),
+ cloudToPserverRelationshipUri,
+ httpHeaders,
+ uriInfo,
+ mockReq
+ );
+
+ 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());
+ }
+
+ assertEquals("Expected to return status created from the response",
+ Response.Status.OK.getStatusCode(), response.getStatus());
+ logger.info("Response Code: " + code + "\tEntity: " + response.getEntity());
+
+ String getRelationshipMockRequestUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s/relationship-list", hostname);
+ String getRelationshipUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s", hostname);
+ queryParameters.add("format", "resource");
+ response = legacyMoxyConsumer.getRelationshipList(
+ "1",
+ "1",
+ schemaVersions.getDefaultVersion().toString(),
+ getRelationshipUri,
+ "false",
+ httpHeaders,
+ uriInfo
+ );
+ queryParameters.remove("format");
+
+ code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ String responsePayload = response.getEntity().toString();
+ JSONObject payloadJsonObject = new JSONObject(payload);
+ JSONObject responseJsonObject = new JSONObject(responsePayload);
+
+ JSONArray payloadResultsArray = payloadJsonObject.getJSONArray("results");
+ JSONArray responseResultsArray = responseJsonObject.getJSONArray("results");
+ assertEquals(payloadResultsArray.length(), responseResultsArray.length());
+
+ for (int i = 0; i < payloadResultsArray.length(); i++) {
+ String payloadResults = payloadResultsArray.get(i).toString();
+ String responseResults = responseResultsArray.get(i).toString();
+
+ JSONObject pserverPayloadObject = new JSONObject(payloadResults);
+ JSONObject pserverResponseObject = new JSONObject(responseResults);
+ String pserverPayload = pserverPayloadObject.get("pserver").toString();
+ String pserverResponse = pserverResponseObject.get("pserver").toString();
+
+ JSONObject pserverPayloadFields = new JSONObject(pserverPayload);
+ JSONObject pserverResponseFields = new JSONObject(pserverResponse);
+ String pserverPayloadHostname = pserverPayloadFields.get("hostname").toString();
+ String pserverResponseHostname = pserverResponseFields.get("hostname").toString();
+ String pserverPayloadInmaint = pserverPayloadFields.get("in-maint").toString();
+ String pserverResponseInmaint = pserverResponseFields.get("in-maint").toString();
+ String pserverPayloadRelationshipList = pserverPayloadFields.get("relationship-list").toString();
+ String pserverResponseRelationshipList = pserverResponseFields.get("relationship-list").toString();
+
+ assertEquals(pserverPayloadHostname, pserverResponseHostname);
+ assertEquals(pserverPayloadInmaint, pserverResponseInmaint);
+ assertEquals(pserverPayloadRelationshipList, pserverResponseRelationshipList);
+ }
+ }
+
+ @Test
+ public void testGetRelationshipWithoutSuppliedRelationship() throws IOException, JSONException {
+ String pserverData = getRelationshipPayload("pserver4");
+ String complexData = getRelationshipPayload("complex4");
+
+ String hostname = "590a8943-1200-43b3-825b-75dde6b8f44d";
+ String physicalLocationId ="e13d4587-19ad-4bf5-80f5-c021efb5b61f";
+
+ String pserverUri = String.format("cloud-infrastructure/pservers/pserver/%s", hostname);
+ String cloudRegionUri = String.format("cloud-infrastructure/complexes/complex/%s", physicalLocationId);
+
+ doSetupResource(pserverUri, pserverData);
+ doSetupResource(cloudRegionUri, complexData);
+
+ String getRelationshipMockRequestUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s/relationship-list", hostname);
+ String getRelationshipUri = String.format(
+ "cloud-infrastructure/pservers/pserver/%s", hostname);
+ MockHttpServletRequest mockReq = new MockHttpServletRequest("GET_RELATIONSHIP", getRelationshipMockRequestUri);
+ Response response = legacyMoxyConsumer.getRelationshipList(
+ "1",
+ "1",
+ schemaVersions.getDefaultVersion().toString(),
+ getRelationshipUri,
+ "false",
+ httpHeaders,
+ uriInfo
+ );
+
+ int code = response.getStatus();
+ if(!VALID_HTTP_STATUS_CODES.contains(code)){
+ System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
+ }
+
+ assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus());
+ }
}
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 1fae4a7..c629ca7 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
@@ -108,7 +108,7 @@ public class RetiredConsumerSpringTest extends AbstractSpringRestTest {
private void setupNamedQueriesRetired() {
httpStatusMap = new HashMap<>();
- httpStatusMap.put("/aai/v8/cloud-infrastructure/pservers/pserver/samomaisdjfajsfoas", HttpStatus.NOT_FOUND);
+ httpStatusMap.put("/aai/v13/cloud-infrastructure/pservers/pserver/samomaisdjfajsfoas", HttpStatus.NOT_FOUND);
httpStatusMap.put("/aai/v8/service-design-and-creation/named-queries/named-query/samomaisdjfajsfoas", HttpStatus.GONE);
}
@@ -130,13 +130,16 @@ public class RetiredConsumerSpringTest extends AbstractSpringRestTest {
httpStatusMap.put("/aai/v4/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
httpStatusMap.put("/aai/v5/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
httpStatusMap.put("/aai/v6/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
+ httpStatusMap.put("/aai/v7/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
+ httpStatusMap.put("/aai/v8/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
+ httpStatusMap.put("/aai/v9/cloud-infrastructure/pservers/pserver/test-pserver1", HttpStatus.GONE);
}
private void setupModelsRetired() {
httpStatusMap = new HashMap<>();
- httpStatusMap.put("/aai/v8/cloud-infrastructure/pservers/pserver/samomaisdjfajsfoas", HttpStatus.NOT_FOUND);
+ httpStatusMap.put("/aai/v8/cloud-infrastructure/pservers/pserver/samomaisdjfajsfoas", HttpStatus.GONE);
httpStatusMap.put("/aai/v8/service-design-and-creation/models/model/samomaisdjfajsfoas", HttpStatus.GONE);
}
diff --git a/aai-resources/src/test/resources/application-test.properties b/aai-resources/src/test/resources/application-test.properties
index ade55fb..55717b9 100644
--- a/aai-resources/src/test/resources/application-test.properties
+++ b/aai-resources/src/test/resources/application-test.properties
@@ -50,9 +50,9 @@ schema.ingest.file=${server.local.startpath}/application.properties
# Schema Version Related Attributes
schema.uri.base.path=/aai
# Lists all of the versions in the schema
-schema.version.list=v8,v9,v10,v11,v12,v13,v14
+schema.version.list=v10,v11,v12,v13,v14,v15
# Specifies from which version should the depth parameter to default to zero
-schema.version.depth.start=v9
+schema.version.depth.start=v10
# Specifies from which version should the related link be displayed in response payload
schema.version.related.link.start=v10
# Specifies from which version should the client see only the uri excluding host info
@@ -63,4 +63,6 @@ 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=v14
+schema.version.api.default=v15
+schema.translator.list=config
+
diff --git a/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties
index bc8b9b9..41862dc 100644
--- a/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties
+++ b/aai-resources/src/test/resources/etc/appprops/aaiconfig.properties
@@ -31,23 +31,23 @@ aai.config.checktime=1000
aai.config.nodename=AutomaticallyOverwritten
aai.server.url.base=https://localhost:8443/aai/
-aai.server.url=https://localhost:8443/aai/v14/
+aai.server.url=https://localhost:8443/aai/v15/
aai.oldserver.url.base=https://localhost:8443/aai/servers/
aai.oldserver.url=https://localhost:8443/aai/servers/v2/
aai.global.callback.url=https://localhost:8443/aai/
-aai.notification.current.version=v14
+aai.notification.current.version=v15
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=v14
+aai.notificationEvent.default.version=v15
# This one lets us enable/disable resource-version checking on updates/deletes
aai.resourceversion.enableflag=true
aai.logging.maxStackTraceEntries=10
-aai.default.api.version=v14
+aai.default.api.version=v15
aai.realtime.clients=RO,SDNC,MSO
diff --git a/aai-resources/src/test/resources/payloads/relationship/complex2.json b/aai-resources/src/test/resources/payloads/relationship/complex2.json
new file mode 100644
index 0000000..19c76df
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/complex2.json
@@ -0,0 +1,16 @@
+{
+ "physical-location-id" : "e13d4587-19ad-4bf5-80f5-c021efb5b61d",
+ "physical-location-type" : "complextype2",
+ "street1" : "NewJerseyWay",
+ "city" : "Middletown",
+ "postal-code" : "07701",
+ "country" : "USA",
+ "region" : "NE",
+ "ctag-pools" : {
+ "ctag-pool" : [ {
+ "target-pe" : "5dbe73c6-cedf-4e68-a7c5-699ba6d90e1e",
+ "availability-zone-name" : "819ec2fa-fb9f-49f0-8fd8-5feb941aad1g",
+ "ctag-pool-purpose" : "4TMeWJ"
+ } ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/complex3.json b/aai-resources/src/test/resources/payloads/relationship/complex3.json
new file mode 100644
index 0000000..c3589bd
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/complex3.json
@@ -0,0 +1,16 @@
+{
+ "physical-location-id" : "e13d4587-19ad-4bf5-80f5-c021efb5b61e",
+ "physical-location-type" : "complextype2",
+ "street1" : "NewJerseyWay",
+ "city" : "Middletown",
+ "postal-code" : "07701",
+ "country" : "USA",
+ "region" : "NE",
+ "ctag-pools" : {
+ "ctag-pool" : [ {
+ "target-pe" : "5dbe73c6-cedf-4e68-a7c5-699ba6d90e1e",
+ "availability-zone-name" : "819ec2fa-fb9f-49f0-8fd8-5feb941aad1g",
+ "ctag-pool-purpose" : "4TMeWJ"
+ } ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/complex4.json b/aai-resources/src/test/resources/payloads/relationship/complex4.json
new file mode 100644
index 0000000..3535320
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/complex4.json
@@ -0,0 +1,16 @@
+{
+ "physical-location-id" : "e13d4587-19ad-4bf5-80f5-c021efb5b61f",
+ "physical-location-type" : "complextype2",
+ "street1" : "NewJerseyWay",
+ "city" : "Middletown",
+ "postal-code" : "07701",
+ "country" : "USA",
+ "region" : "NE",
+ "ctag-pools" : {
+ "ctag-pool" : [ {
+ "target-pe" : "5dbe73c6-cedf-4e68-a7c5-699ba6d90e1e",
+ "availability-zone-name" : "819ec2fa-fb9f-49f0-8fd8-5feb941aad1g",
+ "ctag-pool-purpose" : "4TMeWJ"
+ } ]
+ }
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list2.json b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list2.json
new file mode 100644
index 0000000..09dfb95
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list2.json
@@ -0,0 +1 @@
+{"relationship":[{"related-to":"complex","relationship-label":"org.onap.relationships.inventory.LocatedIn","related-link":"/aai/v15/cloud-infrastructure/complexes/complex/e13d4587-19ad-4bf5-80f5-c021efb5b61d","relationship-data":[{"relationship-key":"complex.physical-location-id","relationship-value":"e13d4587-19ad-4bf5-80f5-c021efb5b61d"}]}]} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list3.json b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list3.json
new file mode 100644
index 0000000..3e62e42
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship-list3.json
@@ -0,0 +1 @@
+{"results":[{"pserver":{"hostname":"590a8943-1200-43b3-825b-75dde6b8f44c","in-maint":false,"resource-version":"1544562911222","relationship-list":{"relationship":[{"related-to":"complex","relationship-label":"org.onap.relationships.inventory.LocatedIn","related-link":"/aai/v15/cloud-infrastructure/complexes/complex/e13d4587-19ad-4bf5-80f5-c021efb5b61e","relationship-data":[{"relationship-key":"complex.physical-location-id","relationship-value":"e13d4587-19ad-4bf5-80f5-c021efb5b61e"}]}]}}}]} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship2.json b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship2.json
new file mode 100644
index 0000000..b9cca14
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship2.json
@@ -0,0 +1,8 @@
+{
+ "related-to" : "complex",
+ "related-link" : "/aai/v11/cloud-infrastructure/complexes/complex/e13d4587-19ad-4bf5-80f5-c021efb5b61d",
+ "relationship-data" : [{
+ "relationship-key" : "complex.physical-location-id",
+ "relationship-value" : "e13d4587-19ad-4bf5-80f5-c021efb5b61d"
+ }]
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship3.json b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship3.json
new file mode 100644
index 0000000..f28fc5c
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver-complex-relationship3.json
@@ -0,0 +1,8 @@
+{
+ "related-to" : "complex",
+ "related-link" : "/aai/v11/cloud-infrastructure/complexes/complex/e13d4587-19ad-4bf5-80f5-c021efb5b61e",
+ "relationship-data" : [{
+ "relationship-key" : "complex.physical-location-id",
+ "relationship-value" : "e13d4587-19ad-4bf5-80f5-c021efb5b61d"
+ }]
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver2.json b/aai-resources/src/test/resources/payloads/relationship/pserver2.json
new file mode 100644
index 0000000..cb40bed
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver2.json
@@ -0,0 +1,4 @@
+{
+ "hostname" : "590a8943-1200-43b3-825b-75dde6b8f44b",
+ "in-maint" : false
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver3.json b/aai-resources/src/test/resources/payloads/relationship/pserver3.json
new file mode 100644
index 0000000..bf6b6fd
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver3.json
@@ -0,0 +1,4 @@
+{
+ "hostname" : "590a8943-1200-43b3-825b-75dde6b8f44c",
+ "in-maint" : false
+} \ No newline at end of file
diff --git a/aai-resources/src/test/resources/payloads/relationship/pserver4.json b/aai-resources/src/test/resources/payloads/relationship/pserver4.json
new file mode 100644
index 0000000..0143ea2
--- /dev/null
+++ b/aai-resources/src/test/resources/payloads/relationship/pserver4.json
@@ -0,0 +1,4 @@
+{
+ "hostname" : "590a8943-1200-43b3-825b-75dde6b8f44d",
+ "in-maint" : false
+} \ No newline at end of file