diff options
Diffstat (limited to 'aai-resources/src/main/scripts')
17 files changed, 419 insertions, 0 deletions
diff --git a/aai-resources/src/main/scripts/PropertyChangeName.sh b/aai-resources/src/main/scripts/PropertyChangeName.sh new file mode 100644 index 0000000..af61403 --- /dev/null +++ b/aai-resources/src/main/scripts/PropertyChangeName.sh @@ -0,0 +1,83 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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 add a target property name with the same value in the database schema +# to a vertex which has an existing property. The existing property is not removed. +# +# Note also - This script just makes changes to the schema that is currently live. +# If you were to create a new schema in a brandy-new environment, it would look like +# whatever the oxm (as of July 2016) told it to look like. So, part of making a +# change to the db schema should Always first be to make the change in the oxm so that +# future environments will have the change. This script is just to change existing +# instances of the schema since schemaGenerator (as of July 2015) does not update things - it +# just does the initial creation. +# +# To use this script, you need to pass four parameters: +# propertyName -- the name of the property that has the value to be used in the targetProperty +# targetPropertyName -- the name of the targetProperty +# targetNodeType -- NA if all propertyName instances in the DB are impacted, otherwise limit the change to this nodeType +# skipCommit -- true or false. For testing, skips the commit when set to true. +# +# Ie. propertyNameChange service-id persona-model-id service-instance true +# + +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 [ "$#" -ne 4 ]; then + echo "Illegal number of parameters" + echo "usage: $0 propertyName targetPropertyName targetNodeType skipCommit" + 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 + +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.openecomp.aai.dbgen.PropertyNameChange $1 $2 $3 $4 +if [ "$?" -ne "0" ]; then + echo "Problem executing propertyNameChange " + exit 1 +fi + + +echo `date` " Done $0" +exit 0 diff --git a/aai-resources/src/main/scripts/addResourceVersionProperty.sh b/aai-resources/src/main/scripts/addResourceVersionProperty.sh new file mode 100644 index 0000000..821275a --- /dev/null +++ b/aai-resources/src/main/scripts/addResourceVersionProperty.sh @@ -0,0 +1,55 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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========================================================= +### + +# +# The script invokes the AddResourceVersionProp java class as a one-time (per database instance) migration tool +# which adds the new property "resource-version" to every node in the db. +# + +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 + +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 + + +$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME \ + org.openecomp.aai.dbgen.AddResourceVersionProp + +echo `date` " Done $0" +exit 0 diff --git a/aai-resources/src/main/scripts/changePropertyCardinality.sh b/aai-resources/src/main/scripts/changePropertyCardinality.sh new file mode 100644 index 0000000..0eeac6d --- /dev/null +++ b/aai-resources/src/main/scripts/changePropertyCardinality.sh @@ -0,0 +1,88 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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 change the cardinality of an existing database property. +# It currently just allows you to change TO a SET cardinality with dataType = String. +# It does not currently let you preserve the data (since we're just doing this for one +# field which nobody uses yet). +# +# Note also - This script just makes changes to the schema that is currently live. +# If you were to create a new schema in a brandy-new environment, it would look like +# whatever ex5.json (as of Jan 2016) told it to look like. So, part of making a +# change to the db schema should Always first be to make the change in ex5.json so that +# future environments will have the change. This script is just to change existing +# instances of the schema since schemaGenerator (as of Jan 2016) does not update things - it +# just does the initial creation. +# +# Boy, this is getting to be a big comment section... +# +# To use this script, you need to pass four parameters: +# propertyName -- the name of the property that you need to change Cardinality on. +# targetDataType -- whether it's changing or not, you need to give it: For now -- we only allow "String" +# targetCardinality -- For now -- only accepts "SET". In the future we should support ("SET", "LIST" or "SINGLE") +# preserveDataFlag -- true or false. For now -- only supports "false" +# +# Ie. changePropertyCardinality.sh supplier-release-list String SET false +# + +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 [ "$#" -ne 4 ]; then + echo "Illegal number of parameters" + echo "usage: $0 propertyName targetDataType targetCardinality preserveDataFlag" + 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 + +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.openecomp.aai.dbgen.ChangePropertyCardinality $1 $2 $3 $4 +if [ "$?" -ne "0" ]; then + echo "Problem executing ChangePropertyCardinality " + exit 1 +fi + + +echo `date` " Done $0" +exit 0 diff --git a/aai-resources/src/main/scripts/createDBSchema.sh b/aai-resources/src/main/scripts/createDBSchema.sh index 51668de..3cdbcd3 100644 --- a/aai-resources/src/main/scripts/createDBSchema.sh +++ b/aai-resources/src/main/scripts/createDBSchema.sh @@ -33,6 +33,7 @@ echo echo `date` " Starting $0" . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh index 585f333..c91f564 100644 --- a/aai-resources/src/main/scripts/deleteTool.sh +++ b/aai-resources/src/main/scripts/deleteTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/deobfuscatePW.sh b/aai-resources/src/main/scripts/deobfuscatePW.sh index 965525d..0a1f09a 100644 --- a/aai-resources/src/main/scripts/deobfuscatePW.sh +++ b/aai-resources/src/main/scripts/deobfuscatePW.sh @@ -39,6 +39,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/edgeTagger.sh b/aai-resources/src/main/scripts/edgeTagger.sh index 5a120a2..35c214c 100644 --- a/aai-resources/src/main/scripts/edgeTagger.sh +++ b/aai-resources/src/main/scripts/edgeTagger.sh @@ -72,6 +72,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh index 2da20eb..6f54299 100644 --- a/aai-resources/src/main/scripts/getTool.sh +++ b/aai-resources/src/main/scripts/getTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/notifyTool.sh b/aai-resources/src/main/scripts/notifyTool.sh index 2ecf1f4..9a0eede 100644 --- a/aai-resources/src/main/scripts/notifyTool.sh +++ b/aai-resources/src/main/scripts/notifyTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/postTool.sh b/aai-resources/src/main/scripts/postTool.sh index a773915..9a059e2 100644 --- a/aai-resources/src/main/scripts/postTool.sh +++ b/aai-resources/src/main/scripts/postTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh index 9d3f1dd..db581f8 100644 --- a/aai-resources/src/main/scripts/putTool.sh +++ b/aai-resources/src/main/scripts/putTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh index 316d0f5..5c71f51 100644 --- a/aai-resources/src/main/scripts/rshipTool.sh +++ b/aai-resources/src/main/scripts/rshipTool.sh @@ -43,6 +43,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh new file mode 100644 index 0000000..7cf1c5f --- /dev/null +++ b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh @@ -0,0 +1,54 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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 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 + +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.openecomp.aai.util.DbTestProcessBuilder "$@" + +echo `date` " Done $0" +exit 0 diff --git a/aai-resources/src/main/scripts/run_FixXSD.sh b/aai-resources/src/main/scripts/run_FixXSD.sh new file mode 100644 index 0000000..9293ded --- /dev/null +++ b/aai-resources/src/main/scripts/run_FixXSD.sh @@ -0,0 +1,68 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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========================================================= +### + +# +# 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.openecomp.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/schemaMod.sh b/aai-resources/src/main/scripts/schemaMod.sh index f4fd4d5..3204900 100644 --- a/aai-resources/src/main/scripts/schemaMod.sh +++ b/aai-resources/src/main/scripts/schemaMod.sh @@ -66,6 +66,7 @@ if [ "$#" -ne 4 ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do diff --git a/aai-resources/src/main/scripts/uniquePropertyCheck.sh b/aai-resources/src/main/scripts/uniquePropertyCheck.sh new file mode 100644 index 0000000..cee03b9 --- /dev/null +++ b/aai-resources/src/main/scripts/uniquePropertyCheck.sh @@ -0,0 +1,60 @@ +#!/bin/ksh + +### +# ============LICENSE_START======================================================= +# org.openecomp.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========================================================= +### + +# +# The script invokes UniqueProperty java class to see if the passed property is unique in the db and if +# not, to display where duplicate values are found. +# +# For example: uniquePropertyCheck.sh subscriber-name +# + +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 + +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.openecomp.aai.util.UniquePropertyCheck "$@" +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/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh index 25670f6..bdb47e2 100644 --- a/aai-resources/src/main/scripts/updateTool.sh +++ b/aai-resources/src/main/scripts/updateTool.sh @@ -34,6 +34,7 @@ if [ "${userid}" != "aaiadmin" ]; then fi . /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources for JAR in `ls $PROJECT_HOME/extJars/*.jar` do |