From 3289e79a0f0343cbd380a385d61e21f59ceff85c Mon Sep 17 00:00:00 2001 From: "Kajur, Harish (vk250x)" Date: Sun, 13 Jan 2019 12:18:00 -0500 Subject: Sync up the changes for v15 Issue-ID: AAI-1811 Change-Id: I5c397d5907bb0711977f62ba84abe454f410a3b7 Signed-off-by: Kajur, Harish (vk250x) --- aai-resources/src/main/scripts/audit_schema.sh | 2 +- aai-resources/src/main/scripts/bulkprocess.sh | 58 ++++++++++++++++++++++ aai-resources/src/main/scripts/common_functions.sh | 2 +- aai-resources/src/main/scripts/deleteTool.sh | 2 +- aai-resources/src/main/scripts/getTool.sh | 2 +- aai-resources/src/main/scripts/increaseNodes.sh | 2 +- aai-resources/src/main/scripts/putTool.sh | 12 ++++- aai-resources/src/main/scripts/rshipTool.sh | 2 +- aai-resources/src/main/scripts/updatePem.sh | 2 +- aai-resources/src/main/scripts/updateTool.sh | 2 +- 10 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 aai-resources/src/main/scripts/bulkprocess.sh (limited to 'aai-resources/src/main/scripts') 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 .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 < + 1. Usage: putTool.sh 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 -- cgit 1.2.3-korg