summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/vagrant-onap')
-rw-r--r--bootstrap/vagrant-onap/CONTRIBUTING.md8
-rw-r--r--bootstrap/vagrant-onap/Vagrantfile30
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh91
-rwxr-xr-xbootstrap/vagrant-onap/vagrant_utils/postinstall.sh (renamed from bootstrap/vagrant-onap/postinstall.sh)0
-rwxr-xr-xbootstrap/vagrant-onap/vagrant_utils/unit_testing.sh (renamed from bootstrap/vagrant-onap/unit_testing.sh)5
5 files changed, 101 insertions, 33 deletions
diff --git a/bootstrap/vagrant-onap/CONTRIBUTING.md b/bootstrap/vagrant-onap/CONTRIBUTING.md
index 6f2897ce3..3e42510fe 100644
--- a/bootstrap/vagrant-onap/CONTRIBUTING.md
+++ b/bootstrap/vagrant-onap/CONTRIBUTING.md
@@ -15,7 +15,7 @@ implementation of the _functions_ created on **_lib_** folder. In order to
execute the Unit Tests defined for this project, you must run the following
command:
- $ ./tools/run.sh testing [test_suite] [function]
+ $ ./tools/run.sh -s [test_suite] -c [function] testing
or using PowerShell
@@ -25,6 +25,6 @@ or using PowerShell
Examples
--------
- $ ./tools/run.sh testing # Executes all the Unit Tests
- $ ./tools/run.sh testing functions # Executes all the Unit Tests of Functions Test Suite
- $ ./tools/run.sh testing functions install_maven # Executes the install_maven Unit Test of Functions Test Suite
+ $ ./tools/run.sh -y testing # Executes all the Unit Tests unattended mode
+ $ ./tools/run.sh -s functions testing # Executes all the Unit Tests of Functions Test Suite
+ $ ./tools/run.sh -s functions -c install_maven testing # Executes the install_maven Unit Test of Functions Test Suite
diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile
index 0e8e1da1c..3ee305c39 100644
--- a/bootstrap/vagrant-onap/Vagrantfile
+++ b/bootstrap/vagrant-onap/Vagrantfile
@@ -152,7 +152,7 @@ Vagrant.configure("2") do |config|
v.flavor = 'm1.xlarge'
end
all_in_one.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
s.env = conf
end
@@ -175,7 +175,7 @@ Vagrant.configure("2") do |config|
v.flavor = 'm1.small'
end
dns.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.env = conf
end
end
@@ -187,7 +187,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'message-router'
end
mr.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mr']
s.env = conf
end
@@ -209,7 +209,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'sdc'
end
sdc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['sdc']
s.env = conf
end
@@ -222,7 +222,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'aai'
end
aai.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['aai']
s.env = conf
end
@@ -235,7 +235,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'mso'
end
mso.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['mso']
s.env = conf
end
@@ -248,7 +248,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'robot'
end
robot.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['robot']
s.env = conf
end
@@ -261,7 +261,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'vid'
end
vid.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['vid']
s.env = conf
end
@@ -274,7 +274,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'sdnc'
end
sdnc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['sdnc']
s.env = conf
end
@@ -287,7 +287,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'portal'
end
portal.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['portal']
s.env = conf
end
@@ -300,7 +300,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'dcae'
end
dcae.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['dcae']
s.env = conf
end
@@ -313,7 +313,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'policy'
end
policy.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['policy']
s.env = conf
end
@@ -326,7 +326,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'appc'
end
appc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['appc']
s.env = conf
end
@@ -339,7 +339,7 @@ Vagrant.configure("2") do |config|
v.server_name = 'vfc'
end
vfc.vm.provision 'shell' do |s|
- s.path = 'postinstall.sh'
+ s.path = 'vagrant_utils/postinstall.sh'
s.args = ['vfc']
s.env = conf
end
@@ -366,7 +366,7 @@ Vagrant.configure("2") do |config|
v.flavor = 'm1.small'
end
testing.vm.provision 'shell' do |s|
- s.path = 'unit_testing.sh'
+ s.path = 'vagrant_utils/unit_testing.sh'
s.args = [test_suite, test_case]
s.env = conf
end
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
diff --git a/bootstrap/vagrant-onap/postinstall.sh b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
index f5a7ac684..f5a7ac684 100755
--- a/bootstrap/vagrant-onap/postinstall.sh
+++ b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
diff --git a/bootstrap/vagrant-onap/unit_testing.sh b/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh
index 360d28bc7..a378ad0cd 100755
--- a/bootstrap/vagrant-onap/unit_testing.sh
+++ b/bootstrap/vagrant-onap/vagrant_utils/unit_testing.sh
@@ -1,10 +1,5 @@
#!/bin/bash
-set -o xtrace
-
-rm -rf /opt/
-rm -rf /root/.m2/
-
set -o errexit
TEST_SUITE=${1:-*}