summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-01-04 08:04:22 +0000
committerGerrit Code Review <gerrit@onap.org>2018-01-04 08:04:22 +0000
commit547ab0d2d80a21cdcb513fcd604c4f252b41e531 (patch)
tree12591d9a866b2a2c795c2535b4cb668a71b0ba41
parent908614153b1b4ffc827b1db93afb7f1e496e8f4e (diff)
parentfa9eb9c5c50ca147504cb97226007b82f6909b8a (diff)
Merge "Add OOM provisioning script"
-rw-r--r--bootstrap/vagrant-onap/README.md7
-rw-r--r--bootstrap/vagrant-onap/Vagrantfile76
-rw-r--r--bootstrap/vagrant-onap/doc/source/install/index.rst8
-rwxr-xr-xbootstrap/vagrant-onap/lib/_onap_functions6
-rwxr-xr-xbootstrap/vagrant-onap/lib/config/env-vars2
-rw-r--r--bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py40
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions38
-rwxr-xr-xbootstrap/vagrant-onap/lib/oom220
-rwxr-xr-xbootstrap/vagrant-onap/lib/sdc20
-rw-r--r--bootstrap/vagrant-onap/tools/Run.ps14
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh4
-rwxr-xr-xbootstrap/vagrant-onap/tools/setup_libvirt.sh21
-rwxr-xr-xbootstrap/vagrant-onap/vagrant_utils/postinstall.sh4
13 files changed, 393 insertions, 57 deletions
diff --git a/bootstrap/vagrant-onap/README.md b/bootstrap/vagrant-onap/README.md
index 4e902f0c1..8f143adc1 100644
--- a/bootstrap/vagrant-onap/README.md
+++ b/bootstrap/vagrant-onap/README.md
@@ -43,19 +43,20 @@ current options include:
|:----------:|-------------------------------------|
| aai | Active and Available Inventory |
| appc | Application Controller |
+| ccsdk | Common Controller SDK |
| dcae | Data Collection Analytics & Events |
| mr | Message Router |
| mso | Master Service Orchestrator |
| msb | Microservices Bus Project |
+| multicloud | Multi Cloud |
+| oom | ONAP Operations Manager |
| policy | Policy |
| portal | Portal |
| robot | Robot |
| sdc | Service Design & Creation |
| sdnc | Software Defined Network Controller |
-| vid | Virtual Infrastructure Development |
| vfc | Virtual Function Controller |
-| multicloud | Multi Cloud |
-| ccsdk | Common Controller SDK |
+| vid | Virtual Infrastructure Development |
| vnfsdk | VNF SDK |
| vvp | VNF Validation Program |
|:----------:|-------------------------------------|
diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile
index 753e3565b..01c6afd40 100644
--- a/bootstrap/vagrant-onap/Vagrantfile
+++ b/bootstrap/vagrant-onap/Vagrantfile
@@ -142,6 +142,21 @@ nodes = [
:args => ["multicloud"],
},
{
+ :name => "oom",
+ :ips => ['10.252.0.21', "192.168.50.21"],
+ :macs => [],
+ :cpus => 16,
+ :cpu => "50",
+ :ram => 64 * 1024,
+ :groups => ["individual"],
+ :args => ["oom"],
+ :hd => "60G",
+ :fwds => [
+ { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' },
+ { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' },
+ ]
+ },
+ {
:name => "policy",
:ips => ['10.252.0.13', "192.168.50.13"],
:macs => [],
@@ -180,6 +195,7 @@ nodes = [
:ram => 8 * 1024,
:groups => ["individual"],
:args => ["sdc"],
+ :hd => "20G",
},
{
:name => "sdnc",
@@ -251,6 +267,10 @@ nodes = [
:ram => 8 * 1024,
:groups => ["individual"],
:args => ['openstack'],
+ :fwds => [
+ { :guest => 80, :host => 8888, :guest_ip => '192.168.53.4' },
+ { :guest => 6080, :host => 6080, :guest_ip => '192.168.53.4' },
+ ]
}
]
@@ -322,15 +342,14 @@ end
Vagrant.configure("2") do |config|
- # PROXY definitions
- if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil and ENV['no_proxy'] != nil
+ # PROXY definitions
+ if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
if not Vagrant.has_plugin?('vagrant-proxyconf')
system 'vagrant plugin install vagrant-proxyconf'
raise 'vagrant-proxyconf was installed but it requires to execute again'
end
config.proxy.http = ENV['http_proxy']
config.proxy.https = ENV['https_proxy']
- config.proxy.no_proxy = ENV['no_proxy']
configuration['socks_proxy'] = ENV['socks_proxy']
end
@@ -357,6 +376,15 @@ Vagrant.configure("2") do |config|
nodes.each do |node|
config.vm.define node[:name] do |nodeconfig|
+ # NO_PROXY definitions
+ if ENV['no_proxy'] != nil
+ if not Vagrant.has_plugin?('vagrant-proxyconf')
+ system 'vagrant plugin install vagrant-proxyconf'
+ raise 'vagrant-proxyconf was installed but it requires to execute again'
+ end
+ config.proxy.no_proxy = node[:ips].join(",") + "," + ENV['no_proxy']
+ end
+
# Common Settings:
nodeconfig.vm.provider "virtualbox" do |vbox|
@@ -378,12 +406,22 @@ Vagrant.configure("2") do |config|
:adapter => 3,
:ip => node[:ips][1],
:type => :static
+
+ # Set Storage
+ if node.has_key? :hd
+ volume_file = node[:name] + '-vol1-data.vdi'
+ unless File.exist?(volume_file)
+ vbox.customize ['createhd', '--filename', volume_file, '--size', node[:hd]]
+ end
+ vbox.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', volume_file]
+ end
end
nodeconfig.vm.provider "libvirt" do |lbox|
lbox.memory = node[:ram]
lbox.nested = true
lbox.cpu_mode = 'host-passthrough'
+ lbox.cpus = node[:cpus]
# Set Network
nodeconfig.vm.network :private_network,
@@ -392,6 +430,20 @@ Vagrant.configure("2") do |config|
nodeconfig.vm.network :private_network,
:ip => node[:ips][1],
:type => :static
+
+ # Set Storage
+ if node.has_key? :hd
+ lbox.storage :file, bus: 'sata', device: 'sda', size: node[:hd]
+ end
+ end
+ if node.has_key? :fwds
+ node[:fwds].each do |fwd|
+ nodeconfig.vm.network :forwarded_port,
+ :guest => fwd[:guest],
+ :guest_ip => fwd[:guest_ip],
+ :host => fwd[:host],
+ :host_ip => "0.0.0.0"
+ end
end
nodeconfig.vm.provider :openstack do |obox|
@@ -426,28 +478,14 @@ Vagrant.configure("2") do |config|
# Set Sync Folder
nodeconfig.vm.synced_folder ".", "/vagrant", disabled: true
- nodeconfig.vm.synced_folder './opt', '/opt/', create: true
- nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true
+ nodeconfig.vm.synced_folder './opt', '/opt/', create: true, type: "nfs"
+ nodeconfig.vm.synced_folder './lib', '/var/onap/', create: true, type: "nfs"
if !is_windows
nodeconfig.vm.synced_folder '~/.m2', '/root/.m2/', create: true
end
# Specific settings:
- # Set Storage (For SDC or All-in-one)
- if node[:name].include?("all-in-one") || node[:name].include?("sdc")
- nodeconfig.vm.provider "virtualbox" do |v|
- unless File.exist?(sdc_volume)
- v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
- end
- v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
- end
-
- nodeconfig.vm.provider "libvirt" do |v|
- v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
- end
- end
-
if node[:name].include? "testing"
nodeconfig.vm.synced_folder './tests', '/var/onap_tests/', create: true
test_suite = ENV.fetch('TEST_SUITE', '*')
diff --git a/bootstrap/vagrant-onap/doc/source/install/index.rst b/bootstrap/vagrant-onap/doc/source/install/index.rst
index 83c68b66f..62f57e66f 100644
--- a/bootstrap/vagrant-onap/doc/source/install/index.rst
+++ b/bootstrap/vagrant-onap/doc/source/install/index.rst
@@ -17,12 +17,15 @@ Ubuntu 14.04 ("Trusty")
$ wget -q https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
$ sudo dpkg -i vagrant_2.0.1_x86_64.deb
+
$ echo "deb http://download.virtualbox.org/virtualbox/debian trusty contrib" >> /etc/apt/sources.list
$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo apt-get update -y
$ sudo apt-get install -y virtualbox-5.1 dkms
+ $ sudo apt install -y nfs-kernel-server
+
.. end
CentOS
@@ -32,10 +35,13 @@ CentOS
$ wget -q https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.rpm
$ sudo yum install vagrant_2.0.1_x86_64.rpm
+
$ wget -q http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo -P /etc/yum.repos.d
$ sudo yum --enablerepo=epel install dkms
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | rpm --import -
- $ sudo yum install VirtualBox-5.1
+ $ sudo yum install -y VirtualBox-5.1
+
+ $ sudo yum install -y nfs-utils nfs-utils-lib
.. end
diff --git a/bootstrap/vagrant-onap/lib/_onap_functions b/bootstrap/vagrant-onap/lib/_onap_functions
index cedd6f0a3..960b298ef 100755
--- a/bootstrap/vagrant-onap/lib/_onap_functions
+++ b/bootstrap/vagrant-onap/lib/_onap_functions
@@ -15,7 +15,7 @@ function create_configuration_files {
# docker_openecomp_login() - Login to OpenECOMP Docker Hub
function docker_openecomp_login {
install_docker
- docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
+ docker login -u ${nexus_username:-docker} -p ${nexus_password:-docker} ${nexus_docker_repo:-nexus3.onap.org:10001}
}
# pull_openecomp_image() - Pull Docker container image from a Docker Registry Hub
@@ -23,7 +23,7 @@ function pull_openecomp_image {
local image=$1
local tag=$2
docker_openecomp_login
- pull_docker_image $nexus_docker_repo/openecomp/${image}:${docker_version-latest} $tag
+ pull_docker_image ${nexus_docker_repo:-nexus3.onap.org:10001}/openecomp/${image}:${docker_version-latest} $tag
docker logout
}
@@ -32,7 +32,7 @@ function pull_onap_image {
local image=$1
local tag=$2
docker_openecomp_login
- pull_docker_image $nexus_docker_repo/onap/${image}:${docker_version-latest} $tag
+ pull_docker_image ${nexus_docker_repo:-nexus3.onap.org:10001}/onap/${image}:${docker_version-latest} $tag
docker logout
}
diff --git a/bootstrap/vagrant-onap/lib/config/env-vars b/bootstrap/vagrant-onap/lib/config/env-vars
index 1eddf673e..a55557ae7 100755
--- a/bootstrap/vagrant-onap/lib/config/env-vars
+++ b/bootstrap/vagrant-onap/lib/config/env-vars
@@ -13,6 +13,7 @@ src_folders=(
["msb"]="$git_src_folder/msb"
["mso"]="$git_src_folder/mso"
["multicloud"]="$git_src_folder/multicloud"
+["oom"]="$git_src_folder/oom"
["policy"]="$git_src_folder/policy"
["portal"]="$git_src_folder/portal"
["robot"]="$git_src_folder/testsuite"
@@ -50,6 +51,7 @@ dcae/utils/buildtools"
["multicloud"]="multicloud multicloud/framework multicloud/openstack \
multicloud/openstack/vmware multicloud/openstack/windriver \
multicloud/azure"
+["oom"]="oom oom/registrator"
["policy"]="policy/api policy/common policy/docker \
policy/drools-applications policy/drools-pdp policy/engine \
policy/gui policy/pap policy/pdp"
diff --git a/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py b/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py
new file mode 100644
index 000000000..6b5a6e9f6
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py
@@ -0,0 +1,40 @@
+import requests
+import os
+import base64
+
+RANCHER_URL = str(os.environ['RANCHER_URL'])
+RANCHER_ENVIRONMENT_ID = str(os.environ['RANCHER_ENVIRONMENT'])
+data = requests.post(RANCHER_URL + '/v1/projects/' + RANCHER_ENVIRONMENT_ID + '/apikeys',
+ {"accountId": RANCHER_ENVIRONMENT_ID,
+ "description": "ONAP on Kubernetes",
+ "name": "ONAP on Kubernetes",
+ "publicValue": "string",
+ "secretValue": "password"})
+json_dct = data.json()
+access_key = json_dct['publicValue']
+secret_key = json_dct['secretValue']
+auth_header = 'Basic ' + base64.b64encode(access_key + ':' + secret_key)
+token = "\"" + str(base64.b64encode(auth_header)) + "\""
+dct = \
+"""
+apiVersion: v1
+kind: Config
+clusters:
+- cluster:
+ api-version: v1
+ insecure-skip-tls-verify: true
+ server: "{}/r/projects/{}/kubernetes:6443"
+ name: "onap_on_kubernetes"
+contexts:
+- context:
+ cluster: "onap_on_kubernetes"
+ user: "onap_on_kubernetes"
+ name: "onap_on_kubernetes"
+current-context: "onap_on_kubernetes"
+users:
+- name: "onap_on_kubernetes"
+ user:
+ token: {}
+""".format(RANCHER_URL, RANCHER_ENVIRONMENT_ID, token)
+with open("config", "w") as file:
+ file.write(dct)
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index 08c6d916b..9531fc794 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -139,6 +139,7 @@ function _configure_docker_settings {
local docker_conf_backup=/tmp/docker.backup
local docker_conf=/etc/default/docker
local chameleonsocks_filename=chameleonsocks.sh
+ local max_concurrent_downloads=${1:-3}
cp $docker_conf $docker_conf_backup
if [ $http_proxy ]; then
@@ -160,7 +161,20 @@ function _configure_docker_settings {
fi
rm $docker_conf_backup
- echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> $docker_conf
+ echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --max-concurrent-downloads $max_concurrent_downloads \"" >> $docker_conf
+ usermod -aG docker $USER
+
+ source /etc/os-release || source /usr/lib/os-release
+ case ${ID,,} in
+ *suse)
+ ;;
+ ubuntu|debian)
+ service docker restart
+ sleep 10
+ ;;
+ rhel|centos|fedora)
+ ;;
+ esac
}
# install_nodejs() - Download and install NodeJS
@@ -208,7 +222,7 @@ function install_python_requirements {
# install_docker() - Download and install docker-engine
function install_docker {
- if is_package_installed docker-ce; then
+ if $(docker version &>/dev/null); then
return
fi
source /etc/os-release || source /usr/lib/os-release
@@ -229,8 +243,6 @@ function install_docker {
install_package docker-ce
_configure_docker_settings
- service docker restart
- sleep 10
}
# pull_docker_image() - Pull Docker container image from the Public Docker Registry Hub
@@ -265,8 +277,8 @@ function _install_ODL {
if [ ! -d /opt/opendaylight/current ]; then
mkdir -p /opt/opendaylight/
wget "https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/"$odl_version"/distribution-karaf-"$odl_version".tar.gz" -P /opt/
- tar xvf "/opt/distribution-karaf-"$odl_version".tar.gz" -C /opt/
- mv "/opt/distribution-karaf-"$odl_version /opt/opendaylight/current
+ tar xvf "/opt/distribution-karaf-"$odl_version".tar.gz" -C /tmp/
+ mv "/tmp/distribution-karaf-"$odl_version /opt/opendaylight/current
rm -rf "/opt/distribution-karaf-"$odl_version".tar.gz"
fi
}
@@ -356,3 +368,17 @@ function build_docker_image {
eval $docker_build
popd
}
+
+# mount_external_partition() - Create partition and mount the external volume
+function mount_external_partition {
+ local dev_name="/dev/$1"
+ local mount_dir=$2
+
+ sfdisk $dev_name << EOF
+;
+EOF
+ mkfs -t ext4 ${dev_name}1
+ mkdir -p $mount_dir
+ mount ${dev_name}1 $mount_dir
+ echo "${dev_name}1 $mount_dir ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
+}
diff --git a/bootstrap/vagrant-onap/lib/oom b/bootstrap/vagrant-onap/lib/oom
new file mode 100755
index 000000000..ef7e5ede5
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/oom
@@ -0,0 +1,220 @@
+#!/bin/bash
+
+source /var/onap/functions
+
+RANCHER_PORT=8880
+oom_delay=30
+export RANCHER_URL=http://localhost:$RANCHER_PORT
+export RANCHER_ACCESS_KEY='access_key'
+export RANCHER_SECRET_KEY='secret_key'
+
+# _install_docker() - Function that installs Docker version for Rancher
+function _install_docker {
+ if ! $(docker version &>/dev/null); then
+ curl https://releases.rancher.com/install-docker/1.12.sh | sh
+ _configure_docker_settings 15
+ fi
+}
+
+# _pull_rancher_images() - Function that retrieves Rancher images required for k8s
+function _pull_rancher_images {
+ for image in "net:v0.13.5" "k8s:v1.8.5-rancher3" \
+"lb-service-rancher:v0.7.17" "network-manager:v0.7.18" "metadata:v0.9.5" \
+"kubectld:v0.8.5" "kubernetes-agent:v0.6.6" "dns:v0.15.3" \
+"kubernetes-auth:v0.0.8" "healthcheck:v0.3.3" "etcd:v2.3.7-13" \
+"etc-host-updater:v0.0.3" "net:holder"; do
+ pull_docker_image rancher/$image &
+ done
+}
+
+# _pull_k8s_images() - Function that retrieves Google k8s images
+function _pull_k8s_images {
+ for image in "kubernetes-dashboard-amd64:v1.7.1" \
+"k8s-dns-sidecar-amd64:1.14.5" "k8s-dns-kube-dns-amd64:1.14.5" \
+"k8s-dns-dnsmasq-nanny-amd64:1.14.5" "heapster-influxdb-amd64:v1.3.3" \
+"heapster-grafana-amd64:v4.4.3" "heapster-amd64:v1.4.0" "pause-amd64:3.0"; do
+ pull_docker_image gcr.io/google_containers/$image &
+ done
+}
+
+# _install_rancher() - Function that installs Rancher CLI and container
+function _install_rancher {
+ local rancher_version=v0.6.5
+ local rancher_server_version=v1.6.10
+ local rancher_server=rancher/server:$rancher_server_version
+
+ if [ ! -d /opt/rancher/current ]; then
+ mkdir -p /opt/rancher/current
+ wget https://github.com/rancher/cli/releases/download/$rancher_version/rancher-linux-amd64-$rancher_version.tar.gz
+ tar -xzf rancher-linux-amd64-$rancher_version.tar.gz -C /tmp
+ mv /tmp/rancher-$rancher_version/rancher /opt/rancher/current/
+ fi
+
+ _install_docker
+ pull_docker_image $rancher_server
+ run_docker_image -d --restart=unless-stopped -p $RANCHER_PORT:8080 $rancher_server
+ while true; do
+ if curl --fail -X GET $RANCHER_URL; then
+ break
+ fi
+ echo "waiting for racher"
+ sleep $oom_delay
+ done
+}
+
+# _install_kubernetes() - Function that deploys kubernetes via RancherOS host registration
+function _install_kubernetes {
+ local rancher_agent_version=v1.2.7
+ local rancher_agent=rancher/agent:$rancher_agent_version
+
+ _install_rancher
+
+ _pull_rancher_images
+ _pull_k8s_images
+ pull_docker_image $rancher_agent
+ _wait_docker_pull
+
+ pushd /opt/rancher/current/
+ export RANCHER_ENVIRONMENT=`./rancher env create -t kubernetes onap_on_kubernetes`
+ popd
+
+ install_python_package rancher-agent-registration
+ export no_proxy=$no_proxy,$IP_ADDRESS
+ rancher-agent-registration --host-ip $IP_ADDRESS --url http://$IP_ADDRESS:$RANCHER_PORT --environment $RANCHER_ENVIRONMENT --key $RANCHER_ACCESS_KEY --secret $RANCHER_SECRET_KEY
+}
+
+# _install_kubectl() - Function that installs kubectl as client for kubernetes
+function _install_kubectl {
+ if ! $(kubectl version &>/dev/null); then
+ rm -rf ~/.kube
+ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
+ chmod +x ./kubectl
+ mv ./kubectl /usr/local/bin/kubectl
+ mkdir ~/.kube
+ pushd ~/.kube
+ python /var/onap/files/kubectl_config_generator.py
+ popd
+ fi
+}
+
+# _install_helm() - Function that install Kubernetes Package Manager
+function _install_helm {
+ local helm_version=v2.3.0
+
+ if ! $(helm version &>/dev/null); then
+ wget http://storage.googleapis.com/kubernetes-helm/helm-${helm_version}-linux-amd64.tar.gz
+ tar -zxvf helm-${helm_version}-linux-amd64.tar.gz -C /tmp
+ mv /tmp/linux-amd64/helm /usr/local/bin/helm
+ helm init
+ fi
+}
+
+# _pull_images_from_yaml() - Function that parses a yaml file and pull their images
+function _pull_images_from_yaml_file {
+ local values_file=$1
+ local prefix=$2
+ local s='[[:space:]]*'
+ local w='[a-zA-Z0-9_]*'
+ fs=`echo @|tr @ '\034'`
+
+ for line in $(sed -ne "s|^\($s\):|\1|" \
+-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
+-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $values_file |
+awk -F$fs '{
+indent = length($1)/2;
+vname[indent] = $2;
+for (i in vname) {
+ if (i > indent) {
+ delete vname[i]}
+ }
+ if (length($3) > 0) {
+ vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])(".")}
+ printf("%s%s%s=%s\n", "'$prefix'",vn, $2, $3);
+ }
+}' | grep image); do
+ echo $line
+ if echo $line | grep -q Version ; then
+ pull_docker_image "$image_name:$(echo $line | awk -F "=" '{print $2}')" &
+ else
+ image_name=`echo ${line#*=}`
+ if [[ ${image_name#*${nexus_docker_repo:-nexus3.onap.org:10001}} == *:* ]]; then
+ pull_docker_image $image_name &
+ else
+ pull_docker_image $image_name:latest
+ fi
+ fi
+ done
+}
+
+# _wait_docker_pull() - Function that waits for all docker pull processes
+function _wait_docker_pull {
+ local counter=150
+
+ while [ $(ps -ef | grep "docker pull" | wc -l) -gt 1 ]; do
+ sleep $oom_delay
+ counter=$((counter - 1))
+ if [ "$counter" -eq 0 ]; then
+ break
+ fi
+ done
+}
+
+# get_oom_images() - Function that retrieves ONAP images from official hub
+function get_oom_images {
+ if [[ "$build_image" == "True" ]]; then
+ # TODO(electrocucaracha): Create a function for calling the build docker function of every ONAP project
+ echo "Not Implemented"
+ else
+ if [[ "$clone_repo" != "True" ]]; then
+ clone_repos "oom"
+ fi
+
+ docker_openecomp_login
+ for values_file in `find ${src_folders[oom]}/kubernetes -name values.yaml -type f`; do
+ _pull_images_from_yaml_file $values_file
+ done
+ docker logout
+ _wait_docker_pull
+ fi
+}
+
+# _install_oom() - Function that clones OOM and deploys ONAP
+function install_oom {
+ if [[ "$clone_repo" != "True" ]]; then
+ clone_repos "oom"
+ fi
+ pushd ${src_folders[oom]}/kubernetes/oneclick
+ source setenv.bash
+
+ pushd ${src_folders[oom]}/kubernetes/config
+ cp onap-parameters-sample.yaml onap-parameters.yaml
+ ./createConfig.sh -n onap
+ popd
+
+ for app in consul msb mso message-router sdnc vid robot portal policy appc aai sdc dcaegen2 log cli multicloud clamp vnfsdk uui aaf vfc kube2msb; do
+ ./createAll.bash -n onap -a $app
+ done
+ popd
+}
+
+# init_oom() - Function that deploys ONAP using OOM
+function init_oom {
+ mount_external_partition sda /var/lib/docker/
+ _install_kubernetes
+ _install_kubectl
+ _install_helm
+ if [[ "$clone_repo" == "True" ]]; then
+ clone_repos "oom"
+ fi
+
+ if [[ "$skip_get_images" == "False" ]]; then
+ get_oom_images
+ if [[ "$skip_install" == "False" ]]; then
+ until kubectl cluster-info; do
+ echo "waiting for kubernetes host"
+ sleep $oom_delay
+ done
+ install_oom
+ fi
+ fi
+}
diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc
index 9b0a69ee4..fee583d79 100755
--- a/bootstrap/vagrant-onap/lib/sdc
+++ b/bootstrap/vagrant-onap/lib/sdc
@@ -2,24 +2,6 @@
source /var/onap/functions
-# _mount_external_partition() - Create partition and mount the external volume
-function _mount_external_partition {
- cat <<EOL > /tmp/sdc_ext_volume_partitions.txt
-# partition table of /dev/sdb
-unit: sectors
-
-/dev/sdb1 : start= 2048, size=209713152, Id=83
-/dev/sdb2 : start= 0, size= 0, Id= 0
-/dev/sdb3 : start= 0, size= 0, Id= 0
-/dev/sdb4 : start= 0, size= 0, Id= 0
-EOL
- sfdisk --force /dev/sdb < /tmp/sdc_ext_volume_partitions.txt
- mkfs -t ext4 /dev/sdb1
- mkdir -p /data
- mount /dev/sdb1 /data
- echo "/dev/sdb1 /data ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
-}
-
# _init_data_folders() - Function that initialize the data folders
function _init_data_folders {
mkdir -p /data/environments
@@ -82,7 +64,7 @@ function install_sdc {
# init_sdc() - Function that initialize SDC services
function init_sdc {
- _mount_external_partition
+ mount_external_partition sdb /data/
if [[ "$clone_repo" == "True" ]]; then
clone_repos "sdc"
if [[ "$compile_repo" == "True" ]]; then
diff --git a/bootstrap/vagrant-onap/tools/Run.ps1 b/bootstrap/vagrant-onap/tools/Run.ps1
index 1592d6531..de57a1564 100644
--- a/bootstrap/vagrant-onap/tools/Run.ps1
+++ b/bootstrap/vagrant-onap/tools/Run.ps1
@@ -31,7 +31,7 @@ https://wiki.onap.org/display/DW/ONAP+on+Vagrant
#>
Param(
- [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "testing")]
+ [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom", "testing")]
[Parameter(Mandatory=$True,Position=0)]
[ValidateNotNullOrEmpty()]
@@ -86,7 +86,7 @@ $env:SKIP_INSTALL=$skip_install
switch ($Command)
{
"all_in_one" { $env:DEPLOY_MODE="all-in-one" }
- { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb") -contains $_ } { $env:DEPLOY_MODE="individual" }
+ { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom") -contains $_ } { $env:DEPLOY_MODE="individual" }
"testing"
{
$env:DEPLOY_MODE="testing"
diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh
index 6f1cb54d4..27e0aa31e 100755
--- a/bootstrap/vagrant-onap/tools/run.sh
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -16,7 +16,7 @@ Optional arguments:
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|vfc|vnfsdk|multicloud|ccsdk|vvp|openstack|msb Deploy chosen service.
+ dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|vnfsdk|multicloud|ccsdk|vvp|openstack|msb|oom Deploy chosen service.
testing Deploy in testing mode.
EOF
}
@@ -65,7 +65,7 @@ case $COMMAND in
"all_in_one" )
export DEPLOY_MODE='all-in-one'
;;
- "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" | "vvp" | "openstack" | "msb" )
+ "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" | "vvp" | "openstack" | "msb" | "oom" )
export DEPLOY_MODE='individual'
;;
"testing" )
diff --git a/bootstrap/vagrant-onap/tools/setup_libvirt.sh b/bootstrap/vagrant-onap/tools/setup_libvirt.sh
new file mode 100755
index 000000000..54003d691
--- /dev/null
+++ b/bootstrap/vagrant-onap/tools/setup_libvirt.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+export VAGRANT_DEFAULT_PROVIDER=libvirt
+
+source /etc/os-release || source /usr/lib/os-release
+case ${ID,,} in
+ *suse)
+ ;;
+ ubuntu|debian)
+ # vagrant-libvirt dependencies
+ sudo apt-get install -y qemu libvirt-bin ebtables dnsmasq libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
+
+ # NFS
+ sudo apt-get install -y nfs-kernel-server
+ ;;
+ rhel|centos|fedora)
+ PKG_MANAGER=$(which dnf || which yum)
+ sudo $PKG_MANAGER install -y qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm
+ ;;
+esac
+vagrant plugin install vagrant-libvirt
diff --git a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
index 4a014dc70..3b5017a66 100755
--- a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
+++ b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
@@ -20,7 +20,7 @@ for serv in $@; do
source /var/onap/${serv}
configure_service ${serv}_serv.sh
init_${serv}
- echo "source /var/onap/${serv}" >> ~/.profile
+ echo "source /var/onap/${serv}" >> ~/.bashrc
done
-echo "source /var/onap/functions" >> ~/.profile
+echo "source /var/onap/functions" >> ~/.bashrc