aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/resources/scripts
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
committerOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
commit1cfb08779ea0e00be69e072a940b3063e049fe6b (patch)
tree6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/main/resources/scripts
parent2f20b001b9243e0f8b44aecc768ec265fd538732 (diff)
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/main/resources/scripts')
-rw-r--r--vid-app-common/src/main/resources/scripts/category_parameter.sh64
-rw-r--r--vid-app-common/src/main/resources/scripts/update_category_option_name.sh34
-rw-r--r--vid-app-common/src/main/resources/scripts/vnf_wf.sh49
3 files changed, 147 insertions, 0 deletions
diff --git a/vid-app-common/src/main/resources/scripts/category_parameter.sh b/vid-app-common/src/main/resources/scripts/category_parameter.sh
new file mode 100644
index 000000000..0ff1c73c3
--- /dev/null
+++ b/vid-app-common/src/main/resources/scripts/category_parameter.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+usage() { echo -e "Usage: $0 [-o <ADD|GET>] [-p <FILE_PATH>] [-c category_name] [-f FAMILY]" 1>&2; exit 1; }
+while getopts ":o:p:c:f:" opt; do
+ case ${opt} in
+ o)
+ OPERATION=${OPTARG}
+ ;;
+ p)
+ FILE=${OPTARG}
+ ;;
+ c)
+ CATEGORY=${OPTARG}
+ ;;
+ f)
+ FAMILY=${OPTARG}
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+if [ -z "${FILE}" ] || [ -z "${OPERATION}" ]; then
+ usage
+fi
+if [ ${OPERATION} != 'ADD' ] && [ ${OPERATION} != 'GET' ]; then
+ usage
+fi
+if [ ${OPERATION} = 'ADD' ]; then
+ if [ -z "${CATEGORY}" ] ; then
+ usage
+ fi
+ OPERATION='POST'
+fi
+if [ ${OPERATION} = 'GET' ]; then
+ if [ -z "${FAMILY}" ] ; then
+ usage
+ fi
+fi
+URL="http://127.0.0.1:8080/vid/maintenance/category_parameter"
+if [ ${OPERATION} = 'GET' ]; then
+ FULLURL="${URL}?familyName=${FAMILY}"
+ echo "Sending request: ${FULLURL}"
+ echo -e "------------------------\nwget output:"
+ wget -nv -O "${FILE}" "${FULLURL}"
+ RC=$?
+ echo "---------------------------"
+ if [ $RC -eq 0 ]; then
+ echo "Result saved to ${FILE}"
+ else
+ echo "Failed to get category parameters list"
+ fi
+else
+ BODY=$(cat ${FILE} | awk ' BEGIN { ; print " {\"options\" : [ "} { gsub(/ /, "", $0) ; printf "%s\"%s\"",separator,$1 ;separator = ", ";} END { printf " ]} "}')
+ FULLURL="${URL}/${CATEGORY}"
+ echo "Sending request: ${FULLURL} ${OPERATION} ${BODY}"
+ echo -e "------------------------\nwget output:"
+ wget --method="${OPERATION}" --body-data="${BODY}" --header=Content-Type:application/json --content-on-error -nv -O - "${FULLURL}"
+ RC=$?
+ echo "---------------------------"
+ if [ $RC -ne 0 ]; then
+ echo "Failed to ADD options to category ${CATEGORY}"
+ fi
+fi
diff --git a/vid-app-common/src/main/resources/scripts/update_category_option_name.sh b/vid-app-common/src/main/resources/scripts/update_category_option_name.sh
new file mode 100644
index 000000000..5ff505800
--- /dev/null
+++ b/vid-app-common/src/main/resources/scripts/update_category_option_name.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+usage() { echo -e "Usage: $0 [-c category_name] [-i option_id] [-n option_updated_name]" 1>&2; exit 1; }
+while getopts ":c:i:n:" opt; do
+ case ${opt} in
+ i)
+ ID=${OPTARG}
+ ;;
+ n)
+ NAME=${OPTARG}
+ ;;
+ c)
+ CATEGORY=${OPTARG}
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+if [ -z "${ID}" ] || [ -z "${NAME}" ] || [ -z "${CATEGORY}" ]; then
+ usage
+fi
+URL="http://127.0.0.1:8080/vid/maintenance/category_parameter/"
+OPERATION="PUT"
+FULLURL="${URL}${CATEGORY}"
+BODY="{\"id\":\"${ID}\",\"name\":\"${NAME}\"}"
+echo "Sending request: ${FULLURL} ${OPERATION} ${BODY}"
+echo -e "------------------------\nwget output:"
+wget --method="${OPERATION}" --body-data="${BODY}" --header=Content-Type:application/json --content-on-error -nv -O - "${FULLURL}"
+RC=$?
+echo "---------------------------"
+if [ $RC -ne 0 ]; then
+ echo "Failed to update option name ${NAME} for option id ${ID} of category ${CATEGORY}"
+fi \ No newline at end of file
diff --git a/vid-app-common/src/main/resources/scripts/vnf_wf.sh b/vid-app-common/src/main/resources/scripts/vnf_wf.sh
new file mode 100644
index 000000000..69cb595b5
--- /dev/null
+++ b/vid-app-common/src/main/resources/scripts/vnf_wf.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+usage() { echo -e "Usage: $0 [-o <ADD|DELETE|GET>] [-p <FILE_PATH>]\nCSV File Format: VNF_UUID,VNF_invariantUUID,workflowName" 1>&2; exit 1; }
+while getopts ":o:p:" opt; do
+ case ${opt} in
+ o)
+ OPERATION=${OPTARG}
+ ;;
+ p)
+ FILE=${OPTARG}
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+if [ -z "${FILE}" ] || [ -z "${OPERATION}" ]; then
+ usage
+fi
+if [ ${OPERATION} != 'ADD' ] && [ ${OPERATION} != 'DELETE' ] && [ ${OPERATION} != 'GET' ]; then
+ usage
+fi
+if [ ${OPERATION} = 'ADD' ]; then
+ OPERATION='POST'
+fi
+URL="http://127.0.0.1:8080/vid/change-management/vnf_workflow_relation"
+if [ ${OPERATION} = 'GET' ]; then
+ echo "Sending request for get all vnf_workflow_relation"
+ echo -e "------------------------\nwget output:"
+ wget -nv -O "${FILE}" "${URL}"
+ RC=$?
+ echo "---------------------------"
+ if [ $RC -eq 0 ]; then
+ echo "Result saved to ${FILE}"
+ else
+ echo "Failed to get vnf to workflows relations"
+ fi
+else
+ BODY=$(cat ${FILE} | awk ' BEGIN { FS=","; print " {\"workflowsDetails\" : [ "} { gsub(/ /, "", $1) ; gsub(/ /, "", $2) ; gsub(/^[ \t]+/,"",$3); gsub(/[ \t]+$/,"",$3); printf "%s{\"vnfDetails\":{\"UUID\":\"%s\",\"invariantUUID\":\"%s\"},\"workflowName\":\"%s\"}",separator,$1,$2,$3 ;separator = ", ";} END { printf " ]} "}')
+ echo "Sending request: ${OPERATION} ${BODY}"
+ echo -e "------------------------\nwget output:"
+ wget --method="${OPERATION}" --body-data="${BODY}" --header=Content-Type:application/json --content-on-error -nv -O - "${URL}"
+ RC=$?
+ echo "---------------------------"
+ if [ $RC -ne 0 ]; then
+ echo "Failed to ADD/DELETE vnf to workflows relations"
+ fi
+fi
+