From 9666d712661e58fa4918f9c49d03fde6f4434e07 Mon Sep 17 00:00:00 2001 From: "LaMont, William (wl2432)" Date: Fri, 26 Jun 2020 17:24:51 -0400 Subject: support for v20 Issue-ID: AAI-2965 Change-Id: I87737d2cfcf6b499af6083c2355042d66278e73c Signed-off-by: LaMont, William (wl2432) --- aai-resources/src/main/assembly/descriptor.xml | 3 +++ .../src/main/java/org/onap/aai/rest/BulkConsumer.java | 3 +-- .../main/java/org/onap/aai/rest/LegacyMoxyConsumer.java | 12 +++++++----- .../java/org/onap/aai/rest/URLFromVertexIdConsumer.java | 5 +++-- aai-resources/src/main/resources/application.properties | 3 +++ .../src/main/resources/etc/appprops/aaiconfig.properties | 10 ++++++---- .../src/main/resources/etc/appprops/error.properties | 1 + aai-resources/src/main/scripts/bulkprocess.sh | 14 +++++++++----- aai-resources/src/main/scripts/common_functions.sh | 1 - aai-resources/src/main/scripts/deleteTool.sh | 2 +- aai-resources/src/main/scripts/getTool.sh | 2 +- aai-resources/src/main/scripts/install/addManualData.sh | 1 - aai-resources/src/main/scripts/putTool.sh | 2 +- aai-resources/src/main/scripts/rshipTool.sh | 2 +- aai-resources/src/main/scripts/updateTool.sh | 2 +- aai-resources/src/main/scripts/vmExportCloudRegions.sh | 2 +- aai-resources/src/main/scripts/vmUpdateExport.sh | 5 ++--- aai-resources/src/main/scripts/vmValidateCloudRegions.sh | 2 +- 18 files changed, 42 insertions(+), 30 deletions(-) (limited to 'aai-resources/src/main') diff --git a/aai-resources/src/main/assembly/descriptor.xml b/aai-resources/src/main/assembly/descriptor.xml index 08e253f..1c3d166 100644 --- a/aai-resources/src/main/assembly/descriptor.xml +++ b/aai-resources/src/main/assembly/descriptor.xml @@ -13,6 +13,7 @@ **/* + 755 ${project.basedir}/src/main/scripts @@ -20,6 +21,7 @@ **/* + 777 ${project.build.directory} @@ -27,6 +29,7 @@ ${project.artifactId}-${project.version}.jar + 755 diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java index 3f595d1..4bd1a0d 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java @@ -354,8 +354,7 @@ public abstract class BulkConsumer extends RESTAPI { throw new AAIException("AAI_6111", String.format("input payload does not follow %s interface", module)); } } - - Gson gson = new Gson(); + Gson gson = new GsonBuilder().serializeNulls().create(); String bodyStr = gson.toJson(bodyObj); bulkOperation.setRawReq(bodyStr); 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 e6dcc77..8939d04 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 @@ -227,7 +227,8 @@ public class LegacyMoxyConsumer extends RESTAPI { SchemaVersion version = new SchemaVersion(versionParam); final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - traversalUriHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + traversalUriHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = traversalUriHttpEntry.getDbEngine(); loader = traversalUriHttpEntry.getLoader(); MultivaluedMap params = info.getQueryParameters(); @@ -438,7 +439,7 @@ public class LegacyMoxyConsumer extends RESTAPI { @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) { + 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 HttpServletRequest req,@Context UriInfo info) { return runner(AAIConstants.AAI_CRUD_TIMEOUT_ENABLED, AAIConstants.AAI_CRUD_TIMEOUT_APP, AAIConstants.AAI_CRUD_TIMEOUT_LIMIT, @@ -448,7 +449,7 @@ public class LegacyMoxyConsumer extends RESTAPI { new AaiCallable() { @Override public Response process() { - return getRelationshipList(versionParam, uri, cleanUp, headers, info, resultIndex, resultSize); + return getRelationshipList(versionParam, req, uri, cleanUp, headers, info, resultIndex, resultSize); } } ); @@ -463,7 +464,7 @@ public class LegacyMoxyConsumer extends RESTAPI { * @param info * @return */ - public Response getRelationshipList(String versionParam, String uri, String cleanUp, HttpHeaders headers, UriInfo info, String resultIndex, String resultSize) { + public Response getRelationshipList(String versionParam, HttpServletRequest req, 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"); Response response = null; @@ -475,7 +476,8 @@ public class LegacyMoxyConsumer extends RESTAPI { SchemaVersion version = new SchemaVersion(versionParam); final HttpEntry traversalUriHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - traversalUriHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + traversalUriHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = traversalUriHttpEntry.getDbEngine(); loader = traversalUriHttpEntry.getLoader(); MultivaluedMap params = info.getQueryParameters(); diff --git a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java index 041952b..9293569 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java @@ -74,7 +74,8 @@ public class URLFromVertexIdConsumer extends RESTAPI { TransactionalGraphEngine dbEngine = null; try { HttpEntry resourceHttpEntry = SpringContextAware.getBean("traversalUriHttpEntry", HttpEntry.class); - resourceHttpEntry.setHttpEntryProperties(version); + String serverBase = req.getRequestURL().toString().replaceAll("/(v[0-9]+|latest)/.*", "/"); + resourceHttpEntry.setHttpEntryProperties(version, serverBase); dbEngine = resourceHttpEntry.getDbEngine(); DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth); @@ -88,7 +89,7 @@ public class URLFromVertexIdConsumer extends RESTAPI { result.append(uri.getRawPath()); result.insert(0, version); - result.insert(0, AAIConfig.get("aai.server.url.base")); + result.insert(0, serverBase); response = Response.ok().entity(result.toString()).status(Status.OK).type(MediaType.TEXT_PLAIN).build(); } catch (AAIException e) { //TODO check that the details here are sensible diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties index 7dee2b2..e26199c 100644 --- a/aai-resources/src/main/resources/application.properties +++ b/aai-resources/src/main/resources/application.properties @@ -40,10 +40,13 @@ server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) server.ssl.client-auth=want server.ssl.key-store-type=JKS +null.db.serialization.enabled=true + # JMS bind address host port jms.bind.address=tcp://localhost:61647 dmaap.ribbon.listOfServers=localhost:3904 + # Schema related attributes for the oxm and edges # Any additional schema related attributes should start with prefix schema schema.configuration.location=N/A diff --git a/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties index f53fca0..42fbbfc 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/v19/ +aai.server.url=https://localhost:8443/aai/v20/ 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=v19 +aai.notification.current.version=v20 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=v19 +aai.notificationEvent.default.version=v20 # This one lets us enable/disable resource-version checking on updates/deletes aai.resourceversion.enableflag=true aai.logging.maxStackTraceEntries=10 -aai.default.api.version=v19 +aai.default.api.version=v20 # Used by Model-processing code aai.model.delete.sleep.per.vtx.msec=500 @@ -156,3 +156,5 @@ aai.implied.delete.log.enabled=false ################################################################################# aai.implied.delete.whitelist.sdnc='vce' aai.implied.delete.whitelist.ro='vserver' + +property.null.validation.enabled=true \ 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 b2dc448..6e5630c 100644 --- a/aai-resources/src/main/resources/etc/appprops/error.properties +++ b/aai-resources/src/main/resources/etc/appprops/error.properties @@ -125,6 +125,7 @@ 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:300 AAI_6148=5:4:ERROR:6148:400:3000:More than one node found %1:300 AAI_6149=5:4:ERROR:6149:404:3000:No relationship was found:300 +AAI_6150=5:4:ERROR:6150:200:3000:DB object with required field serialized with empty or null value #--- aaicsvp: 7101-7199 AAI_7101=5:4:ERROR:7101:500:3002:Unexpected error in CSV file processing:900 diff --git a/aai-resources/src/main/scripts/bulkprocess.sh b/aai-resources/src/main/scripts/bulkprocess.sh index c4bca27..7366bf2 100644 --- a/aai-resources/src/main/scripts/bulkprocess.sh +++ b/aai-resources/src/main/scripts/bulkprocess.sh @@ -29,12 +29,16 @@ inputFolder=$1 if [ -z "$1" ]; then echo "Input folder string is empty." - exit 1 + exit 1 fi -if [ ! -d "/opt/bulkprocess_load/$1" ]; then - echo "Input folder could not be found." - exit 1 +if [ ! -d "$inputFolder" ]; then + if [ ! -d "/opt/bulkprocess_load/$1" ]; then + echo "Input folder could not be found." + exit 1 + else + inputFolder="/opt/bulkprocess_load/$1" + fi fi XFROMAPPID=$2 @@ -50,7 +54,7 @@ esac XTRANSID=$3 -for input_file in $(ls -v /opt/bulkprocess_load/${inputFolder}/*); +for input_file in $(ls -v ${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; diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh index 14358d9..d5bebac 100644 --- a/aai-resources/src/main/scripts/common_functions.sh +++ b/aai-resources/src/main/scripts/common_functions.sh @@ -36,7 +36,6 @@ check_user(){ # Sources the profile and sets the project home source_profile(){ - . /etc/profile.d/aai.sh PROJECT_HOME=/opt/app/aai-resources } diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh index 3d7f923..c2dc05c 100644 --- a/aai-resources/src/main/scripts/deleteTool.sh +++ b/aai-resources/src/main/scripts/deleteTool.sh @@ -63,7 +63,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh index e2ca220..8ff502b 100644 --- a/aai-resources/src/main/scripts/getTool.sh +++ b/aai-resources/src/main/scripts/getTool.sh @@ -58,7 +58,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh index bd7f7bd..645f7c8 100644 --- a/aai-resources/src/main/scripts/install/addManualData.sh +++ b/aai-resources/src/main/scripts/install/addManualData.sh @@ -43,7 +43,6 @@ contains() { fi } -. /etc/profile.d/aai.sh PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh index 4e55b0c..bc84010 100644 --- a/aai-resources/src/main/scripts/putTool.sh +++ b/aai-resources/src/main/scripts/putTool.sh @@ -90,7 +90,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh index 3952d44..3ee1c04 100644 --- a/aai-resources/src/main/scripts/rshipTool.sh +++ b/aai-resources/src/main/scripts/rshipTool.sh @@ -111,7 +111,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh index ce0a8f6..347640e 100644 --- a/aai-resources/src/main/scripts/updateTool.sh +++ b/aai-resources/src/main/scripts/updateTool.sh @@ -94,7 +94,7 @@ if [ "${userid}" != "aaiadmin" ]; then exit 1 fi -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc diff --git a/aai-resources/src/main/scripts/vmExportCloudRegions.sh b/aai-resources/src/main/scripts/vmExportCloudRegions.sh index 95ec969..a8d14e3 100644 --- a/aai-resources/src/main/scripts/vmExportCloudRegions.sh +++ b/aai-resources/src/main/scripts/vmExportCloudRegions.sh @@ -337,7 +337,7 @@ addValidateVserver() { COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P ) . ${COMMON_ENV_PATH}/common_functions.sh -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/vmUpdateExport.sh b/aai-resources/src/main/scripts/vmUpdateExport.sh index f492d2c..6bd4ca9 100644 --- a/aai-resources/src/main/scripts/vmUpdateExport.sh +++ b/aai-resources/src/main/scripts/vmUpdateExport.sh @@ -21,8 +21,7 @@ ### # -# vmUpdateExport.sh -- This tool updates the files generated in A&AI to -# match what is expected in narad +# vmUpdateExport.sh -- This tool updates the files generated in A&AI # The script takes no arguments addTemplates() { @@ -33,7 +32,7 @@ addTemplates() { COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P ) . ${COMMON_ENV_PATH}/common_functions.sh -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) diff --git a/aai-resources/src/main/scripts/vmValidateCloudRegions.sh b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh index a8189e3..b7e30ee 100644 --- a/aai-resources/src/main/scripts/vmValidateCloudRegions.sh +++ b/aai-resources/src/main/scripts/vmValidateCloudRegions.sh @@ -56,7 +56,7 @@ renamefiles() { } -. /etc/profile.d/aai.sh + PROJECT_HOME=/opt/app/aai-resources PROGNAME=$(basename $0) -- cgit 1.2.3-korg