summaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main/scripts
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2018-01-30 13:52:34 -0500
committerVenkata Harish K Kajur <vk250x@att.com>2018-02-28 11:36:08 -0500
commit4f13d6cc64eed0ef75a31ec5f490853267447ab1 (patch)
treecb7066e12fc39038cc99b74bbeba879c9eb6ca8c /aai-resources/src/main/scripts
parent73539cae6d24e352b84a6411e523da734fbc19e2 (diff)
Turn ajsc 2 to using ajsc 6 spring boot
Issue-ID: AAI-800 Change-Id: Id174ec5088ddea57f18e605d004c417bee8fbf33 Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-resources/src/main/scripts')
-rw-r--r--aai-resources/src/main/scripts/audit_schema.sh33
-rw-r--r--aai-resources/src/main/scripts/common_functions.sh56
-rw-r--r--aai-resources/src/main/scripts/createDBSchema.sh27
-rw-r--r--aai-resources/src/main/scripts/deleteTool.sh4
-rw-r--r--aai-resources/src/main/scripts/dupeTool.sh73
-rw-r--r--aai-resources/src/main/scripts/dynamicPayloadArchive.sh7
-rw-r--r--aai-resources/src/main/scripts/dynamicPayloadGenerator.sh42
-rw-r--r--aai-resources/src/main/scripts/edgeTagger.sh40
-rw-r--r--aai-resources/src/main/scripts/forceDeleteTool.sh32
-rw-r--r--aai-resources/src/main/scripts/getTool.sh6
-rw-r--r--aai-resources/src/main/scripts/install/addManualData.sh14
-rw-r--r--aai-resources/src/main/scripts/putTool.sh8
-rw-r--r--aai-resources/src/main/scripts/rshipTool.sh10
-rw-r--r--aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh51
-rw-r--r--aai-resources/src/main/scripts/run_FixXSD.sh69
-rw-r--r--aai-resources/src/main/scripts/run_Migrations.sh81
16 files changed, 248 insertions, 305 deletions
diff --git a/aai-resources/src/main/scripts/audit_schema.sh b/aai-resources/src/main/scripts/audit_schema.sh
index e0d0143..70aa535 100644
--- a/aai-resources/src/main/scripts/audit_schema.sh
+++ b/aai-resources/src/main/scripts/audit_schema.sh
@@ -21,29 +21,12 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-if [ -f "/etc/profile.d/aai.sh" ]; then
- source /etc/profile.d/aai.sh
-else
- echo "File not found: /etc/profile.d/aai.sh";
- exit
-fi
-
-JAVA=$JAVA_HOME/bin/java
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-$JAVA -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -cp $CLASSPATH org.onap.aai.db.schema.ScriptDriver $@
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.db.schema.ScriptDriver "" "$@"
+end_date;
+exit 0
diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh
new file mode 100644
index 0000000..853941c
--- /dev/null
+++ b/aai-resources/src/main/scripts/common_functions.sh
@@ -0,0 +1,56 @@
+#!/bin/ksh
+
+# Common functions that can be used throughout multiple scripts
+# In order to call these functions, this file needs to be sourced
+
+# Checks if the user that is currently running is aaiadmin
+check_user(){
+
+ userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+
+ if [ "${userid}" != "aaiadmin" ]; then
+ echo "You must be aaiadmin to run $0. The id used $userid."
+ exit 1
+ fi
+}
+
+# Sources the profile and sets the project home
+source_profile(){
+ . /etc/profile.d/aai.sh
+ PROJECT_HOME=/opt/app/aai-resources
+}
+
+# Runs the spring boot jar based on which main class
+# to execute and which logback file to use for that class
+execute_spring_jar(){
+
+ className=$1;
+ logbackFile=$2;
+
+ shift 2;
+
+ EXECUTABLE_JAR=$(ls ${PROJECT_HOME}/lib/*.jar);
+
+ JAVA_OPTS="${JAVA_PRE_OPTS}";
+ JAVA_OPTS="-DAJSC_HOME=$PROJECT_HOME";
+ JAVA_OPTS="$JAVA_OPTS -DBUNDLECONFIG_DIR=resources";
+ JAVA_OPTS="$JAVA_OPTS -Daai.home=$PROJECT_HOME ";
+ JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2";
+ JAVA_OPTS="$JAVA_OPTS -Dloader.main=${className}";
+ JAVA_OPTS="$JAVA_OPTS -Dlogback.configurationFile=${logbackFile}";
+ JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
+
+ ${JAVA_HOME}/bin/java ${JVM_OPTS} ${JAVA_OPTS} -jar ${EXECUTABLE_JAR} "$@"
+}
+
+# Prints the start date and the script that the user called
+start_date(){
+ echo
+ echo `date` " Starting $0"
+}
+
+# Prints the end date and the script that the user called
+end_date(){
+ echo
+ echo `date` " Done $0"
+}
diff --git a/aai-resources/src/main/scripts/createDBSchema.sh b/aai-resources/src/main/scripts/createDBSchema.sh
index 56f0fcc..491a89c 100644
--- a/aai-resources/src/main/scripts/createDBSchema.sh
+++ b/aai-resources/src/main/scripts/createDBSchema.sh
@@ -30,24 +30,11 @@
# Ie. createDbSchema.sh GEN_DB_WITH_NO_SCHEMA
#
-echo
-echo `date` " Starting $0"
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
-
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DBUNDLECONFIG_DIR=bundleconfig -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/createDBSchema-logback.xml org.onap.aai.dbgen.GenTester $1
-
-echo `date` " Done $0"
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.dbgen.GenTester ${PROJECT_HOME}/resources/etc/appprops/createDBSchema-logback.xml "$@"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh
index b9ee8b0..3d7f923 100644
--- a/aai-resources/src/main/scripts/deleteTool.sh
+++ b/aai-resources/src/main/scripts/deleteTool.sh
@@ -65,7 +65,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -95,7 +95,7 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
diff --git a/aai-resources/src/main/scripts/dupeTool.sh b/aai-resources/src/main/scripts/dupeTool.sh
new file mode 100644
index 0000000..f088d5b
--- /dev/null
+++ b/aai-resources/src/main/scripts/dupeTool.sh
@@ -0,0 +1,73 @@
+#!/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=========================================================
+###
+
+#
+# dupeTool.sh -- This tool is used to look at or fix duplicate nodes for one nodeType
+# at a time and can be used to limit what it's looking at to just nodes created
+# within a recent time window.
+# It is made to deal with situations (like we have in 1610/1702) where one type
+# of node keeps needing to have duplicates cleaned up (tenant nodes).
+# It is needed because DataGrooming cannot be run often and cannot be focused just
+# on duplicates or just on one nodeType.
+#
+# Parameters:
+#
+# -userId (required) must be followed by a userid
+# -nodeType (required) must be followed by a valid nodeType
+# -timeWindowMinutes (optional) by default we would look at all nodes of the
+# given nodeType, but if a window is given, then we will only look at
+# nodes created that many (or fewer) minutes ago.
+# -autoFix (optional) use this if you want duplicates fixed automatically (if we
+# can figure out which to delete)
+# -maxFix (optional) like with dataGrooming lets you override the default maximum
+# number of dupes that can be processed at one time
+# -skipHostCheck (optional) By default, the dupe tool will check to see that it is running
+# on the host that is the first one in the list found in:
+# aaiconfig.properties aai.primary.filetransfer.serverlist
+# This is so that when run from the cron, it only runs on one machine.
+# This option lets you turn that checking off.
+# -sleepMinutes (optional) like with DataGrooming, you can override the
+# sleep time done when doing autoFix between first and second checks of the data.
+# -params4Collect (optional) followed by a string to tell what properties/values to use
+# to limit the nodes being looked at. Must be in the format
+# of “propertName|propValue” use commas to separate if there
+# are more than one name/value being passed.
+# -specialTenantRule (optional) turns on logic which will use extra logic to figure
+# out which tenant node can be deleted in a common scenario.
+#
+#
+# For example (there are many valid ways to use it):
+#
+# dupeTool.sh -userId am8383 -nodeType tenant -timeWindowMinutes 60 -autoFix
+# or
+# dupeTool.sh -userId am8383 -nodeType tenant -specialTenantRule -autoFix -maxFix 100
+#
+
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.dbgen.DupeTool ${PROJECT_HOME}/resources/etc/appprops/dupeTool-logback.xml "$@"
+end_date;
+exit 0
diff --git a/aai-resources/src/main/scripts/dynamicPayloadArchive.sh b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
index f17f679..75d75d4 100644
--- a/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
+++ b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
@@ -21,10 +21,13 @@
###
#
-# The script is called to tar and gzip the files under /opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation which are the payload files created by the dynamicPayloadGenerator.sh tool.
+# The script is called to tar and gzip the files under /opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation which are the payload files created by the dynamicPayloadGenerator.sh tool.
#
#
+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
@@ -38,7 +41,7 @@ if [ "${userid}" != $CHECK_USER ]; then
echo "You must be $CHECK_USER to run $0. The id used $userid."
exit 1
fi
-DIRECTORY=${PROJECT_HOME}/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation
+DIRECTORY=${PROJECT_HOME}/resources/etc/scriptdata/addmanualdata/tenant_isolation
if [ ! -d ${DIRECTORY} ]
then
echo " ${DIRECTORY} doesn't exist"
diff --git a/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
index c386bed..6d46546 100644
--- a/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
+++ b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
@@ -38,11 +38,11 @@
#
# For example (there are many valid ways to use it):
#
-# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/'
+# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/'
#
# or
-# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/bundleconfig/etc/appprops/dynamic.properties'
-# -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/bundleconfig/etc/scriptdata/nodes.json'
+# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/resources/etc/appprops/dynamic.properties'
+# -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/resources/etc/scriptdata/nodes.json'
#
@@ -63,10 +63,10 @@ display_usage() {
c. -f (optional) PAYLOAD or DMAAP-MR
d. -n (optional) input file for the script
4. For example (there are many valid ways to use it):
- dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/'
+ dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/'
- dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/bundleconfig/etc/appprops/dynamic.properties'
- -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/bundleconfig/etc/scriptdata/nodes.json'
+ dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/resources/etc/appprops/dynamic.properties'
+ -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/resources/etc/scriptdata/nodes.json'
EOF
}
@@ -75,27 +75,13 @@ if [ $# -eq 0 ]; then
exit 1
fi
+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
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DBUNDLECONFIG_DIR=bundleconfig -DAJSC_HOME=$PROJECT_HOME \
- -Daai.home=$PROJECT_HOME -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/dynamicPayloadGenerator-logback.xml -Xmx9000m -Xms9000m \
- org.onap.aai.dbgen.DynamicPayloadGenerator "$@"
-
-
-echo `date` " Done $0"
-
+start_date;
+check_user;
+source_profile;
+export JVM_OPTS="-Xmx9000m -Xms9000m"
+execute_spring_jar org.onap.aai.dbgen.DynamicPayloadGenerator ${PROJECT_HOME}/resources/etc/appprops/dynamicPayloadGenerator-logback.xml "$@"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/edgeTagger.sh b/aai-resources/src/main/scripts/edgeTagger.sh
index b2bfcb9..abb3428 100644
--- a/aai-resources/src/main/scripts/edgeTagger.sh
+++ b/aai-resources/src/main/scripts/edgeTagger.sh
@@ -62,37 +62,25 @@
# or ./edgeTagger.sh "complex|ctag-pool"
#
-echo
-echo `date` " Starting $0"
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+start_date;
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+echo " NOTE - if you are deleting data, please run the dataSnapshot.sh script first or "
+echo " at least make a note the details of the node that you are deleting. "
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+check_user;
+source_profile;
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+execute_spring_jar org.onap.aai.dbgen.UpdateEdgeTags "" "$@"
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+PROCESS_STATUS=$?;
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME \
- -Dcom.att.eelf.logging.file=default-logback.xml -Dcom.att.eelf.logging.path="$PROJECT_HOME/bundleconfig/etc/appprops/" \
- org.onap.aai.dbgen.UpdateEdgeTags $1
-if [ "$?" -ne "0" ]; then
- echo "Problem executing UpdateEdgeTags "
- exit 1
-fi
+if [ ${PROCESS_STATUS} -ne 0 ]; then
+ echo "Problem executing UpdateEdgeTags";
+ exit 1;
+fi;
-
-echo `date` " Done $0"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/forceDeleteTool.sh b/aai-resources/src/main/scripts/forceDeleteTool.sh
index 9c199bc..cb87b38 100644
--- a/aai-resources/src/main/scripts/forceDeleteTool.sh
+++ b/aai-resources/src/main/scripts/forceDeleteTool.sh
@@ -66,37 +66,19 @@
#
#
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-echo
-echo `date` " Starting $0"
+start_date;
echo " NOTE - if you are deleting data, please run the dataSnapshot.sh script first or "
echo " at least make a note the details of the node that you are deleting. "
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+check_user;
+source_profile;
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+execute_spring_jar org.onap.aai.dbgen.ForceDeleteTool ${PROJECT_HOME}/resources/etc/appprops/forceDelete-logback.xml "$@"
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME \
- org.onap.aai.dbgen.ForceDeleteTool "$@"
-
-
-echo `date` " Done $0"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh
index 8d006b0..3f61ab1 100644
--- a/aai-resources/src/main/scripts/getTool.sh
+++ b/aai-resources/src/main/scripts/getTool.sh
@@ -60,7 +60,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -91,11 +91,11 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
RC=$?;
else
echo "usage: $0 resource"
diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh
index 930b9ba..9a5bb59 100644
--- a/aai-resources/src/main/scripts/install/addManualData.sh
+++ b/aai-resources/src/main/scripts/install/addManualData.sh
@@ -22,7 +22,7 @@
# this script now requires a release parameter.
# the tool finds and sorts *.txt files within the
-# bundleconfig/etc/scriptdate/addmanualdata/$release directory containing
+# resources/etc/scriptdata/addmanualdata/$release directory containing
# one resource to be added to the graph. The directory contains a second
# file with the same name, but the extension is .json. This json file
# is passed to the PutTool as the payload. The parameters passed to the
@@ -77,15 +77,15 @@ k=0
if [ "$1" = "tenant_isolation" ]
then
- CR_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f`
- AZ_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f`
- COMPLEX_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f`
- ZONE_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f`
- PSERVER_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f`
+ CR_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f`
+ AZ_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f`
+ COMPLEX_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f`
+ ZONE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f`
+ PSERVER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f`
TEXT_PATH="${CR_TEXT_PATH} ${AZ_TEXT_PATH} ${COMPLEX_TEXT_PATH} ${ZONE_TEXT_PATH} ${PSERVER_TEXT_PATH}"
COMMAND=${TEXT_PATH}
else
- TEXT_PATH=$PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/*/*.txt
+ TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt
COMMAND=`ls ${TEXT_PATH} | sort -f`
fi
diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh
index b5ad862..46696b2 100644
--- a/aai-resources/src/main/scripts/putTool.sh
+++ b/aai-resources/src/main/scripts/putTool.sh
@@ -84,7 +84,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -121,15 +121,15 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
if [ $RETURNRESPONSE = true ]; then
- curl --request PUT -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE | python -mjson.tool
+ curl --request PUT -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T /tmp/$(basename $JSONFILE) $RESTURL$RESOURCE | jq '.'
RC=$?
else
- result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE`
+ result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T /tmp/$(basename $JSONFILE) $RESTURL$RESOURCE`
#echo "result is $result."
RC=0;
if [ $? -eq 0 ]; then
diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh
index 8decd04..3952d44 100644
--- a/aai-resources/src/main/scripts/rshipTool.sh
+++ b/aai-resources/src/main/scripts/rshipTool.sh
@@ -113,7 +113,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -144,12 +144,12 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
- RESOURCEVERSION=$(curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -c "import sys, json; print json.load(sys.stdin)['resource-version']")
+ RESOURCEVERSION=$(curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq -r '.["resource-version"]')
if [ $ACTION = "PUT" ]; then
result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE$RELATIONSHIP?$RESOURCEVERSION`
#echo "result is $result."
@@ -161,7 +161,7 @@ if [ $MISSING_PROP = false ]; then
if [[ "$result" -ge 200 && $result -lt 300 ]]
then
echo "PUT result is OK, $result"
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
else
if [ -z $ALLOWHTTPRESPONSES ]; then
echo "PUT request failed, response code was $result"
@@ -198,7 +198,7 @@ if [ $MISSING_PROP = false ]; then
if [[ "$result" -ge 200 && $result -lt 300 ]]
then
echo "DELETE result is OK, $result"
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
else
echo "failed DELETE request, response code was $result"
RC=$result
diff --git a/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
index b3a3ac4..6e6ac6f 100644
--- a/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
+++ b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
@@ -1,15 +1,16 @@
#!/bin/ksh
-#
+
+###
# ============LICENSE_START=======================================================
# org.onap.aai
# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# 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
+# 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,
@@ -17,39 +18,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-#
-# This script invokes the dataSnapshot java class passing an option to tell it to take
-# a snapshot of the database and store it as a single-line XML file.
-#
-
-echo
-echo `date` " Starting $0"
-
-
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+###
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+start_date;
+check_user;
+source_profile;
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME org.onap.aai.util.DbTestProcessBuilder "$@"
+CERTPATH=$PROJECT_HOME/resources/etc/auth/
+KEYNAME=aaiClientPrivateKey.pem
+CERTNAME=aaiClientPublicCert.pem
-echo `date` " Done $0"
+pw=$(execute_spring_jar org.onap.aai.util.AAIConfigCommandLinePropGetter "" "aai.keystore.passwd" 2> /dev/null | tail -1)
+openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$CERTNAME -clcerts -nokeys -passin pass:$pw
+openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$KEYNAME -nocerts -nodes -passin pass:$pw
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/run_FixXSD.sh b/aai-resources/src/main/scripts/run_FixXSD.sh
deleted file mode 100644
index 40ffb81..0000000
--- a/aai-resources/src/main/scripts/run_FixXSD.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/ksh
-#
-# ============LICENSE_START=======================================================
-# org.onap.aai
-# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-#
-# The script invokes GetResource java class to get all nodes
-#
-
-echo
-echo `date` " Starting $0"
-
-REV=$1
-AAIHOME=$2
-echo "AAIHOME: $AAIHOME"
-
-if test "$REV" = ""
-then
- REV=v6
-fi
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
-
-if test "$AAIHOME" = ""
-then
- AAIHOME=$PROJECT_HOME
-fi
-
-
-for JAR in `ls $AAIHOME/target/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-export REV=$REV
-echo "FixXSD $REV $AAIHOME"
-$JAVA_HOME/bin/java -classpath $CLASSPATH -DAJSC_HOME=$AAIHOME org.onap.aai.util.FixXSDNew $REV
-ret_code=$?
-if [ $ret_code != 0 ]; then
- echo `date` " Done $0"
- exit $ret_code
-fi
-
-echo `date` " Done $0"
-exit 0
diff --git a/aai-resources/src/main/scripts/run_Migrations.sh b/aai-resources/src/main/scripts/run_Migrations.sh
index 7f0ea08..1309094 100644
--- a/aai-resources/src/main/scripts/run_Migrations.sh
+++ b/aai-resources/src/main/scripts/run_Migrations.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
###
# ============LICENSE_START=======================================================
@@ -20,57 +20,28 @@
# ============LICENSE_END=========================================================
###
-echo
-echo $(date) " Starting $0"
-
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
-
-if [ -f "/etc/profile.d/aai.sh" ]; then
- source /etc/profile.d/aai.sh
-else
- echo "File not found: /etc/profile.d/aai.sh";
- exit
-fi
-
-JAVA=$JAVA_HOME/bin/java
-PROJECT_HOME=/opt/app/aai-resources
-
-ARGS="-c ${PROJECT_HOME}/bundleconfig/etc/appprops/titan-realtime.properties $@"
-
-for JAR in $(ls $PROJECT_HOME/extJars/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-UUID=$(uuidgen)
-
-unzip -o $PROJECT_HOME/lib/ajsc-runner-5.0.0-RC16.0.5.jar -d /tmp/ajsc-war-$UUID/ > /dev/null
-unzip -o /tmp/ajsc-war-$UUID/ajsc-war-5.0.0-RC16.0.5.war -d /tmp/ajsc-war-$UUID/ > /dev/null
-
-for JAR in $(ls /tmp/ajsc-war-$UUID/WEB-INF/lib/*.jar)
-do
- if [[ ! "$JAR" =~ .*logback-classic-.*.jar ]];
- then
- CLASSPATH=$CLASSPATH:$JAR
- fi
-done
-
-for JAR in $(ls /opt/app/swm/dme2/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in $(ls $PROJECT_HOME/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-CLASSPATH=$CLASSPATH:${PROJECT_HOME}"/bundleconfig/etc/tmp-config/"
-
-$JAVA -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -DBUNDLECONFIG_DIR="bundleconfig" -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/migration-logback.xml -cp $CLASSPATH org.onap.aai.migration.MigrationController $ARGS
-
-rm -r /tmp/ajsc-war-$UUID/
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+# TODO: There is a better way where you can pass in the function
+# and then let the common functions check if the function exist and invoke it
+# So this all can be templated out
+start_date;
+check_user;
+source_profile;
+
+ARGS="-c ${PROJECT_HOME}/resources/etc/appprops/titan-realtime.properties";
+
+if [ -f "$PROJECT_HOME/resources/application.properties" ]; then
+ # Get the application properties file and look for all lines
+ # starting with either jms dmaap or niws
+ # Turn them into system properties and export JAVA_PRE_OPTS so
+ # execute spring jar will get those values
+ # This is only needed since dmaap is used by run_migrations
+ JAVA_PRE_OPTS=$(egrep '^(dmaap|jms|niws)' $PROJECT_HOME/resources/application.properties | sed 's/^\(.*\)$/-D\1/g' | tr '\n' ' ');
+ export JAVA_PRE_OPTS;
+fi;
+
+execute_spring_jar org.onap.aai.migration.MigrationController ${PROJECT_HOME}/resources/etc/appprops/migration-logback.xml ${ARGS} "$@"
+end_date;
+exit 0