aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/tools
diff options
context:
space:
mode:
authorNate Potter <nathaniel.potter@intel.com>2017-08-02 15:17:41 -0700
committerVictor Morales <victor.morales@intel.com>2017-08-14 17:51:57 -0500
commit8a0c9450a19892d4254e2b69d04f3b84007b700b (patch)
tree51fdaf12217c3bb027f688cfce53c74f0447d688 /bootstrap/vagrant-onap/tools
parentd1c03409f28c32d8cb0a97d4311b58907729998e (diff)
Add warnings and options to run.sh
Adds a warning to run.sh informing the user that the contents of their /opt folder will be deleted by the test. Also adds option parsing, -y for skipping the prompt, -s for test suite selection, -c for test case selection, as well as -h for displaying help for the program. Change-Id: I888350d31839bd6db91a497a04ae3308af5329e9 Issue-Id: INT-97 Signed-off-by: Nate Potter <nathaniel.potter@intel.com>
Diffstat (limited to 'bootstrap/vagrant-onap/tools')
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh91
1 files changed, 82 insertions, 9 deletions
diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh
index b9a4a4311..aeb9d8c49 100755
--- a/bootstrap/vagrant-onap/tools/run.sh
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -1,20 +1,93 @@
#!/bin/bash
-case $1 in
+usage ()
+{
+cat <<EOF
+Usage: run.sh [-y] [-h] Command
+Optional arguments:
+ -y
+ Skips warning prompt.
+ -h
+ Shows help about this program.
+ -s <suite>
+ Test suite to use in testing mode.
+ -c <case>
+ Test case to use in testing mode.
+Commands:
+ all_in_one Deploy in all-in-one mode.
+ dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc Deploy chosen service.
+ testing Deploy in testing mode.
+EOF
+}
+
+run=false
+test_suite="*"
+test_case="*"
+
+COMMAND=${@: -1}
+
+while getopts "yhs:c:" OPTION; do
+ case "$OPTION" in
+ y)
+ run=true
+ ;;
+ s)
+ if [ "$COMMAND" != "testing" ] ; then
+ echo "Test suite should only be specified in testing mode."
+ echo "./run.sh -h for usage."
+ exit 0
+ fi
+ test_suite=$OPTARG
+ ;;
+ c)
+ if [ "$COMMAND" != "testing" ] ; then
+ echo "Test case should only be specified in testing mode."
+ echo "./run.sh -h for usage."
+ exit 0
+ fi
+ test_case=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ esac
+done
+
+case $COMMAND in
"all_in_one" )
- export DEPLOY_MODE='all-in-one' ;;
+ export DEPLOY_MODE='all-in-one'
+ ;;
"dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" )
- export DEPLOY_MODE='individual' ;;
+ export DEPLOY_MODE='individual'
+ ;;
"testing" )
export DEPLOY_MODE='testing'
- export TEST_SUITE=${2:-*}
- export TEST_CASE=${3:-*}
+ if [ "$run" == false ] ; then
+ while true ; do
+ echo "Warning: This test script will delete the contents of ../opt/ and ~/.m2."
+ read -p "Would you like to continue? [y]es/[n]o: " yn
+ case $yn in
+ [Yy]*)
+ break
+ ;;
+ [Nn]*)
+ echo "Exiting."
+ exit 0
+ ;;
+ esac
+ done
+ fi
+ export TEST_SUITE=$test_suite
+ export TEST_CASE=$test_case
rm -rf ../opt/
- rm -rf ~/.m2/;;
+ rm -rf ~/.m2/
+ ;;
* )
- echo $"Usage: $0 {all_in_one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|testing}"
+ usage
exit 1
esac
-vagrant destroy -f $1
-vagrant up $1
+
+vagrant destroy -f $COMMAND
+vagrant up $COMMAND