aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'aai-resources/src/main')
-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
21 files changed, 373 insertions, 105 deletions
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