summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/main/scripts/install/updateQueryData.sh
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-05-12 17:36:59 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-05-12 17:37:13 -0400
commitb5b99b72733ca5c064b46fdf4527ace28b8b545b (patch)
treeb1606e7d824e5d56b3530f724bf7bf326f9a7833 /aai-traversal/src/main/scripts/install/updateQueryData.sh
parentb6a2b26886ac329dd0836270127c1b9d283c3659 (diff)
Add all of the traversal source files
Change-Id: Id31f4bdda9c86f782f86829f8b86dada959a9729 Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-traversal/src/main/scripts/install/updateQueryData.sh')
-rw-r--r--aai-traversal/src/main/scripts/install/updateQueryData.sh97
1 files changed, 97 insertions, 0 deletions
diff --git a/aai-traversal/src/main/scripts/install/updateQueryData.sh b/aai-traversal/src/main/scripts/install/updateQueryData.sh
new file mode 100644
index 0000000..798d5b8
--- /dev/null
+++ b/aai-traversal/src/main/scripts/install/updateQueryData.sh
@@ -0,0 +1,97 @@
+#!/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=========================================================
+###
+
+PROGNAME=$(basename $0)
+PROJECT_HOME=/opt/app/aai-traversal
+OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d)
+
+TS=$(date "+%Y-%m-%d %H:%M:%S")
+
+CHECK_USER="aaiadmin"
+userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+if [ "${userid}" != $CHECK_USER ]; then
+ echo "You must be $CHECK_USER to run $0. The id used $userid."
+ exit 1
+fi
+
+error_exit () {
+ echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" 1>&2
+ echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" >> $OUTFILE
+# exit ${2:-"1"}
+}
+
+j=0
+for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/widget-model-json/*.json|sort -f`
+do
+j=$(expr "$j" + 1)
+filename=$(basename $filepath)
+echo "Begin putTool for widget $filename" | tee -a $OUTFILE
+vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
+# last parameter will skip put if it exists
+resource=service-design-and-creation/models/model/$vers
+$PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+echo "End putTool for widget $filename" | tee -a $OUTFILE
+done
+
+j=0
+for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/named-query-json/*.json|sort -f`
+do
+j=$(expr "$j" + 1)
+filename=$(basename $filepath)
+echo "Begin putTool for named-query $filename" | tee -a $OUTFILE
+vers=`grep named-query-uuid $filepath|cut -d':' -f2|cut -d'"' -f2`
+# last parameter will skip put if it exists
+resource=service-design-and-creation/named-queries/named-query/$vers
+$PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+echo "End putTool for named-query $filename" | tee -a $OUTFILE
+done
+
+j=0
+for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/resource-model-json/*.json|sort -f`
+do
+j=$(expr "$j" + 1)
+filename=$(basename $filepath)
+echo "Begin putTool for resource model $filename" | tee -a $OUTFILE
+vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
+# last parameter will skip put if it exists
+resource=service-design-and-creation/models/model/$vers
+$PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+echo "End putTool for resource model $filename" | tee -a $OUTFILE
+done
+
+j=0
+for filepath in `ls $PROJECT_HOME/bundleconfig/etc/scriptdata/service-model-json/*.json|sort -f`
+do
+j=$(expr "$j" + 1)
+filename=$(basename $filepath)
+echo "Begin putTool for service model $filename" | tee -a $OUTFILE
+vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
+# last parameter will skip put if it exists
+resource=service-design-and-creation/models/model/$vers
+$PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+echo "End putTool for service model $filename" | tee -a $OUTFILE
+done
+
+echo "$PROGNAME completed ${TS}" | tee -a $OUTFILE
+echo "See output and error file: $OUTFILE"
+
+exit 0