aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/openstack
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-01-10 07:20:54 -0800
committerVictor Morales <victor.morales@intel.com>2018-01-10 07:20:54 -0800
commit80f144b8667c256594abc33f48f066331051aea1 (patch)
tree8a90deccf862217233fa4ab6c0c6e4d855aeb485 /bootstrap/vagrant-onap/lib/openstack
parent9dad765cfbdfee5c8e4c660c24586a0d7b95ff76 (diff)
Enable ODL
This patch enable the alternative to provision OpenDaylight as a SDN Controller for OpenStack using Kolla as an installer. Change-Id: I4837cc7600cad07600dd5202aa9695ca8b2a8c70 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: INT-329
Diffstat (limited to 'bootstrap/vagrant-onap/lib/openstack')
-rwxr-xr-xbootstrap/vagrant-onap/lib/openstack84
1 files changed, 51 insertions, 33 deletions
diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack
index 6fe20d94c..205d7ae80 100755
--- a/bootstrap/vagrant-onap/lib/openstack
+++ b/bootstrap/vagrant-onap/lib/openstack
@@ -2,52 +2,70 @@
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)
+kolla_config=/etc/kolla
+kolla_build=$kolla_config/kolla-build.conf
+kolla_passwords=$kolla_config/passwords.yml
+kolla_globals=$kolla_config/globals.yml
+kolla_inventory=/var/onap/files/all-in-one
+# install_dependencies() - Function that installs Kolla-Ansible requirements
+function install_dependencies {
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
+ systemctl daemon-reload
+ systemctl restart docker
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
+}
+
+# configure_deploy() - Function that modifies configuration files
+function configure_deploy {
+ local network_id=$1
+ local enable_opendaylight=${2-False}
+ local openstack_services="main = ceilometer,cinder,glance,heat,horizon,isci,keystone,neutron,nova-,swift"
+ 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)
+
+ mkdir -p $kolla_config
+ cp /var/onap/files/globals.yml $kolla_globals
+ cp /var/onap/files/passwords.yml $kolla_passwords
+ cp /var/onap/files/kolla-build.conf $kolla_build
kolla-genpwd
- sed -i "s/#openstack_release: \"\"/openstack_release: \"master\"/g" /etc/kolla/globals.yml
+ echo "network_interface: \"$nic\"" >> $kolla_globals
+ echo "kolla_internal_vip_address: \"$internal_vip_address\"" >> $kolla_globals
+ echo "api_interface: \"{{ network_interface }}\"" >> $kolla_globals
+ if [[ $enable_opendaylight == True ]]; then
+ echo "enable_opendaylight: \"yes\"" >> $kolla_globals
+ openstack_services+=",opendaylight"
+ fi
+ echo $openstack_services >> $kolla_build
- 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
+}
+
+# get_openstack_images() - Function that retrieves or builds docker images
+function get_openstack_images {
+ if [[ "$build_image" == "True" ]]; then
+ install_python_package kolla
+ kolla-build --config-file $kolla_build
+ else
+ kolla-ansible pull -i $kolla_inventory
+ fi
+}
+
+# deploy_openstack() - Function that provisions an OpenStack deployment
+function deploy_openstack {
+ install_dependencies
+ configure_deploy ${1:-"192.168.53.0"} "True"
- kolla-ansible pull -i all-in-one
- kolla-ansible deploy -i all-in-one
+ get_openstack_images
+ kolla-ansible deploy -i $kolla_inventory
kolla-ansible post-deploy
echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc
}