diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-01-13 12:18:00 -0500 |
---|---|---|
committer | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-01-13 12:18:07 -0500 |
commit | 3289e79a0f0343cbd380a385d61e21f59ceff85c (patch) | |
tree | a74957c74fb41275aede412e5c43307fd3e0c859 /aai-resources/src/main/scripts | |
parent | 92ac3a80c822340c07b9d09189b85c34ac797122 (diff) |
Sync up the changes for v15
Issue-ID: AAI-1811
Change-Id: I5c397d5907bb0711977f62ba84abe454f410a3b7
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
Diffstat (limited to 'aai-resources/src/main/scripts')
-rw-r--r-- | aai-resources/src/main/scripts/audit_schema.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/bulkprocess.sh | 58 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/common_functions.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/deleteTool.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/getTool.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/increaseNodes.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/putTool.sh | 12 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/rshipTool.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/updatePem.sh | 2 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/updateTool.sh | 2 |
10 files changed, 76 insertions, 10 deletions
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 |