summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap/vagrant-onap/lib/aai26
-rwxr-xr-xbootstrap/vagrant-onap/lib/commons21
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions18
-rw-r--r--bootstrap/vagrant-onap/tests/test_aai7
4 files changed, 52 insertions, 20 deletions
diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai
index cbf5c5f7d..faf916d9b 100755
--- a/bootstrap/vagrant-onap/lib/aai
+++ b/bootstrap/vagrant-onap/lib/aai
@@ -33,14 +33,18 @@ function install_hadoop {
# install_haproxy() - Function that install HAProxy
function install_haproxy {
+ if is_package_installed haproxy; then
+ return
+ fi
+ install_package software-properties-common
+ add-apt-repository -y ppa:vbernat/haproxy-1.7
install_package haproxy
- sed -i "s|ENABLED=0|ENABLED=1|g" /etc/default/haproxy
-# cp /var/onap/files/haproxy.cfg /etc/haproxy/
+ cp /var/onap/files/haproxy.cfg /etc/haproxy/
cp /var/onap/files/aai.pem /etc/ssl/private/
chmod 640 /etc/ssl/private/aai.pem
chown root:ssl-cert /etc/ssl/private/aai.pem
mkdir /usr/local/etc/haproxy
- echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts
+ #echo "127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org" >> /etc/hosts
service haproxy restart
}
@@ -66,26 +70,28 @@ function compile_aai_repos {
# setup_titan() - Function that configures AAI services to connect to Hadoop Titan
function setup_titan {
- local $subdirectory=bundleconfig-local/etc/appprops
+ local subdirectory="bundleconfig-local/etc/appprops"
install_python_package crudini
- for dirc in resources/aai-resources traversal/aai-travers; do
+ for dirc in resources/aai-resources traversal/aai-traversal; do
for file in titan-cached.properties titan-realtime.properties; do
- crudini --set --existing $aai_src_folder/$dirc/$subdirectory/$file "" storage.backend cassandra
- crudini --set --existing $aai_src_folder/$dirc/$subdirectory/$file "" storage.hostname localhost
+ crudini --set "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.backend" "cassandra"
+ crudini --set "$aai_src_folder/$dirc/$subdirectory/$file" "" "storage.hostname" "localhost"
done
done
- # Addthe schema to the local isntance
+ # Add the schema to the local isntance
+ compile_src $aai_src_folder/resources/aai-resources/
+ uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
pushd $aai_src_folder
- install_java
java -DAJSC_HOME=$aai_src_folder/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.openecomp.aai.dbgen.GenTester
popd
}
# start_aai_microservices() - Function that starts AAI microservices
function start_aai_microservices {
- MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
+ install_maven
+ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
for svc in resources traversal; do
pushd $aai_src_folder/resources
mvn -P runAjsc
diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons
index 019eeb5c2..26e2cc26a 100755
--- a/bootstrap/vagrant-onap/lib/commons
+++ b/bootstrap/vagrant-onap/lib/commons
@@ -31,6 +31,13 @@ function is_package_installed {
dpkg -s "$@" > /dev/null 2> /dev/null
}
+# install_packages() - Install a list of packages
+function install_packages {
+ local package=$@
+ update_repos
+ apt-get install -y -qq $package
+}
+
# install_package() - Install specific package if doesn't exist
function install_package {
local package=$1
@@ -39,3 +46,17 @@ function install_package {
apt-get install -y -qq $package
fi
}
+
+# uninstall_packages() - Uninstall a list of packages
+function uninstall_packages {
+ local packages=$@
+ apt-get purge -y -qq $packages
+}
+
+# uninstall_package() - Uninstall specific package if exists
+function uninstall_package {
+ local package=$1
+ if is_package_installed $package; then
+ apt-get purge -y -qq $package
+ fi
+}
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index 709d7ebc0..16e774178 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -58,15 +58,12 @@ function clone_repo {
# install_dev_tools() - Install basic dependencies
function install_dev_tools {
- install_package apt-transport-https
- install_package ca-certificates
- install_package curl
+ install_packages apt-transport-https ca-certificates curl
}
# _install_bind() - Install bind utils
function _install_bind {
- install_package bind9
- install_package bind9utils
+ install_packages bind9 bind9utils
}
# install_java() - Install java binaries
@@ -76,6 +73,10 @@ function install_java {
fi
install_package software-properties-common
add-apt-repository -y ppa:openjdk-r/ppa
+
+ # Remove Java 7
+ uninstall_packages default-jre openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless
+
install_package openjdk-8-jdk
# ca-certificates-java is not a dependency in the Oracle JDK/JRE so this must be explicitly installed.
/var/lib/dpkg/info/ca-certificates-java.postinst configure
@@ -91,8 +92,8 @@ function install_maven {
add-apt-repository -y ppa:andrei-pozolotin/maven3
install_package maven3
- # Force Maven3 to use jdk8
- apt-get purge openjdk-7-jdk -y
+ # Remove Java 7
+ uninstall_package openjdk-7-jdk
_configure_maven
}
@@ -124,8 +125,7 @@ function install_nodejs {
# install_python() - Install Python 2.7 and other tools necessary for development.
function install_python {
- install_package python2.7
- install_package python-dev
+ install_packages python2.7 python-dev
}
# _install_pip() - Install Python Package Manager
diff --git a/bootstrap/vagrant-onap/tests/test_aai b/bootstrap/vagrant-onap/tests/test_aai
index 713238d1a..0fa82d531 100644
--- a/bootstrap/vagrant-onap/tests/test_aai
+++ b/bootstrap/vagrant-onap/tests/test_aai
@@ -54,7 +54,6 @@ function test_clone_all_aai_repos {
# test_compile_aai_repos() - Verify that all the AAI Repositories complile properly
function test_compile_aai_repos {
clone_all_aai_repos
- export compile_repo="True"
compile_aai_repos
asserts_file_exist $aai_src_folder/aai-common/aai-annotations/target/aai-annotations-1.1.0-SNAPSHOT.jar
@@ -84,13 +83,19 @@ function test_compile_aai_repos {
# test_setup_titan() - Verify that Titan Cassandra DB is up and running
function test_setup_titan {
+ clone_all_aai_repos
+ install_hadoop
setup_titan
+
+ # TODO(electrocucaracha): Validate the DB creation
}
# test_start_aai_microservices() - Verify that AAI Resources and Traversal images works
function test_start_aai_microservices {
clone_all_aai_repos
start_aai_microservices
+
+ # TODO(electrocucaracha): Investigate how to run AAI microservices in background
}
# test_install_hbase() - Verify that AAI HBase service is up and running properly