summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2017-11-08 07:28:28 -0800
committerVictor Morales <victor.morales@intel.com>2017-11-08 07:36:16 -0800
commit4ab71c18e0c7ab0ce299a8708488ab84a97aea82 (patch)
tree45e83c3d83e9d5dc46c27c5c2aa9e8c9a1e18a23 /bootstrap/vagrant-onap
parent6dbd7da003f938e2dbd73944624e8679027c35ca (diff)
Add OpenStack support
This change allows the provisioning of an All-in-One OpenStack deployment through ansible-kolla project. Given that it uses System D this adds an exception to use Ubuntu Xenial release. Change-Id: I57973a1b5cc331654fbabf7932ddcfef817afedf Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-Id: INT-329
Diffstat (limited to 'bootstrap/vagrant-onap')
-rw-r--r--bootstrap/vagrant-onap/README.md3
-rw-r--r--bootstrap/vagrant-onap/Vagrantfile13
-rwxr-xr-xbootstrap/vagrant-onap/lib/commons2
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions18
-rwxr-xr-xbootstrap/vagrant-onap/lib/openstack53
-rw-r--r--bootstrap/vagrant-onap/tools/Run.ps15
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh4
-rwxr-xr-xbootstrap/vagrant-onap/vagrant_utils/postinstall.sh6
8 files changed, 94 insertions, 10 deletions
diff --git a/bootstrap/vagrant-onap/README.md b/bootstrap/vagrant-onap/README.md
index b0e1ee26b..3e1fa1223 100644
--- a/bootstrap/vagrant-onap/README.md
+++ b/bootstrap/vagrant-onap/README.md
@@ -57,8 +57,11 @@ current options include:
| ccsdk | Common Controller SDK |
| vnfsdk | VNF SDK |
| vvp | VNF Validation Program |
+|:----------:|-------------------------------------|
| all_in_one | All ONAP services in a VM |
| testing | Unit Test VM |
+|:----------:|-------------------------------------|
+| openstack | OpenStack Deployment |
#### Generating documentation
diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile
index 4242919f7..a0f3a1926 100644
--- a/bootstrap/vagrant-onap/Vagrantfile
+++ b/bootstrap/vagrant-onap/Vagrantfile
@@ -231,6 +231,16 @@ nodes = [
:ram => 4 * 1024,
:groups => ["individual"],
:args => ['vvp'],
+ },
+ {
+ :name => "openstack",
+ :ips => ['10.252.3.3', "192.168.53.3"],
+ :macs => [],
+ :cpus => 2,
+ :cpu => "50",
+ :ram => 8 * 1024,
+ :groups => ["individual"],
+ :args => ['openstack'],
}
]
@@ -374,6 +384,9 @@ Vagrant.configure("2") do |config|
# Set Box type
nodeconfig.vm.box = box[provider]
+ if "openstack" == node[:name]
+ nodeconfig.vm.box = "ubuntu/xenial64"
+ end
# Set Node name
nodeconfig.vm.hostname = node[:name]
diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons
index 1c45413fa..5d0c69108 100755
--- a/bootstrap/vagrant-onap/lib/commons
+++ b/bootstrap/vagrant-onap/lib/commons
@@ -34,7 +34,7 @@ function is_package_installed {
*suse)
;;
ubuntu|debian)
- dpkg -s "$@" > /dev/null 2> /dev/null
+ dpkg -s "$@" > /dev/null
;;
rhel|centos|fedora)
;;
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index cc9052304..25fbba3e9 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -5,7 +5,8 @@ source /var/onap/_composed_functions
source /var/onap/_onap_functions
export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' |sort -n | head -1)
-export IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+export NIC=$(ip route get 8.8.8.8 | awk '{ print $5; exit }')
+export IP_ADDRESS=$(ifconfig $NIC | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
mvn_conf_file=/root/.m2/settings.xml
git_src_folder=/opt
@@ -16,6 +17,14 @@ function configure_dns {
resolvconf -u
}
+# get_next_ip() - Function that provides the next ip
+function get_next_ip {
+ local ip=${1:-$IP_ADDRESS}
+ ip_hex=$(printf '%.2X%.2X%.2X%.2X\n' `echo $ip | sed -e 's/\./ /g'`)
+ next_ip_hex=$(printf %.8X `echo $(( 0x$ip_hex + 1 ))`)
+ echo $(printf '%d.%d.%d.%d\n' `echo $next_ip_hex | sed -r 's/(..)/0x\1 /g'`)
+}
+
# _git_timed() - git can sometimes get itself infinitely stuck with transient network
# errors or other issues with the remote end. This wraps git in a
# timeout/retry loop and is intended to watch over non-local git
@@ -142,7 +151,6 @@ function _configure_docker_settings {
rm $docker_conf_backup
echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock\"" >> $docker_conf
- usermod -a -G docker vagrant
}
# install_nodejs() - Download and install NodeJS
@@ -165,17 +173,17 @@ function install_python {
# _install_pip() - Install Python Package Manager
function _install_pip {
install_python
- if [ ! -f /usr/local/bin/pip ]; then
+ if ! which pip; then
curl -sL https://bootstrap.pypa.io/get-pip.py | python
fi
}
# install_python_package() - Install a python module
function install_python_package {
- local python_package=$1
+ local python_packages=$@
_install_pip
- pip install $python_package
+ pip install $python_packages
}
# install_docker() - Download and install docker-engine
diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack
new file mode 100755
index 000000000..6fe20d94c
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/openstack
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+source /var/onap/functions
+
+# deploy_openstack() - Function that provisions an OpenStack deployment
+function deploy_openstack {
+ local network_id=${1:-"192.168.53.0"}
+ nic=$(ip route get $network_id | awk '{ print $4; exit }')
+ ip_address=$(ip route get $network_id | awk '{ print $6; exit }')
+ internal_vip_address=$(get_next_ip $ip_address)
+
+ install_docker
+ mkdir -p /etc/systemd/system/docker.service.d
+ tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF'
+[Service]
+MountFlags=shared
+EOF
+ install_packages python-dev libffi-dev gcc libssl-dev python-selinux gcc
+
+ install_python_package ansible docker kolla-ansible python-openstackclient
+ source /etc/os-release || source /usr/lib/os-release
+ case ${ID,,} in
+ *suse)
+ ;;
+ ubuntu|debian)
+ service docker restart
+
+ cp -r /usr/local/share/kolla-ansible/etc_examples/kolla /etc/kolla/
+ cp /usr/local/share/kolla-ansible/ansible/inventory/* .
+ sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"ubuntu\"/g" /etc/kolla/globals.yml
+ ;;
+ rhel|centos|fedora)
+ systemctl daemon-reload
+ systemctl restart docker
+
+ cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/
+ cp /usr/share/kolla-ansible/ansible/inventory/* .
+ sed -i "s/#kolla_base_distro: \"centos\"/kolla_base_distro: \"centos\"/g" /etc/kolla/globals.yml
+ ;;
+ esac
+ kolla-genpwd
+ sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml
+
+ sed -i "s/#network_interface: \"eth0\"/network_interface: \"$nic\"/g" /etc/kolla/globals.yml
+ sed -i "s/kolla_internal_vip_address: \"10.10.10.254\"/kolla_internal_vip_address: \"$internal_vip_address\"/g" /etc/kolla/globals.yml
+ sed -i "s/#api_interface: \"{{ network_interface }}\"/api_interface: \"{{ network_interface }}\"/g" /etc/kolla/globals.yml
+ echo "$ip_address $(hostname)" >> /etc/hosts
+
+ kolla-ansible pull -i all-in-one
+ kolla-ansible deploy -i all-in-one
+ kolla-ansible post-deploy
+ echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc
+}
diff --git a/bootstrap/vagrant-onap/tools/Run.ps1 b/bootstrap/vagrant-onap/tools/Run.ps1
index a74dcb72d..7dfc83b37 100644
--- a/bootstrap/vagrant-onap/tools/Run.ps1
+++ b/bootstrap/vagrant-onap/tools/Run.ps1
@@ -31,7 +31,8 @@ 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", "testing")]
+ [ValidateSet("all_in_one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "testing")]
+
[Parameter(Mandatory=$True,Position=0)]
[ValidateNotNullOrEmpty()]
[String]
@@ -85,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") -contains $_ } { $env:DEPLOY_MODE="individual" }
+ { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack") -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 eaa49431e..3c2134f8d 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 Deploy chosen service.
+ dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|vnfsdk|multicloud|ccsdk|vvp|openstack 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" )
+ "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" | "vvp" | "openstack" )
export DEPLOY_MODE='individual'
;;
"testing" )
diff --git a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
index c1b1c33a2..8bf116d1d 100755
--- a/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
+++ b/bootstrap/vagrant-onap/vagrant_utils/postinstall.sh
@@ -4,6 +4,12 @@ if [[ "$debug" == "True" ]]; then
set -o xtrace
fi
+if [[ "$1" == "openstack" ]]; then
+ source /var/onap/openstack
+ deploy_openstack
+ exit
+fi
+
source /var/onap/functions
update_repos