diff options
author | Venkata Harish K Kajur <vk250x@att.com> | 2018-01-18 02:25:31 -0500 |
---|---|---|
committer | Venkata Harish K Kajur <vk250x@att.com> | 2018-02-12 15:44:18 -0500 |
commit | 4c4412642e40a92bebd26f2966bc72619e16ae79 (patch) | |
tree | a9c0c08aa8dd2de651cdaad684155ec4962dd3eb /aai-resources/src/main/scripts | |
parent | 9c04bb4a324af0857dacc65880c3540dc18d5b89 (diff) |
Sync up the latest logging code changes
Issue-ID: AAI-493
Change-Id: I778acf7726b1f9881dee62b128b1fbc457bf7a7e
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/createDBSchema.sh | 3 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/dynamicPayloadArchive.sh | 63 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/dynamicPayloadGenerator.sh | 101 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/forceDeleteTool.sh | 1 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/install/addManualData.sh | 131 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/putTool.sh | 27 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/run_Migrations.sh | 76 | ||||
-rw-r--r-- | aai-resources/src/main/scripts/updateTool.sh | 24 |
8 files changed, 402 insertions, 24 deletions
diff --git a/aai-resources/src/main/scripts/createDBSchema.sh b/aai-resources/src/main/scripts/createDBSchema.sh index 4751072..56f0fcc 100644 --- a/aai-resources/src/main/scripts/createDBSchema.sh +++ b/aai-resources/src/main/scripts/createDBSchema.sh @@ -47,8 +47,7 @@ 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.GenTester $1 +$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" exit 0 diff --git a/aai-resources/src/main/scripts/dynamicPayloadArchive.sh b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh new file mode 100644 index 0000000..f17f679 --- /dev/null +++ b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh @@ -0,0 +1,63 @@ +#!/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========================================================= +### + +# +# 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. +# +# + +. /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources + +PROGNAME=$(basename $0) + +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 +DIRECTORY=${PROJECT_HOME}/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation +if [ ! -d ${DIRECTORY} ] +then + echo " ${DIRECTORY} doesn't exist" + exit 1 +fi + +tar c ${DIRECTORY}/* -f /var/tmp/dynamicPayloadArchive_${TS}.tar +if [ $? -ne 0 ] +then + echo " Unable to tar ${DIRECTORY}" + exit 1 +fi + +cd /var/tmp +gzip /var/tmp/dynamicPayloadArchive_${TS}.tar +if [ $? -ne 0 ] +then + echo " Unable to gzip /var/tmp/dynamicPayloadArchive_${TS}.tar" + exit 1 +fi +echo "Completed successfully: /var/tmp/dynamicPayloadArchive_${TS}.tar.gz" +exit 0 diff --git a/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh new file mode 100644 index 0000000..c386bed --- /dev/null +++ b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh @@ -0,0 +1,101 @@ +#!/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========================================================= +### + +# +# dynamicPayloadGenerator.sh -- This tool is used for Tenant-Isolation project +# It is used to load a snapshot into memory and generate payloads for any input nodes +# +# +# Parameters: +# +# -d (required) name of the fully qualified Datasnapshot file that you need to load +# -s (optional) true or false to enable or disable schema, By default it is true for production, +# you can change to false if the snapshot has duplicates +# -c (optional) config file to use for loading snapshot into memory. +# -o (required) output file to store the data files +# -f (optional) PAYLOAD or DMAAP-MR +# -n (optional) input file for the script +# +# +# 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/' +# +# 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' +# + + +echo +echo `date` " Starting $0" + +display_usage() { + cat <<EOF + Usage: $0 [options] + + 1. Usage: dynamicPayloadGenerator -d <graphsonPath> -o <output-path> + 2. This script has 2 arguments that are required. + a. -d (required) Name of the fully qualified Datasnapshot file that you need to load + b. -o (required) output file to store the data files + 3. Optional Parameters: + a. -s (optional) true or false to enable or disable schema, By default it is true for production, + b. -c (optional) config file to use for loading snapshot into memory. + 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' -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' + +EOF +} +if [ $# -eq 0 ]; then + display_usage + 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 -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" + +exit 0 diff --git a/aai-resources/src/main/scripts/forceDeleteTool.sh b/aai-resources/src/main/scripts/forceDeleteTool.sh index ac84585..9c199bc 100644 --- a/aai-resources/src/main/scripts/forceDeleteTool.sh +++ b/aai-resources/src/main/scripts/forceDeleteTool.sh @@ -80,6 +80,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/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh new file mode 100644 index 0000000..930b9ba --- /dev/null +++ b/aai-resources/src/main/scripts/install/addManualData.sh @@ -0,0 +1,131 @@ +#!/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 now requires a release parameter. +# the tool finds and sorts *.txt files within the +# bundleconfig/etc/scriptdate/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 +# PutTool will have 412 failures ignored. After calling the PutTool, the +# GetTool is called to include the object put into the graph. +# this script is run at every installation, logging the manual data applied. + +# Returns 0 if the specified string contains the specified substring, +# otherwise returns 1. +contains() { + string="$1" + substring="$2" + if test "${string#*$substring}" != "$string" + then + return 0 # $substring is in $string + else + return 1 # $substring is not in $string + fi +} + +. /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-resources + +PROGNAME=$(basename $0) +OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d) +#OUTFILE=/c/temp/${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 + + +if [ "$#" -ne 1 ]; then + echo "Release or tenant_isolation parameter is required, e.g. 1610, 1702, tenant_isolation, etc" + echo "usage: $0 release" + exit 1 +fi + +error_exit () { + echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2 in $3" 1>&2 + echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2 in $3" >> $OUTFILE +# exit ${2:-"1"} +} + +rel="/"$1"/" +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` + 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 + COMMAND=`ls ${TEXT_PATH} | sort -f` +fi + +ls ${TEXT_PATH} >/dev/null 2>&1 +if [ $? -ne 0 ] +then +echo "No manual data to add for $1"; +exit 0; +fi + +for filepath in ${COMMAND} +do +contains $filepath $rel +if [ $? -eq 0 ] +then +jsonfile=${filepath%???}json +j=0 +while IFS=\n read -r i +do +echo "##### Begin putTool for $i ##### from file $filepath" | tee -a $OUTFILE +resource=`echo $i | tr -d '\r'` +$PROJECT_HOME/scripts/putTool.sh $resource $jsonfile 1 0 na 1 >> $OUTFILE 2>&1 || error_exit "$resource" $j $filepath +echo "##### End putTool for $resource #####" | tee -a $OUTFILE +echo "Begin getTool for $resource" | tee -a $OUTFILE +$PROJECT_HOME/scripts/getTool.sh $resource >> $OUTFILE 2>&1 || error_exit "$i" $j $filepath +echo "End getTool for $resource" | tee -a $OUTFILE + +j=$(expr "$j" + 1) +k=$(expr "$k" + 1) +done < $filepath + +fi + +done +if [ $k -eq 0 ] +then +echo "No manual data to add for release $1"; +exit 0; +fi + +echo "See output and error file: $OUTFILE" + +exit 0 diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh index dfa9b37..b5ad862 100644 --- a/aai-resources/src/main/scripts/putTool.sh +++ b/aai-resources/src/main/scripts/putTool.sh @@ -46,9 +46,10 @@ display_usage() { cat <<EOF Usage: $0 [options] - 1. Usage: putTool.sh <resource-path> <json payload file> + 1. Usage: putTool.sh <resource-path> <json payload file> <optional -display> 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. EOF } if [ $# -eq 0 ]; then @@ -87,6 +88,13 @@ prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties log_dir=$PROJECT_HOME/logs/misc today=$(date +\%Y-\%m-\%d) +RETURNRESPONSE=false +if [ ${#} -ne 2 ]; then + if [ "$3" = "-display" ]; then + RETURNRESPONSE=true + fi +fi + MISSING_PROP=false RESTURL=`grep ^aai.server.url= $prop_file |cut -d'=' -f2 |tr -d "\015"` if [ -z $RESTURL ]; then @@ -117,10 +125,14 @@ if [ $MISSING_PROP = false ]; then else AUTHSTRING="-u $CURLUSER:$CURLPASSWORD" fi - 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` - #echo "result is $result." - RC=0; - if [ $? -eq 0 ]; then + 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 + 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` + #echo "result is $result." + RC=0; + if [ $? -eq 0 ]; then case $result in +([0-9])?) if [[ "$result" -ge 200 && $result -lt 300 ]] @@ -148,10 +160,11 @@ if [ $MISSING_PROP = false ]; then ;; esac - else + else echo "FAILED to send request to $RESTURL" RC=-1 - fi + fi + fi else echo "usage: $0 resource file [expected-failure-codes]" RC=-1 diff --git a/aai-resources/src/main/scripts/run_Migrations.sh b/aai-resources/src/main/scripts/run_Migrations.sh new file mode 100644 index 0000000..7f0ea08 --- /dev/null +++ b/aai-resources/src/main/scripts/run_Migrations.sh @@ -0,0 +1,76 @@ +#!/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========================================================= +### + +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/ diff --git a/aai-resources/src/main/scripts/updateTool.sh b/aai-resources/src/main/scripts/updateTool.sh index f4e2941..05377d6 100644 --- a/aai-resources/src/main/scripts/updateTool.sh +++ b/aai-resources/src/main/scripts/updateTool.sh @@ -47,20 +47,15 @@ contains() { display_usage() { cat <<EOF -Usage: $0 [options] +Usage 1: updateTool.sh <node type> <update node URI> <property name>:<property value> +[,<property name>:<property value]* | where update node uri is the URI path for that node +for ex1: ./updateTool.sh pserver cloud-infrastructure/pservers/pserver/XXX prov-status:NEWSTATUS +ex2:./updateTool.sh pserver cloud-infrastructure/pservers/pserver/XXX 'prov-status:NEWSTATUS with space' +ex3:./updateTool.sh pserver cloud-infrastructure/pservers/pserver/XXX 'prov-status:NEWSTATUS,attribute2:value' -1. This script needs a resource argument (resource-path), and either a JSON filepath, or directly the property you need to update -2. Usage 1 (use a Json file): updateTool.sh <node type> <resource> <filepath> <optional arg to ignore HTTP failure codes> -3. Usage 1 example: ./updateTool.sh customer business/customers/customer/customer-id-1 /tmp/updateTest.json +Usage 2. using .json file for update: ./updateTool.sh <node type> <update node URI> /tmp/updatepayload.json +Ex: ./updateTool.sh pserver cloud-infrastructure/pservers/pserver/XXX /tmp/testpayload.json -4. Usage 2 (update a property directly): updateTool.sh <node type> <resource> '<key name>:<key value>,<property>:<property val>' <optional arg to ignore HTTP failure codes> -5. Usage 2 example: ./updateTool.sh complex cloud-infrastructure/complexes/complex/complex-id 'physical-location-id:complex-id, city:New York' -6. You could try without the <key name>:<key value> (only the property and its new value), but on some servers this did not work: -7. ./updateTool.sh complex cloud-infrastructure/complexes/complex/complex-id 'city:New York' - -8. Usage 3 (update an attribute on an object that is embedded a level or two levels. Use the full path) -9. ./updateTool.sh <node type> <embedded resource with full paths> <key name: key value> -10. ./updateTool.sh p-interface network/pnfs/pnf/pnf-name-1/p-interfaces/p-interface/int-1 'interface-type:int-typei' EOF } @@ -131,11 +126,10 @@ fi #or #'physical-location-id:complex-id, city:New York' thirdarg=$3 -isjson = true +isjson = false if [[ "$thirdarg" == *json || "$thirdarg" == *JSON ]]; then - echo "Usage 1(JSON) because the 2nd arg ends with json"; + isjson = true else - echo "Usage 2(Comand Arg) because the 2nd arg does not end with json"; #For Usage 2, format input into JSON string format JSONSTRING="{" INPUT=$3 |