From f5b30fa73a637c93d764467336d9721060dbe15a Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Mon, 8 Jun 2015 13:11:56 -0400 Subject: Fixes external network bridge and adds quota limits Issue where external network router port was being placed on br-int. Port will now be properly added to br-ex. Patch also includes increased quota limits for neutron. JIRA: BGS-65 Change-Id: I30de85e4ef241b567a90011d08c0cb4ad97fe411 Signed-off-by: Tim Rozet --- common/puppet-opnfv/manifests/controller_networker.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/controller_networker.pp b/common/puppet-opnfv/manifests/controller_networker.pp index 157bc8f..b148ec8 100644 --- a/common/puppet-opnfv/manifests/controller_networker.pp +++ b/common/puppet-opnfv/manifests/controller_networker.pp @@ -302,6 +302,7 @@ class opnfv::controller_networker { class { "quickstack::pacemaker::neutron": agent_type => $this_agent, enable_tunneling => 'true', + external_network_bridge => 'br-ex', ml2_mechanism_drivers => $ml2_mech_drivers, ml2_network_vlan_ranges => ["physnet1:10:50"], odl_controller_ip => $odl_control_ip, @@ -309,6 +310,18 @@ class opnfv::controller_networker { ovs_tunnel_iface => $ovs_tunnel_if, ovs_tunnel_types => ["vxlan"], verbose => 'true', + neutron_conf_additional_params => { default_quota => 'default', + quota_network => '50', + quota_subnet => '50', + quota_port => 'default', + quota_security_group => '50', + quota_security_group_rule => 'default', + quota_vip => 'default', + quota_pool => 'default', + quota_router => '50', + quota_floatingip => '100', + network_auto_schedule => 'default', + }, } if ($external_network_flag != '') and str2bool($external_network_flag) { -- cgit 1.2.3-korg From eb887812da568cfb4908f6ae14449b2ceaeb5bc0 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 12 Jun 2015 13:08:42 -0400 Subject: Adding in support for Lithium container. Both will be present on the controller nodes and can be started/switches on and off at will. Networking scripts are not updated - will be deprecated in favour of plugin method of enabling / setting up VXLAN / OVSDB integration pulling from the latest nightly artifact at time of commit - will work on automated pulling each night to see if that makes sense. Change-Id: Ie911cdf61cd97a99b975c30c55c664daf70eb3ee JIRA: 0 Signed-off-by: Dan Smith --- .../templates/Lithium_rc0/dockerfile/Dockerfile | 82 ++++++++ .../dockerfile/container_scripts/check_feature.sh | 18 ++ .../dockerfile/container_scripts/speak.sh | 20 ++ .../start_odl_docker_container.sh | 48 +++++ fuel/build/Makefile | 2 + fuel/build/f_lith_odl_docker/Makefile | 52 +++++ fuel/build/f_lith_odl_docker/dockerfile/Dockerfile | 72 +++++++ .../dockerfile/container_scripts/check_feature.sh | 8 + .../dockerfile/container_scripts/speak.sh | 17 ++ .../container_scripts/start_odl_docker.sh | 38 ++++ .../modules/opnfv/manifests/odl_lith_docker.pp | 81 ++++++++ .../Lithium_rc0/container_scripts/check_feature.sh | 18 ++ .../Lithium_rc0/container_scripts/speak.sh | 20 ++ .../start_odl_docker_container.sh | 48 +++++ .../puppet/modules/opnfv/scripts/change.sh | 219 +++++++++++++++++++++ .../puppet/modules/opnfv/scripts/config_net_odl.sh | 192 ++++++++++++++++++ .../puppet/modules/opnfv/scripts/stage_odl.sh | 54 +++++ .../modules/opnfv/scripts/start_odl_container.sh | 95 +++++++++ .../f_lith_odl_docker/scripts/config_net_odl.sh | 164 +++++++++++++++ .../scripts/config_neutron_for_odl.sh | 146 ++++++++++++++ .../f_lith_odl_docker/scripts/prep_nets_for_odl.sh | 90 +++++++++ .../f_lith_odl_docker/scripts/setup_ovs_for_odl.sh | 23 +++ .../puppet/modules/opnfv/manifests/init.pp | 2 + 23 files changed, 1509 insertions(+) create mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile create mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh create mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh create mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh create mode 100755 fuel/build/f_lith_odl_docker/Makefile create mode 100755 fuel/build/f_lith_odl_docker/dockerfile/Dockerfile create mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh create mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh create mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh create mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp create mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh create mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh create mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh create mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh create mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh create mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh create mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh create mode 100644 fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh create mode 100644 fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh create mode 100755 fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh create mode 100644 fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile new file mode 100644 index 0000000..6d7535d --- /dev/null +++ b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile @@ -0,0 +1,82 @@ +#################################################################### +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# DOCKER FILE FOR LITHIUM ODL RC0 Testing +# +############################################################################# + + +#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff +FROM ubuntu:12.04 + +# Maintainer Info +MAINTAINER Daniel Smith + + +#Run apt-get update one start just to check for updates when building +RUN echo "Updating APT" +RUN apt-get update +RUN echo "Adding wget" +RUN apt-get install -y wget +RUN apt-get install -y net-tools +RUN apt-get install -y openjdk-7-jre +RUN apt-get install -y openjdk-7-jdk +RUN apt-get install -y openssh-server +RUN apt-get install -y vim +RUN apt-get install -y expect +RUN apt-get install -y daemontools +RUN mkdir -p /opt/odl_source/lithium +RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' + + + +#Now lets got and fetch the ODL distribution +RUN echo "Fetching Lithium Rc0" +RUN wget https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf/0.3.0-SNAPSHOT/distribution-karaf-0.3.0-20150612.144348-2492.tar.gz -O /opt/odl_source/lithium/distribution-karaf-0.3.0-Lithium-RC0.tar.gz + +RUN echo "Untarring ODL inplace" +RUN mkdir -p /opt/odl/lithium +RUN tar zxvf /opt/odl_source/lithium/distribution-karaf-0.3.0-Lithium-RC0.tar.gz -C /opt/odl/lithium + +RUN echo "Installing DLUX and other features into ODL" +#COPY dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh +COPY container_scripts/start_odl_docker_container.sh /etc/init.d/ +COPY container_scripts/speak.sh /etc/init.d/ +#COPY dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh +RUN chmod 777 /etc/init.d/start_odl_docker_container.sh +RUN chmod 777 /etc/init.d/speak.sh + + + +# Expose the ports + +# PORTS FOR BASE SYSTEM AND DLUX +EXPOSE 8101 +EXPOSE 6633 +EXPOSE 1099 +EXPOSE 43506 +EXPOSE 8181 +EXPOSE 8185 +EXPOSE 9000 +EXPOSE 39378 +EXPOSE 33714 +EXPOSE 44444 +EXPOSE 6653 + +# PORTS FOR OVSDB AND ODL CONTROL +EXPOSE 12001 +EXPOSE 6640 +EXPOSE 8080 +EXPOSE 7800 +EXPOSE 55130 +EXPOSE 52150 +EXPOSE 36826 + +# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable +CMD ["/etc/init.d/start_odl_docker_container.sh"] diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh new file mode 100644 index 0000000..04d7b53 --- /dev/null +++ b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh @@ -0,0 +1,18 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#!/usr/bin/expect +spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client +expect "root>" +send "feature:list | grep -i odl-restconf\r" +send "\r\r\r" +expect "root>" +send "logout\r" + + diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh new file mode 100644 index 0000000..a7d0e6c --- /dev/null +++ b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh @@ -0,0 +1,20 @@ +#!/usr/bin/expect +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +################################################################################# + +spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client +expect "root>" +send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" +send "\r\r\r" +expect "root>" +send "logout\r" diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh new file mode 100644 index 0000000..96a40ec --- /dev/null +++ b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh @@ -0,0 +1,48 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +################################################################################# +# Start up script for calling karaf / ODL inside a docker container. +# +# This script will also call a couple expect scripts to load the feature set that we want + + +#ENV +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 + +#MAIN +echo "Starting up the da Sheilds..." +/opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/karaf server & +echo "Sleeping 5 bad hack" +sleep 10 +echo "should see stuff listening now" +netstat -na +echo " should see proess running for karaf" +ps -efa +echo " Starting the packages we want" +/etc/init.d/speak.sh +echo "Printout the status - if its right, you should see 8181 appear now" +netstat -na +ps -efa + + + +## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute +## Cheap - but effective +while true; +do + echo "Checking status of ODL:" + /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/status + sleep 60 +done + + diff --git a/fuel/build/Makefile b/fuel/build/Makefile index 5f63120..6c98ed9 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -43,6 +43,7 @@ SUBDIRS += f_l23network SUBDIRS += f_resolvconf SUBDIRS += f_ntp SUBDIRS += f_odl_docker +SUBDIRS += f_lith_odl_docker #SUBDIRS += f_odl # f_example is only an example of how to generate a .deb package and @@ -64,6 +65,7 @@ all: @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE) @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE) $(MAKE) -C f_odl_docker -f Makefile all + $(MAKE) -C f_lith_odl_docker -f Makefile all @make -C docker @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso diff --git a/fuel/build/f_lith_odl_docker/Makefile b/fuel/build/f_lith_odl_docker/Makefile new file mode 100755 index 0000000..e89da94 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/Makefile @@ -0,0 +1,52 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +TOP := $(shell pwd) +BUILDTAG := robust_stefan +RELEASE := Lithium_rc0 + +# Edit this to match the GENESIS / OPNFV in your environment +export OPNFV_PUPPET := $(BUILD_BASE)/../../common/puppet-opnfv +include ../config.mk + +.PHONY: all +all: + @mkdir -p puppet/modules/opnfv/odl_docker/${RELEASE} + @rm -rf tmp + @mkdir -p tmp + @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/${RELEASE}/dockerfile tmp/. + @docker build -t ${BUILDTAG} tmp/dockerfile/. + @docker save ${BUILDTAG} > puppet/modules/opnfv/odl_docker/${RELEASE}/odl_docker_image.tar + @wget ${DOCKER_REPO}/${DOCKER_TAG} -O puppet/modules/opnfv/odl_docker/${RELEASE}/docker-latest + @echo "OPFNV_PUPPET is: ${OPNFV_PUPPET}" + @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/${RELEASE}/dockerfile/container_scripts puppet/modules/opnfv/odl_docker/${RELEASE}/. + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: build-clean +build-clean: + @rm -rf tmp + @rm -rf release + @rm -rf puppet/modules/opnfv/odl_docker/${RELEASE}/odl_docker_image.tar + @rm -rf puppet/modules/opnfv/odl_docker/${RELEASE}/docker-latest + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + # Fetch PP from OPNFV Common + @cp -Rvp ${OPNFV_PUPPET}/manifests/odl_docker.pp ${PUPPET_DEST} + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile b/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile new file mode 100755 index 0000000..e3c7ee5 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile @@ -0,0 +1,72 @@ +#################################################################### +# +# Dockerfile to build a ODL (Karaf) Docker Container +# +# Copyright daniel.smith@ericsson.com +# License: Apache GPL +# +#################################################################### + + +#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff +FROM ubuntu:12.04 + +# Maintainer Info +MAINTAINER Daniel Smith + +#Run apt-get update one start just to check for updates when building +RUN echo "Updating APT" +RUN apt-get update +RUN echo "Adding wget" +RUN apt-get install -y wget +RUN apt-get install -y net-tools +RUN apt-get install -y openjdk-7-jre +RUN apt-get install -y openjdk-7-jdk +RUN apt-get install -y openssh-server +RUN apt-get install -y vim +RUN apt-get install -y expect +RUN apt-get install -y daemontools +RUN mkdir -p /opt/odl_source +RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' + + +#Now lets got and fetch the ODL distribution +RUN echo "Fetching ODL" +RUN wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz -O /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz + +RUN echo "Untarring ODL inplace" +RUN mkdir -p /opt/odl +RUN tar zxvf /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz -C /opt/odl + +RUN echo "Installing DLUX and other features into ODL" +COPY tmp/dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh +COPY tmp/dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh +RUN chmod 777 /etc/init.d/start_odl_docker.sh +RUN chmod 777 /etc/init.d/speak.sh + + +# Expose the ports +# PORTS FOR BASE SYSTEM AND DLUX +EXPOSE 8101 +EXPOSE 6633 +EXPOSE 1099 +EXPOSE 43506 +EXPOSE 8181 +EXPOSE 8185 +EXPOSE 9000 +EXPOSE 39378 +EXPOSE 33714 +EXPOSE 44444 +EXPOSE 6653 + +# PORTS FOR OVSDB AND ODL CONTROL +EXPOSE 12001 +EXPOSE 6640 +EXPOSE 8080 +EXPOSE 7800 +EXPOSE 55130 +EXPOSE 52150 +EXPOSE 36826 + +# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable +CMD ["/etc/init.d/start_odl_docker.sh"] diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh new file mode 100755 index 0000000..3e5d0b2 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh @@ -0,0 +1,8 @@ +#!/usr/bin/expect +spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client +expect "root>" +send "feature:list | grep -i odl-restconf\r" +send "\r\r\r" +expect "root>" +send "logout\r" + diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh new file mode 100755 index 0000000..3ba07a8 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh @@ -0,0 +1,17 @@ +#!/usr/bin/expect +# Ericsson Research Canada +# +# Author: Daniel Smith +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +# DEPRECATED AFTER ARNO + +spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client +expect "root>" +send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" +send "\r\r\r" +expect "root>" +send "logout\r" + diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh new file mode 100755 index 0000000..1c72dda --- /dev/null +++ b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Ericsson Research Canada +# +# Author: Daniel Smith +# +# Start up script for calling karaf / ODL inside a docker container. +# +# This script will also call a couple expect scripts to load the feature set that we want + + +#ENV +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 + +#MAIN +echo "Starting up the da Sheilds..." +/opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/karaf server & +echo "Sleeping 5 bad hack" +sleep 10 +echo "should see stuff listening now" +netstat -na +echo " should see proess running for karaf" +ps -efa +echo " Starting the packages we want" +/etc/init.d/speak.sh +echo "Printout the status - if its right, you should see 8181 appear now" +netstat -na +ps -efa + + + +## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute +## Cheap - but effective +while true; +do + echo "Checking status of ODL:" + /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/status + sleep 60 +done diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp new file mode 100644 index 0000000..cd243ef --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp @@ -0,0 +1,81 @@ +class opnfv::odl_lith_docker +{ + case $::fuel_settings['role'] { + /controller/: { + + file { '/opt': + ensure => 'directory', + } + + file { '/opt/opnfv': + ensure => 'directory', + owner => 'root', + group => 'root', + mode => 777, + } + + file { '/opt/opnfv/odl': + ensure => 'directory', + } + + file { '/opt/opnfv/odl/lithium': + ensure => 'directory', + } + + file { '/opt/opnfv/odl/lithium/odl_docker_image.tar': + ensure => present, + source => '/etc/puppet/modules/opnfv/odl_docker/Lithium_rc0/odl_docker_image.tar', + mode => 750, + } + + file { '/opt/opnfv/odl/lithium/docker-latest': + ensure => present, + source => '/etc/puppet/modules/opnfv/odl_docker/Lithium_rc0/docker-latest', + mode => 750, + } + + file { '/opt/opnfv/odl/start_odl_conatiner.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', + mode => 750, + } + file { '/opt/opnfv/odl/stage_odl.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/stage_odl.sh', + mode => 750, + } + file { '/opt/opnfv/odl/config_net_odl.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/config_net_odl.sh', + mode => 750, + } + file { '/opt/opnfv/odl/change.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/change.sh', + mode => 750, + } + + + # fix failed to find the cgroup root issue + # https://github.com/docker/docker/issues/8791 + case $::operatingsystem { + 'ubuntu': { + package {'cgroup-lite': + ensure => present, + } + + service {'cgroup-lite': + ensure => running, + enable => true, + require => Package['cgroup-lite'], + } + } + 'centos': { + package {'docker-io': + ensure => latest, + } + } + } + } + } +} diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh new file mode 100644 index 0000000..04d7b53 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh @@ -0,0 +1,18 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +#!/usr/bin/expect +spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client +expect "root>" +send "feature:list | grep -i odl-restconf\r" +send "\r\r\r" +expect "root>" +send "logout\r" + + diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh new file mode 100644 index 0000000..a7d0e6c --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh @@ -0,0 +1,20 @@ +#!/usr/bin/expect +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +################################################################################# + +spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client +expect "root>" +send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" +send "\r\r\r" +expect "root>" +send "logout\r" diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh new file mode 100644 index 0000000..96a40ec --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh @@ -0,0 +1,48 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# daniel.smith@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +################################################################################# +# Start up script for calling karaf / ODL inside a docker container. +# +# This script will also call a couple expect scripts to load the feature set that we want + + +#ENV +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 + +#MAIN +echo "Starting up the da Sheilds..." +/opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/karaf server & +echo "Sleeping 5 bad hack" +sleep 10 +echo "should see stuff listening now" +netstat -na +echo " should see proess running for karaf" +ps -efa +echo " Starting the packages we want" +/etc/init.d/speak.sh +echo "Printout the status - if its right, you should see 8181 appear now" +netstat -na +ps -efa + + + +## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute +## Cheap - but effective +while true; +do + echo "Checking status of ODL:" + /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/status + sleep 60 +done + + diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh new file mode 100644 index 0000000..f7f3d6e --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh @@ -0,0 +1,219 @@ +#!/bin/bash +# script to remove bridges and reset networking for ODL + + +#VARS +MODE=0 +DNS=8.8.8.8 + +#ENV +source ~/openrc + +# GET IPS for that node +function get_ips { + BR_MGMT=`grep address /etc/network/ifcfg_backup/ifcfg-br-mgmt | awk -F" " '{print $2}'` + BR_STORAGE=`grep address /etc/network/ifcfg_backup/ifcfg-br-storage | awk -F" " '{print $2}'` + BR_FW_ADMIN=`grep address /etc/network/ifcfg_backup/ifcfg-br-fw-admin | awk -F" " '{print $2}'` + BR_EX=`grep address /etc/network/ifcfg_backup/ifcfg-br-ex | awk -F" " '{print $2}'` + DEF_NETMASK=255.255.255.0 + DEF_GW=172.30.9.1 +} + +function backup_ifcfg { + echo " backing up " + mkdir -p /etc/network/ifcfg_backup + mv /etc/network/interfaces.d/ifcfg-br-ex /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-fw-admin /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-mgmt /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-storage /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-prv /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-eth0 /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-eth1 /etc/network/ifcfg_backup/. + rm -rf /etc/network/interfaces.d/ifcfg-eth1.300 + rm -rf /etc/network/interfaces.d/ifcfg-eth1.301 + rm -rf /etc/network/interfaces.d/ifcfg-eth1 + rm -rf /etc/network/interfaces.d/ifcfg-eth0 + +} + + +function create_ifcfg_br_mgmt { + echo "migrating br_mgmt" + echo "auto eth1.300" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo "iface eth1.300 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo " address $BR_MGMT" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.300 +} + +function create_ifcfg_br_storage { + echo "migration br_storage" + echo "auto eth1.301" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo "iface eth1.301 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo " address $BR_STORAGE" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.301 +} + +function create_ifcfg_br_fw_admin { + echo " migratinng br_fw_admin" + echo "auto eth1" >> /etc/network/interfaces.d/ifcfg-eth1 + echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1 + echo " address $BR_FW_ADMIN" >> /etc/network/interfaces.d/ifcfg-eth1 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1 +} + +function create_ifcfg_eth0 { + echo "migratinng br-ex to eth0 - temporarily" + echo "auto eth0" >> /etc/network/interfaces.d/ifcfg-eth0 + echo "iface eth0 inet static" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " address $BR_EX" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " gateway $DEF_GW" >> /etc/network/interfaces.d/ifcfg-eth0 +} + +function set_mode { + if [ -d "/var/lib/glance/images" ] + then + echo " controller " + MODE=0 + else + echo " compute " + MODE=1 + fi +} + + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function start_ovs { + echo "Starting OVS" + service openvswitch-switch start + ovs-vsctl show +} + + +function clean_ovs { + echo "cleaning OVS DB" + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + echo "restarting OVS - you should see Nothing there" + start_ovs +} + + + +function reboot_me { + reboot +} + +function allow_challenge { + sed -i -e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config + service ssh restart +} + +function clean_neutron { + subnets=( `neutron subnet-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + networks=( `neutron net-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + ports=( `neutron port-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + routers=( `neutron router-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + + #display all elements + echo "SUBNETS: ${subnets[@]} " + echo "NETWORKS: ${networks[@]} " + echo "PORTS: ${ports[@]} " + echo "ROUTERS: ${routers[@]} " + + + # get port and subnet for each router + for i in "${routers[@]}" + do + routerport=( `neutron router-port-list $i | awk -F" " '{print $2}' | grep -v id | sed '/^$/d' `) + routersnet=( `neutron router-port-list $i | awk -F" " '{print $8}' | grep -v fixed | sed '/^$/d' | sed 's/,$//' | sed -e 's/^"//' -e 's/"$//' `) + done + + echo "ROUTER PORTS: ${routerport[@]} " + echo "ROUTER SUBNET: ${routersnet[@]} " + + #remove router subnets + echo "router-interface-delete" + for i in "${routersnet[@]}" + do + neutron router-interface-delete ${routers[0]} $i + done + + #remove subnets + echo "subnet-delete" + for i in "${subnets[@]}" + do + neutron subnet-delete $i + done + + #remove nets + echo "net-delete" + for i in "${networks[@]}" + do + neutron net-delete $i + done + + #remove routers + echo "router-delete" + for i in "${routers[@]}" + do + neutron router-delete $i + done + + #remove ports + echo "port-delete" + for i in "${ports[@]}" + do + neutron port-delete $i + done + + #remove subnets + echo "subnet-delete second pass" + for i in "${subnets[@]}" + do + neutron subnet-delete $i + done + +} + +function set_dns { + sed -i -e 's/nameserver 10.20.0.2/nameserver $DNS/g' /etc/resolv.conf +} + + +#OUTPUT + +function check { + echo $BR_MGMT + echo $BR_STORAGE + echo $BR_FW_ADMIN + echo $BR_EX +} + +### MAIN + + +set_mode +backup_ifcfg +get_ips +create_ifcfg_br_mgmt +create_ifcfg_br_storage +create_ifcfg_br_fw_admin +if [ $MODE == "0" ] +then + create_ifcfg_eth0 +fi +allow_challenge +clean_ovs +check +reboot_me + + diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh new file mode 100755 index 0000000..145da80 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh @@ -0,0 +1,192 @@ +#!/bin/bash +# +# Author: Daniel Smith (Ericsson) +# +# Script to update neutron configuration for OVSDB/ODL integratino +# +# Usage - Set / pass CONTROL_HOST to your needs +# +### SET THIS VALUE TO MATCH YOUR SYSTEM +CONTROL_HOST=192.168.0.2 +BR_EX_IP=172.30.9.70 + +# ENV +source ~/openrc +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUNCTIONS +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + sed -i -e 's/bridge_mappings=physnet2:br-prv/bridge_mappings=physnet1:br-ex/g' $ML2_CONF + echo "[ml2_odl]" >> $ML2_CONF + echo "password = admin" >> $ML2_CONF + echo "username = admin" >> $ML2_CONF + echo "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + +function disable_agent { + echo "Disabling Neutron Plugin Agents from running" + service neutron-plugin-openvswitch-agent stop + echo 'manual' > /etc/init/neutron-plugin-openvswitch-agent.override +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if [ -d "/var/lib/glance/images" ] + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function start_ovs { + echo "Starting OVS" + service openvswitch-vswitch start + ovs-vsctl show +} + + +function control_setup { + echo "Modifying Controller" + stop_neutron + stop_ovs + disable_agent + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. + mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + rm -rf /etc/openvswitch/.conf* + service openvswitch-switch start + ovs-vsctl add-br br-ex + ovs-vsctl add-port br-ex eth0 + ovs-vsctl set interface br-ex type=external + ifconfig br-ex 172.30.9.70/24 up + service neutron-server restart + + echo "setting up networks" + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp + ip link add link eth1 name br-storage type vlan id 301 + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + + echo "Setting ODL Manager IP" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + + # BAD HACK - Should be parameterized - this is to catch up + route add default gw 172.30.9.1 + +} + +function clean_ovs { + echo "cleaning OVS DB" + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + echo "restarting OVS - you should see Nothing there" + start_ovs +} + +function compute_setup { + echo "Modifying Compute" + echo "Disabling neutron openvswitch plugin" + stop_neutron + disable_agent + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp + ip link add link eth1 name br-storage type vlan id 301 + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + + echo "set manager, and route for ODL controller" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + route add 172.17.0.1 gw 192.168.0.2 + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh new file mode 100755 index 0000000..fa14b47 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Author: Daniel Smith (Ericsson) +# Stages ODL Controlleer +# Inputs: odl_docker_image.tar +# Usage: ./stage_odl.sh + +# ENVS +source ~/.bashrc +source ~/openrc + +LOCALPATH=/opt/opnfv/odl +DOCKERBIN=docker-latest +ODLIMGNAME=odl_docker_image.tar +DNS=8.8.8.8 +HOST_IP=`ifconfig br-ex | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` + + + +# DEBUG ECHOS +echo $LOCALPATH +echo $DOCKERBIN +echo $ODLIMGNAME +echo $DNS +echo $HOST_IP + + +# Set DNS to someting external and default GW - ODL requires a connection to the internet +sed -i -e 's/nameserver 10.20.0.2/nameserver 8.8.8.8/g' /etc/resolv.conf +route delete default gw 10.20.0.2 +route add default gw 172.30.9.1 + +# Start Docker daemon and in background +echo "Starting Docker" +chmod +x $LOCALPATH/$DOCKERBIN +$LOCALPATH/$DOCKERBIN -d & +#courtesy sleep for virtual env +sleep 2 + +# Import the ODL Container +echo "Importing ODL Container" +$LOCALPATH/$DOCKERBIN load -i $LOCALPATH/$ODLIMGNAME + +# Start ODL, load DLUX and OVSDB modules +echo "Removing any old install found - file not found is ok here" +$LOCALPATH/$DOCKERBIN rm odl_docker +echo "Starting up ODL controller in Daemon mode - no shell possible" +$LOCALPATH/$DOCKERBIN run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel + +# Following, you should see the docker ps listed and a port opened +echo " you should reach ODL controller at http://HOST_IP:8181/dlux/index.html" +$LOCALPATH/$DOCKERBINNAME ps -a +netstat -lnt + + diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh new file mode 100755 index 0000000..347ac74 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Ericsson Canada Inc. +# Authoer: Daniel Smith +# +# A helper script to install and setup the ODL docker conatiner on the controller +# +# +# Inputs: odl_docker_image.tar +# +# Usage: ./start_odl_docker.sh +echo "DEPRECATED - USE stage_odl.sh instead - this will be removed shortly once automated deployment is working - SR1" + + +# ENVS +source ~/.bashrc +source ~/openrc + +# VARS + +# Switch for Dev mode - uses apt-get on control to cheat and get docker installed locally rather than from puppet source + +DEV=1 + +# Switch for 1:1 port mapping of EXPOSED ports in Docker to the host, if set to 0, then random ports will be used - NOTE: this doesnt work for all web services X port on Host --> Y port in Container, +# especially for SSL/HTTPS cases. Be aware. + +MATCH_PORT=1 + +LOCALPATH=/opt/opnfv/odl +DOCKERBINNAME=docker-latest +DOCKERIMAGENAME=odl_docker_image.tar +DNS=8.8.8.8 +HOST_IP=`ifconfig br-fw-admin | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` + + +# Set this to "1" if you want to have your docker container startup into a shell + + +ENABLE_SHELL=1 + + +echo " Fetching Docker " +if [ "$DEV" -eq "1" ]; +# If testing Locally (on a control node) you can set DEV=1 to enable apt-get based install on the control node (not desired target, but good for testing). +then + echo "Dev Mode - Fetching from Internet"; + echo " this wont work in production builds"; + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + mkdir -p $LOCALPATH + wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O $LOCALPATH/$DOCKERBINNAME + wget http://ftp.us.debian.org/debian/pool/main/d/docker.io/docker.io_1.3.3~dfsg1-2_amd64.deb + chmod 777 $LOCALPATH/$DOCKERBINNAME + echo "done "; +else + echo "Using Binaries delivered from Puppet" + echo "Starting Docker in Daemon mode" + chmod +x $LOCALPATH/$DOCKERBINNAME + $LOCALPATH/$DOCKERBINNAME -d & + + # wait until docker will be fully initialized + # before any further action against just started docker + sleep 5 +fi + + +# We need to perform some cleanup of the Openstack Environment +echo "TODO -- This should be automated in the Fuel deployment at some point" +echo "However, the timing should come after basic tests are running, since this " +echo " part will remove the subnet router association that is deployed automativally" +echo " via fuel. Refer to the ODL + Openstack Integration Page " + +# Import the ODL container into docker + +echo "Importing ODL container into docker" +$LOCALPATH/$DOCKERBINNAME load -i $LOCALPATH/$DOCKERIMAGENAME + +echo " starting up ODL - DLUX and Mapping Ports" +if [ "$MATCH_PORT" -eq "1" ] +then + echo "Starting up Docker..." + $LOCALPATH/$DOCKERBINNAME rm odl_docker +fi + +if [ "$ENABLE_SHELL" -eq "1" ]; +then + echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" + $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash +else + echo "Starting Conatiner in Daemon mode - no shell will be provided and docker attach will not provide shell)" + $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel + echo "should see the process listed here in docker ps -a" + $LOCALPATH/$DOCKERBINNAME ps -a; + echo "Match Port enabled, you can reach the DLUX login at: " + echo "http://$HOST_IP:8181/dlux.index.html" +fi diff --git a/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh b/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh new file mode 100644 index 0000000..d292acd --- /dev/null +++ b/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh @@ -0,0 +1,164 @@ +#!/bin/bash +# +# Author: Daniel Smith (Ericsson) +# +# Script to update neutron configuration for OVSDB/ODL integratino +# +# Usage - Set / pass CONTROL_HOST to your needs +# +CONTROL_HOST=172.30.9.70 + +# ENV +source ~/openrc + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUNCTIONS + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + cat "[ml2_odl]" >> $ML2_CONF + cat "password = admin" >> $ML2_CONF + cat "username = admin" >> $ML2_CONF + cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if ls -l /var/lib/glance/images + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function control_setup { + echo "Modifying Controller" + stop_neutron + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. + mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. + service openvswitch-switch start + ovs-vsctl set-manager tcp:172.30.9.70:6640 + ovs-vsctl add-br br-eth0 + ovs-vsctl add-br br-ex + ovs-vsctl add-port br-eth0 eth0 + ovs-vsctl add-port br-eth0 br-eth0--br-ex + ovs-vsctl add-port br-ex br-ex--br-eth0 + ovs-vsctl set interface br-ex--br-eth0 type=patch + ovs-vsctl set interface br-eth0--br-ex type=patch + ovs-vsctl set interface br-ex--br-eth0 options:peer=br-eth0--br-ex + ovs-vsctl set interface br-eth0--br-ex options:peer=br-ex--br-eth0 + ifconfig br-ex 172.30.9.70/24 up + service neutron-server restart + + echo "setting up networks" + ip link add link eth1 name br-mgmt type vlan id 300 + ip link add link eth1 name br-storage type vlan id 301 + /etc/init.d/networking restart + + + echo "Reset Neutron DB" + #reset_neutrondb + echo "Restarting Neutron Components" + #restart_neutron + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + +} + +function compute_setup { + echo "do compute stuff here" + echo "stopping neutron openvswitch plugin" + stop_neutron + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 + ip link add link eth1 name br-storage type vlan id 301 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-mgmt | awk -F" " '{print $2}'`/24 + echo "set manager, and route for ODL controller" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + route add 172.17.0.1 gw 192.168.0.2 + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh new file mode 100644 index 0000000..3b688ae --- /dev/null +++ b/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh @@ -0,0 +1,146 @@ +#!/bin/bash +CONTROL_HOST=172.17.0.3 + +# ENV +source ~/openrc + + + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUCNTIONS + + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF +#!/bin/bash +CONTROL_HOST=172.17.0.3 + +# ENV +source ~/openrc + + + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUCNTIONS + + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + cat "[ml2_odl]" >> $ML2_CONF + cat "password = admin" >> $ML2_CONF + cat "username = admin" >> $ML2_CONF + cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if df -k | grep glance + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function control_setup { + echo "do control stuff here" + echo "Reset Neutron DB" + #reset_neutrondb + echo "Restarting Neutron Components" + #restart_neutron + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + +} + +function compute_setup { + echo "do compute stuff here" + stop_neutron + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +#update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh new file mode 100755 index 0000000..dd4fc9f --- /dev/null +++ b/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh + +OLDGW=$1 +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh + +OLDGW=$1 +NEWGW=$2 +IMAGEPATH=/opt/opnfv +IMAGENAME=odl_docker_image.tar +SOURCES=/etc/apt/sources.list + + +if [ "$#" -ne 2]; then + echo "Two args not provided, will not touch networking" +else + + # Fix routes + echo "Fixing routes" + #DEBUG + netstat -rn + + echo "delete old def route" + route delete default gw $1 + echo "adding new def route" + route add default gw $2 + + echo " you should see a good nslookup now" + nslookup www.google.ca +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh + +OLDGW=$1 +NEWGW=$2 +IMAGEPATH=/opt/opnfv +IMAGENAME=odl_docker_image.tar +SOURCES=/etc/apt/sources.list + + +if [ "$#" -ne 2]; then + echo "Two args not provided, will not touch networking" +else + + # Fix routes + echo "Fixing routes" + #DEBUG + netstat -rn + + echo "delete old def route" + route delete default gw $1 + echo "adding new def route" + route add default gw $2 + + echo " you should see a good nslookup now" + nslookup www.google.ca +fi + + +if egrep "mirrors.txt" $SOURCES +then + echo "Sources was already updated, not touching" +else + echo "adding the closests mirrors and docker mirror to the mix" + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" >> /etc/apt/sources.list + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + echo "deb https://get.docker.com/ubuntu docker main " > /etc/apt/sources.list.d/docker.list +fi + +echo "Updating" +apt-get update +echo "Installing Docker" +apt-get install -y lxc-docker + +echo "Loading ODL Docker Image" +docker load -i $IMAGEPATH/$IMAGENAME + + diff --git a/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh new file mode 100644 index 0000000..42c9451 --- /dev/null +++ b/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh @@ -0,0 +1,23 @@ +#!/bin/bash + + + +ok .. so they created br-int + +so lets add a physical nic to it + + +# First - Removal all the bridges you find + +for i in $(ovs-vsctl list-br) +do + if [ "$i" == "br-int" ]; + then + echo "skipped br-int" + elif [ "$i" == "br-prv"]; + then + echo "skipped br-pr" + else + ovs-vsctl del-br $i + fi +done diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp index 54f1c86..436f496 100644 --- a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp @@ -25,4 +25,6 @@ class opnfv { include opnfv::add_packages # Setup OpenDaylight include opnfv::odl_docker + # Setup OpenDaylight + include opnfv::odl_lith_docker } -- cgit 1.2.3-korg From a7c763a679eab63a8887bb85158ebdd38213e9a0 Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Thu, 18 Jun 2015 22:04:25 +0200 Subject: Fix typo: conatiner => container Change-Id: If7a29b0c88a7009ef7587a460ecfeff4ba3f3661 Signed-off-by: Szilard Cserey --- common/puppet-opnfv/manifests/odl_docker.pp | 2 +- .../puppet/modules/opnfv/manifests/odl_lith_docker.pp | 2 +- .../puppet/modules/opnfv/scripts/start_odl_container.sh | 4 ++-- fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp | 2 +- .../f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/odl_docker.pp b/common/puppet-opnfv/manifests/odl_docker.pp index 6e70ba0..fdbbe67 100644 --- a/common/puppet-opnfv/manifests/odl_docker.pp +++ b/common/puppet-opnfv/manifests/odl_docker.pp @@ -39,7 +39,7 @@ class opnfv::odl_docker mode => 750, } - file { "/opt/opnfv/odl/start_odl_conatiner.sh": + file { "/opt/opnfv/odl/start_odl_container.sh": ensure => present, source => "/etc/puppet/modules/opnfv/scripts/start_odl_container.sh", mode => 750, diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp index cd243ef..e456180 100644 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp @@ -34,7 +34,7 @@ class opnfv::odl_lith_docker mode => 750, } - file { '/opt/opnfv/odl/start_odl_conatiner.sh': + file { '/opt/opnfv/odl/start_odl_container.sh': ensure => present, source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', mode => 750, diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh index 347ac74..7b91f4f 100755 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh +++ b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh @@ -2,7 +2,7 @@ # Ericsson Canada Inc. # Authoer: Daniel Smith # -# A helper script to install and setup the ODL docker conatiner on the controller +# A helper script to install and setup the ODL docker container on the controller # # # Inputs: odl_docker_image.tar @@ -86,7 +86,7 @@ then echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash else - echo "Starting Conatiner in Daemon mode - no shell will be provided and docker attach will not provide shell)" + echo "Starting Container in Daemon mode - no shell will be provided and docker attach will not provide shell)" $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel echo "should see the process listed here in docker ps -a" $LOCALPATH/$DOCKERBINNAME ps -a; diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp index c286127..56f0216 100644 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp @@ -30,7 +30,7 @@ class opnfv::odl_docker mode => 750, } - file { '/opt/opnfv/odl/start_odl_conatiner.sh': + file { '/opt/opnfv/odl/start_odl_container.sh': ensure => present, source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', mode => 750, diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh index 347ac74..7b91f4f 100755 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh @@ -2,7 +2,7 @@ # Ericsson Canada Inc. # Authoer: Daniel Smith # -# A helper script to install and setup the ODL docker conatiner on the controller +# A helper script to install and setup the ODL docker container on the controller # # # Inputs: odl_docker_image.tar @@ -86,7 +86,7 @@ then echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash else - echo "Starting Conatiner in Daemon mode - no shell will be provided and docker attach will not provide shell)" + echo "Starting Container in Daemon mode - no shell will be provided and docker attach will not provide shell)" $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel echo "should see the process listed here in docker ps -a" $LOCALPATH/$DOCKERBINNAME ps -a; -- cgit 1.2.3-korg From b678795a66c1cab612cf548ef10a033060e3ff27 Mon Sep 17 00:00:00 2001 From: Jonas Bjurel Date: Fri, 26 Jun 2015 09:03:36 +0000 Subject: Revert "Adding in support for Lithium container." since it doesnt deploy This reverts commit eb887812da568cfb4908f6ae14449b2ceaeb5bc0. Change-Id: Ia7490d86c1d91abca1f50d90f43bdf3e4917f23a --- .../templates/Lithium_rc0/dockerfile/Dockerfile | 82 -------- .../dockerfile/container_scripts/check_feature.sh | 18 -- .../dockerfile/container_scripts/speak.sh | 20 -- .../start_odl_docker_container.sh | 48 ----- fuel/build/Makefile | 2 - fuel/build/f_lith_odl_docker/Makefile | 52 ----- fuel/build/f_lith_odl_docker/dockerfile/Dockerfile | 72 ------- .../dockerfile/container_scripts/check_feature.sh | 8 - .../dockerfile/container_scripts/speak.sh | 17 -- .../container_scripts/start_odl_docker.sh | 38 ---- .../modules/opnfv/manifests/odl_lith_docker.pp | 81 -------- .../Lithium_rc0/container_scripts/check_feature.sh | 18 -- .../Lithium_rc0/container_scripts/speak.sh | 20 -- .../start_odl_docker_container.sh | 48 ----- .../puppet/modules/opnfv/scripts/change.sh | 219 --------------------- .../puppet/modules/opnfv/scripts/config_net_odl.sh | 192 ------------------ .../puppet/modules/opnfv/scripts/stage_odl.sh | 54 ----- .../modules/opnfv/scripts/start_odl_container.sh | 95 --------- .../f_lith_odl_docker/scripts/config_net_odl.sh | 164 --------------- .../scripts/config_neutron_for_odl.sh | 146 -------------- .../f_lith_odl_docker/scripts/prep_nets_for_odl.sh | 90 --------- .../f_lith_odl_docker/scripts/setup_ovs_for_odl.sh | 23 --- .../puppet/modules/opnfv/manifests/init.pp | 2 - 23 files changed, 1509 deletions(-) delete mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile delete mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh delete mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh delete mode 100644 common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh delete mode 100755 fuel/build/f_lith_odl_docker/Makefile delete mode 100755 fuel/build/f_lith_odl_docker/dockerfile/Dockerfile delete mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh delete mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh delete mode 100755 fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh delete mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp delete mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh delete mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh delete mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh delete mode 100644 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh delete mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh delete mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh delete mode 100755 fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh delete mode 100644 fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh delete mode 100644 fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh delete mode 100755 fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh delete mode 100644 fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile deleted file mode 100644 index 6d7535d..0000000 --- a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/Dockerfile +++ /dev/null @@ -1,82 +0,0 @@ -#################################################################### -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# DOCKER FILE FOR LITHIUM ODL RC0 Testing -# -############################################################################# - - -#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff -FROM ubuntu:12.04 - -# Maintainer Info -MAINTAINER Daniel Smith - - -#Run apt-get update one start just to check for updates when building -RUN echo "Updating APT" -RUN apt-get update -RUN echo "Adding wget" -RUN apt-get install -y wget -RUN apt-get install -y net-tools -RUN apt-get install -y openjdk-7-jre -RUN apt-get install -y openjdk-7-jdk -RUN apt-get install -y openssh-server -RUN apt-get install -y vim -RUN apt-get install -y expect -RUN apt-get install -y daemontools -RUN mkdir -p /opt/odl_source/lithium -RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' - - - -#Now lets got and fetch the ODL distribution -RUN echo "Fetching Lithium Rc0" -RUN wget https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf/0.3.0-SNAPSHOT/distribution-karaf-0.3.0-20150612.144348-2492.tar.gz -O /opt/odl_source/lithium/distribution-karaf-0.3.0-Lithium-RC0.tar.gz - -RUN echo "Untarring ODL inplace" -RUN mkdir -p /opt/odl/lithium -RUN tar zxvf /opt/odl_source/lithium/distribution-karaf-0.3.0-Lithium-RC0.tar.gz -C /opt/odl/lithium - -RUN echo "Installing DLUX and other features into ODL" -#COPY dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh -COPY container_scripts/start_odl_docker_container.sh /etc/init.d/ -COPY container_scripts/speak.sh /etc/init.d/ -#COPY dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh -RUN chmod 777 /etc/init.d/start_odl_docker_container.sh -RUN chmod 777 /etc/init.d/speak.sh - - - -# Expose the ports - -# PORTS FOR BASE SYSTEM AND DLUX -EXPOSE 8101 -EXPOSE 6633 -EXPOSE 1099 -EXPOSE 43506 -EXPOSE 8181 -EXPOSE 8185 -EXPOSE 9000 -EXPOSE 39378 -EXPOSE 33714 -EXPOSE 44444 -EXPOSE 6653 - -# PORTS FOR OVSDB AND ODL CONTROL -EXPOSE 12001 -EXPOSE 6640 -EXPOSE 8080 -EXPOSE 7800 -EXPOSE 55130 -EXPOSE 52150 -EXPOSE 36826 - -# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable -CMD ["/etc/init.d/start_odl_docker_container.sh"] diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh deleted file mode 100644 index 04d7b53..0000000 --- a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/check_feature.sh +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -#!/usr/bin/expect -spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client -expect "root>" -send "feature:list | grep -i odl-restconf\r" -send "\r\r\r" -expect "root>" -send "logout\r" - - diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh deleted file mode 100644 index a7d0e6c..0000000 --- a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/speak.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/expect -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# - -spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client -expect "root>" -send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" -send "\r\r\r" -expect "root>" -send "logout\r" diff --git a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh b/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh deleted file mode 100644 index 96a40ec..0000000 --- a/common/puppet-opnfv/manifests/templates/Lithium_rc0/dockerfile/container_scripts/start_odl_docker_container.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# -# Start up script for calling karaf / ODL inside a docker container. -# -# This script will also call a couple expect scripts to load the feature set that we want - - -#ENV -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 - -#MAIN -echo "Starting up the da Sheilds..." -/opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/karaf server & -echo "Sleeping 5 bad hack" -sleep 10 -echo "should see stuff listening now" -netstat -na -echo " should see proess running for karaf" -ps -efa -echo " Starting the packages we want" -/etc/init.d/speak.sh -echo "Printout the status - if its right, you should see 8181 appear now" -netstat -na -ps -efa - - - -## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute -## Cheap - but effective -while true; -do - echo "Checking status of ODL:" - /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/status - sleep 60 -done - - diff --git a/fuel/build/Makefile b/fuel/build/Makefile index 6c98ed9..5f63120 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -43,7 +43,6 @@ SUBDIRS += f_l23network SUBDIRS += f_resolvconf SUBDIRS += f_ntp SUBDIRS += f_odl_docker -SUBDIRS += f_lith_odl_docker #SUBDIRS += f_odl # f_example is only an example of how to generate a .deb package and @@ -65,7 +64,6 @@ all: @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE) @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE) $(MAKE) -C f_odl_docker -f Makefile all - $(MAKE) -C f_lith_odl_docker -f Makefile all @make -C docker @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso diff --git a/fuel/build/f_lith_odl_docker/Makefile b/fuel/build/f_lith_odl_docker/Makefile deleted file mode 100755 index e89da94..0000000 --- a/fuel/build/f_lith_odl_docker/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -TOP := $(shell pwd) -BUILDTAG := robust_stefan -RELEASE := Lithium_rc0 - -# Edit this to match the GENESIS / OPNFV in your environment -export OPNFV_PUPPET := $(BUILD_BASE)/../../common/puppet-opnfv -include ../config.mk - -.PHONY: all -all: - @mkdir -p puppet/modules/opnfv/odl_docker/${RELEASE} - @rm -rf tmp - @mkdir -p tmp - @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/${RELEASE}/dockerfile tmp/. - @docker build -t ${BUILDTAG} tmp/dockerfile/. - @docker save ${BUILDTAG} > puppet/modules/opnfv/odl_docker/${RELEASE}/odl_docker_image.tar - @wget ${DOCKER_REPO}/${DOCKER_TAG} -O puppet/modules/opnfv/odl_docker/${RELEASE}/docker-latest - @echo "OPFNV_PUPPET is: ${OPNFV_PUPPET}" - @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/${RELEASE}/dockerfile/container_scripts puppet/modules/opnfv/odl_docker/${RELEASE}/. - -.PHONY: clean -clean: - @rm -rf tmp - @rm -rf release - -.PHONY: build-clean -build-clean: - @rm -rf tmp - @rm -rf release - @rm -rf puppet/modules/opnfv/odl_docker/${RELEASE}/odl_docker_image.tar - @rm -rf puppet/modules/opnfv/odl_docker/${RELEASE}/docker-latest - -.PHONY: validate-cache -validate-cache: - @echo "No cache validation schema available for $(shell pwd)" - @echo "Continuing ..." - -.PHONY: release -release: - # Fetch PP from OPNFV Common - @cp -Rvp ${OPNFV_PUPPET}/manifests/odl_docker.pp ${PUPPET_DEST} - @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile b/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile deleted file mode 100755 index e3c7ee5..0000000 --- a/fuel/build/f_lith_odl_docker/dockerfile/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -#################################################################### -# -# Dockerfile to build a ODL (Karaf) Docker Container -# -# Copyright daniel.smith@ericsson.com -# License: Apache GPL -# -#################################################################### - - -#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff -FROM ubuntu:12.04 - -# Maintainer Info -MAINTAINER Daniel Smith - -#Run apt-get update one start just to check for updates when building -RUN echo "Updating APT" -RUN apt-get update -RUN echo "Adding wget" -RUN apt-get install -y wget -RUN apt-get install -y net-tools -RUN apt-get install -y openjdk-7-jre -RUN apt-get install -y openjdk-7-jdk -RUN apt-get install -y openssh-server -RUN apt-get install -y vim -RUN apt-get install -y expect -RUN apt-get install -y daemontools -RUN mkdir -p /opt/odl_source -RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' - - -#Now lets got and fetch the ODL distribution -RUN echo "Fetching ODL" -RUN wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz -O /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz - -RUN echo "Untarring ODL inplace" -RUN mkdir -p /opt/odl -RUN tar zxvf /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz -C /opt/odl - -RUN echo "Installing DLUX and other features into ODL" -COPY tmp/dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh -COPY tmp/dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh -RUN chmod 777 /etc/init.d/start_odl_docker.sh -RUN chmod 777 /etc/init.d/speak.sh - - -# Expose the ports -# PORTS FOR BASE SYSTEM AND DLUX -EXPOSE 8101 -EXPOSE 6633 -EXPOSE 1099 -EXPOSE 43506 -EXPOSE 8181 -EXPOSE 8185 -EXPOSE 9000 -EXPOSE 39378 -EXPOSE 33714 -EXPOSE 44444 -EXPOSE 6653 - -# PORTS FOR OVSDB AND ODL CONTROL -EXPOSE 12001 -EXPOSE 6640 -EXPOSE 8080 -EXPOSE 7800 -EXPOSE 55130 -EXPOSE 52150 -EXPOSE 36826 - -# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable -CMD ["/etc/init.d/start_odl_docker.sh"] diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh deleted file mode 100755 index 3e5d0b2..0000000 --- a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/check_feature.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/expect -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:list | grep -i odl-restconf\r" -send "\r\r\r" -expect "root>" -send "logout\r" - diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh deleted file mode 100755 index 3ba07a8..0000000 --- a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/speak.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/expect -# Ericsson Research Canada -# -# Author: Daniel Smith -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -# DEPRECATED AFTER ARNO - -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" -send "\r\r\r" -expect "root>" -send "logout\r" - diff --git a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh b/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh deleted file mode 100755 index 1c72dda..0000000 --- a/fuel/build/f_lith_odl_docker/dockerfile/container_scripts/start_odl_docker.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Ericsson Research Canada -# -# Author: Daniel Smith -# -# Start up script for calling karaf / ODL inside a docker container. -# -# This script will also call a couple expect scripts to load the feature set that we want - - -#ENV -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 - -#MAIN -echo "Starting up the da Sheilds..." -/opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/karaf server & -echo "Sleeping 5 bad hack" -sleep 10 -echo "should see stuff listening now" -netstat -na -echo " should see proess running for karaf" -ps -efa -echo " Starting the packages we want" -/etc/init.d/speak.sh -echo "Printout the status - if its right, you should see 8181 appear now" -netstat -na -ps -efa - - - -## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute -## Cheap - but effective -while true; -do - echo "Checking status of ODL:" - /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/status - sleep 60 -done diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp deleted file mode 100644 index e456180..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/manifests/odl_lith_docker.pp +++ /dev/null @@ -1,81 +0,0 @@ -class opnfv::odl_lith_docker -{ - case $::fuel_settings['role'] { - /controller/: { - - file { '/opt': - ensure => 'directory', - } - - file { '/opt/opnfv': - ensure => 'directory', - owner => 'root', - group => 'root', - mode => 777, - } - - file { '/opt/opnfv/odl': - ensure => 'directory', - } - - file { '/opt/opnfv/odl/lithium': - ensure => 'directory', - } - - file { '/opt/opnfv/odl/lithium/odl_docker_image.tar': - ensure => present, - source => '/etc/puppet/modules/opnfv/odl_docker/Lithium_rc0/odl_docker_image.tar', - mode => 750, - } - - file { '/opt/opnfv/odl/lithium/docker-latest': - ensure => present, - source => '/etc/puppet/modules/opnfv/odl_docker/Lithium_rc0/docker-latest', - mode => 750, - } - - file { '/opt/opnfv/odl/start_odl_container.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', - mode => 750, - } - file { '/opt/opnfv/odl/stage_odl.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/stage_odl.sh', - mode => 750, - } - file { '/opt/opnfv/odl/config_net_odl.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/config_net_odl.sh', - mode => 750, - } - file { '/opt/opnfv/odl/change.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/change.sh', - mode => 750, - } - - - # fix failed to find the cgroup root issue - # https://github.com/docker/docker/issues/8791 - case $::operatingsystem { - 'ubuntu': { - package {'cgroup-lite': - ensure => present, - } - - service {'cgroup-lite': - ensure => running, - enable => true, - require => Package['cgroup-lite'], - } - } - 'centos': { - package {'docker-io': - ensure => latest, - } - } - } - } - } -} diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh deleted file mode 100644 index 04d7b53..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/check_feature.sh +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -#!/usr/bin/expect -spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client -expect "root>" -send "feature:list | grep -i odl-restconf\r" -send "\r\r\r" -expect "root>" -send "logout\r" - - diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh deleted file mode 100644 index a7d0e6c..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/speak.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/expect -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# - -spawn /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/client -expect "root>" -send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" -send "\r\r\r" -expect "root>" -send "logout\r" diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh deleted file mode 100644 index 96a40ec..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/odl_docker/Lithium_rc0/container_scripts/start_odl_docker_container.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# -# Start up script for calling karaf / ODL inside a docker container. -# -# This script will also call a couple expect scripts to load the feature set that we want - - -#ENV -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 - -#MAIN -echo "Starting up the da Sheilds..." -/opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/karaf server & -echo "Sleeping 5 bad hack" -sleep 10 -echo "should see stuff listening now" -netstat -na -echo " should see proess running for karaf" -ps -efa -echo " Starting the packages we want" -/etc/init.d/speak.sh -echo "Printout the status - if its right, you should see 8181 appear now" -netstat -na -ps -efa - - - -## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute -## Cheap - but effective -while true; -do - echo "Checking status of ODL:" - /opt/odl/distribution-karaf-0.3.0-Lithium-RC0/bin/status - sleep 60 -done - - diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh deleted file mode 100644 index f7f3d6e..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/change.sh +++ /dev/null @@ -1,219 +0,0 @@ -#!/bin/bash -# script to remove bridges and reset networking for ODL - - -#VARS -MODE=0 -DNS=8.8.8.8 - -#ENV -source ~/openrc - -# GET IPS for that node -function get_ips { - BR_MGMT=`grep address /etc/network/ifcfg_backup/ifcfg-br-mgmt | awk -F" " '{print $2}'` - BR_STORAGE=`grep address /etc/network/ifcfg_backup/ifcfg-br-storage | awk -F" " '{print $2}'` - BR_FW_ADMIN=`grep address /etc/network/ifcfg_backup/ifcfg-br-fw-admin | awk -F" " '{print $2}'` - BR_EX=`grep address /etc/network/ifcfg_backup/ifcfg-br-ex | awk -F" " '{print $2}'` - DEF_NETMASK=255.255.255.0 - DEF_GW=172.30.9.1 -} - -function backup_ifcfg { - echo " backing up " - mkdir -p /etc/network/ifcfg_backup - mv /etc/network/interfaces.d/ifcfg-br-ex /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-fw-admin /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-mgmt /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-storage /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-prv /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-eth0 /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-eth1 /etc/network/ifcfg_backup/. - rm -rf /etc/network/interfaces.d/ifcfg-eth1.300 - rm -rf /etc/network/interfaces.d/ifcfg-eth1.301 - rm -rf /etc/network/interfaces.d/ifcfg-eth1 - rm -rf /etc/network/interfaces.d/ifcfg-eth0 - -} - - -function create_ifcfg_br_mgmt { - echo "migrating br_mgmt" - echo "auto eth1.300" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo "iface eth1.300 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo " address $BR_MGMT" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.300 -} - -function create_ifcfg_br_storage { - echo "migration br_storage" - echo "auto eth1.301" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo "iface eth1.301 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo " address $BR_STORAGE" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.301 -} - -function create_ifcfg_br_fw_admin { - echo " migratinng br_fw_admin" - echo "auto eth1" >> /etc/network/interfaces.d/ifcfg-eth1 - echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1 - echo " address $BR_FW_ADMIN" >> /etc/network/interfaces.d/ifcfg-eth1 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1 -} - -function create_ifcfg_eth0 { - echo "migratinng br-ex to eth0 - temporarily" - echo "auto eth0" >> /etc/network/interfaces.d/ifcfg-eth0 - echo "iface eth0 inet static" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " address $BR_EX" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " gateway $DEF_GW" >> /etc/network/interfaces.d/ifcfg-eth0 -} - -function set_mode { - if [ -d "/var/lib/glance/images" ] - then - echo " controller " - MODE=0 - else - echo " compute " - MODE=1 - fi -} - - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function start_ovs { - echo "Starting OVS" - service openvswitch-switch start - ovs-vsctl show -} - - -function clean_ovs { - echo "cleaning OVS DB" - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - echo "restarting OVS - you should see Nothing there" - start_ovs -} - - - -function reboot_me { - reboot -} - -function allow_challenge { - sed -i -e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config - service ssh restart -} - -function clean_neutron { - subnets=( `neutron subnet-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - networks=( `neutron net-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - ports=( `neutron port-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - routers=( `neutron router-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - - #display all elements - echo "SUBNETS: ${subnets[@]} " - echo "NETWORKS: ${networks[@]} " - echo "PORTS: ${ports[@]} " - echo "ROUTERS: ${routers[@]} " - - - # get port and subnet for each router - for i in "${routers[@]}" - do - routerport=( `neutron router-port-list $i | awk -F" " '{print $2}' | grep -v id | sed '/^$/d' `) - routersnet=( `neutron router-port-list $i | awk -F" " '{print $8}' | grep -v fixed | sed '/^$/d' | sed 's/,$//' | sed -e 's/^"//' -e 's/"$//' `) - done - - echo "ROUTER PORTS: ${routerport[@]} " - echo "ROUTER SUBNET: ${routersnet[@]} " - - #remove router subnets - echo "router-interface-delete" - for i in "${routersnet[@]}" - do - neutron router-interface-delete ${routers[0]} $i - done - - #remove subnets - echo "subnet-delete" - for i in "${subnets[@]}" - do - neutron subnet-delete $i - done - - #remove nets - echo "net-delete" - for i in "${networks[@]}" - do - neutron net-delete $i - done - - #remove routers - echo "router-delete" - for i in "${routers[@]}" - do - neutron router-delete $i - done - - #remove ports - echo "port-delete" - for i in "${ports[@]}" - do - neutron port-delete $i - done - - #remove subnets - echo "subnet-delete second pass" - for i in "${subnets[@]}" - do - neutron subnet-delete $i - done - -} - -function set_dns { - sed -i -e 's/nameserver 10.20.0.2/nameserver $DNS/g' /etc/resolv.conf -} - - -#OUTPUT - -function check { - echo $BR_MGMT - echo $BR_STORAGE - echo $BR_FW_ADMIN - echo $BR_EX -} - -### MAIN - - -set_mode -backup_ifcfg -get_ips -create_ifcfg_br_mgmt -create_ifcfg_br_storage -create_ifcfg_br_fw_admin -if [ $MODE == "0" ] -then - create_ifcfg_eth0 -fi -allow_challenge -clean_ovs -check -reboot_me - - diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh deleted file mode 100755 index 145da80..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash -# -# Author: Daniel Smith (Ericsson) -# -# Script to update neutron configuration for OVSDB/ODL integratino -# -# Usage - Set / pass CONTROL_HOST to your needs -# -### SET THIS VALUE TO MATCH YOUR SYSTEM -CONTROL_HOST=192.168.0.2 -BR_EX_IP=172.30.9.70 - -# ENV -source ~/openrc -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUNCTIONS -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - sed -i -e 's/bridge_mappings=physnet2:br-prv/bridge_mappings=physnet1:br-ex/g' $ML2_CONF - echo "[ml2_odl]" >> $ML2_CONF - echo "password = admin" >> $ML2_CONF - echo "username = admin" >> $ML2_CONF - echo "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - -function disable_agent { - echo "Disabling Neutron Plugin Agents from running" - service neutron-plugin-openvswitch-agent stop - echo 'manual' > /etc/init/neutron-plugin-openvswitch-agent.override -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if [ -d "/var/lib/glance/images" ] - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function start_ovs { - echo "Starting OVS" - service openvswitch-vswitch start - ovs-vsctl show -} - - -function control_setup { - echo "Modifying Controller" - stop_neutron - stop_ovs - disable_agent - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. - mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - rm -rf /etc/openvswitch/.conf* - service openvswitch-switch start - ovs-vsctl add-br br-ex - ovs-vsctl add-port br-ex eth0 - ovs-vsctl set interface br-ex type=external - ifconfig br-ex 172.30.9.70/24 up - service neutron-server restart - - echo "setting up networks" - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp - ip link add link eth1 name br-storage type vlan id 301 - ip link add link eth1 name br-prv type vlan id 1000 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp - - echo "Setting ODL Manager IP" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - - # BAD HACK - Should be parameterized - this is to catch up - route add default gw 172.30.9.1 - -} - -function clean_ovs { - echo "cleaning OVS DB" - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - echo "restarting OVS - you should see Nothing there" - start_ovs -} - -function compute_setup { - echo "Modifying Compute" - echo "Disabling neutron openvswitch plugin" - stop_neutron - disable_agent - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp - ip link add link eth1 name br-storage type vlan id 301 - ip link add link eth1 name br-prv type vlan id 1000 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp - - echo "set manager, and route for ODL controller" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - route add 172.17.0.1 gw 192.168.0.2 - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh deleted file mode 100755 index fa14b47..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Author: Daniel Smith (Ericsson) -# Stages ODL Controlleer -# Inputs: odl_docker_image.tar -# Usage: ./stage_odl.sh - -# ENVS -source ~/.bashrc -source ~/openrc - -LOCALPATH=/opt/opnfv/odl -DOCKERBIN=docker-latest -ODLIMGNAME=odl_docker_image.tar -DNS=8.8.8.8 -HOST_IP=`ifconfig br-ex | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` - - - -# DEBUG ECHOS -echo $LOCALPATH -echo $DOCKERBIN -echo $ODLIMGNAME -echo $DNS -echo $HOST_IP - - -# Set DNS to someting external and default GW - ODL requires a connection to the internet -sed -i -e 's/nameserver 10.20.0.2/nameserver 8.8.8.8/g' /etc/resolv.conf -route delete default gw 10.20.0.2 -route add default gw 172.30.9.1 - -# Start Docker daemon and in background -echo "Starting Docker" -chmod +x $LOCALPATH/$DOCKERBIN -$LOCALPATH/$DOCKERBIN -d & -#courtesy sleep for virtual env -sleep 2 - -# Import the ODL Container -echo "Importing ODL Container" -$LOCALPATH/$DOCKERBIN load -i $LOCALPATH/$ODLIMGNAME - -# Start ODL, load DLUX and OVSDB modules -echo "Removing any old install found - file not found is ok here" -$LOCALPATH/$DOCKERBIN rm odl_docker -echo "Starting up ODL controller in Daemon mode - no shell possible" -$LOCALPATH/$DOCKERBIN run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel - -# Following, you should see the docker ps listed and a port opened -echo " you should reach ODL controller at http://HOST_IP:8181/dlux/index.html" -$LOCALPATH/$DOCKERBINNAME ps -a -netstat -lnt - - diff --git a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh deleted file mode 100755 index 7b91f4f..0000000 --- a/fuel/build/f_lith_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# Ericsson Canada Inc. -# Authoer: Daniel Smith -# -# A helper script to install and setup the ODL docker container on the controller -# -# -# Inputs: odl_docker_image.tar -# -# Usage: ./start_odl_docker.sh -echo "DEPRECATED - USE stage_odl.sh instead - this will be removed shortly once automated deployment is working - SR1" - - -# ENVS -source ~/.bashrc -source ~/openrc - -# VARS - -# Switch for Dev mode - uses apt-get on control to cheat and get docker installed locally rather than from puppet source - -DEV=1 - -# Switch for 1:1 port mapping of EXPOSED ports in Docker to the host, if set to 0, then random ports will be used - NOTE: this doesnt work for all web services X port on Host --> Y port in Container, -# especially for SSL/HTTPS cases. Be aware. - -MATCH_PORT=1 - -LOCALPATH=/opt/opnfv/odl -DOCKERBINNAME=docker-latest -DOCKERIMAGENAME=odl_docker_image.tar -DNS=8.8.8.8 -HOST_IP=`ifconfig br-fw-admin | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` - - -# Set this to "1" if you want to have your docker container startup into a shell - - -ENABLE_SHELL=1 - - -echo " Fetching Docker " -if [ "$DEV" -eq "1" ]; -# If testing Locally (on a control node) you can set DEV=1 to enable apt-get based install on the control node (not desired target, but good for testing). -then - echo "Dev Mode - Fetching from Internet"; - echo " this wont work in production builds"; - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - mkdir -p $LOCALPATH - wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O $LOCALPATH/$DOCKERBINNAME - wget http://ftp.us.debian.org/debian/pool/main/d/docker.io/docker.io_1.3.3~dfsg1-2_amd64.deb - chmod 777 $LOCALPATH/$DOCKERBINNAME - echo "done "; -else - echo "Using Binaries delivered from Puppet" - echo "Starting Docker in Daemon mode" - chmod +x $LOCALPATH/$DOCKERBINNAME - $LOCALPATH/$DOCKERBINNAME -d & - - # wait until docker will be fully initialized - # before any further action against just started docker - sleep 5 -fi - - -# We need to perform some cleanup of the Openstack Environment -echo "TODO -- This should be automated in the Fuel deployment at some point" -echo "However, the timing should come after basic tests are running, since this " -echo " part will remove the subnet router association that is deployed automativally" -echo " via fuel. Refer to the ODL + Openstack Integration Page " - -# Import the ODL container into docker - -echo "Importing ODL container into docker" -$LOCALPATH/$DOCKERBINNAME load -i $LOCALPATH/$DOCKERIMAGENAME - -echo " starting up ODL - DLUX and Mapping Ports" -if [ "$MATCH_PORT" -eq "1" ] -then - echo "Starting up Docker..." - $LOCALPATH/$DOCKERBINNAME rm odl_docker -fi - -if [ "$ENABLE_SHELL" -eq "1" ]; -then - echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" - $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash -else - echo "Starting Container in Daemon mode - no shell will be provided and docker attach will not provide shell)" - $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel - echo "should see the process listed here in docker ps -a" - $LOCALPATH/$DOCKERBINNAME ps -a; - echo "Match Port enabled, you can reach the DLUX login at: " - echo "http://$HOST_IP:8181/dlux.index.html" -fi diff --git a/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh b/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh deleted file mode 100644 index d292acd..0000000 --- a/fuel/build/f_lith_odl_docker/scripts/config_net_odl.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash -# -# Author: Daniel Smith (Ericsson) -# -# Script to update neutron configuration for OVSDB/ODL integratino -# -# Usage - Set / pass CONTROL_HOST to your needs -# -CONTROL_HOST=172.30.9.70 - -# ENV -source ~/openrc - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUNCTIONS - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - cat "[ml2_odl]" >> $ML2_CONF - cat "password = admin" >> $ML2_CONF - cat "username = admin" >> $ML2_CONF - cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if ls -l /var/lib/glance/images - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function control_setup { - echo "Modifying Controller" - stop_neutron - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. - mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. - service openvswitch-switch start - ovs-vsctl set-manager tcp:172.30.9.70:6640 - ovs-vsctl add-br br-eth0 - ovs-vsctl add-br br-ex - ovs-vsctl add-port br-eth0 eth0 - ovs-vsctl add-port br-eth0 br-eth0--br-ex - ovs-vsctl add-port br-ex br-ex--br-eth0 - ovs-vsctl set interface br-ex--br-eth0 type=patch - ovs-vsctl set interface br-eth0--br-ex type=patch - ovs-vsctl set interface br-ex--br-eth0 options:peer=br-eth0--br-ex - ovs-vsctl set interface br-eth0--br-ex options:peer=br-ex--br-eth0 - ifconfig br-ex 172.30.9.70/24 up - service neutron-server restart - - echo "setting up networks" - ip link add link eth1 name br-mgmt type vlan id 300 - ip link add link eth1 name br-storage type vlan id 301 - /etc/init.d/networking restart - - - echo "Reset Neutron DB" - #reset_neutrondb - echo "Restarting Neutron Components" - #restart_neutron - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - -} - -function compute_setup { - echo "do compute stuff here" - echo "stopping neutron openvswitch plugin" - stop_neutron - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 - ip link add link eth1 name br-storage type vlan id 301 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-mgmt | awk -F" " '{print $2}'`/24 - echo "set manager, and route for ODL controller" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - route add 172.17.0.1 gw 192.168.0.2 - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh deleted file mode 100644 index 3b688ae..0000000 --- a/fuel/build/f_lith_odl_docker/scripts/config_neutron_for_odl.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -CONTROL_HOST=172.17.0.3 - -# ENV -source ~/openrc - - - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUCNTIONS - - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF -#!/bin/bash -CONTROL_HOST=172.17.0.3 - -# ENV -source ~/openrc - - - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUCNTIONS - - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - cat "[ml2_odl]" >> $ML2_CONF - cat "password = admin" >> $ML2_CONF - cat "username = admin" >> $ML2_CONF - cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if df -k | grep glance - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function control_setup { - echo "do control stuff here" - echo "Reset Neutron DB" - #reset_neutrondb - echo "Restarting Neutron Components" - #restart_neutron - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - -} - -function compute_setup { - echo "do compute stuff here" - stop_neutron - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -#update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh deleted file mode 100755 index dd4fc9f..0000000 --- a/fuel/build/f_lith_odl_docker/scripts/prep_nets_for_odl.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -NEWGW=$2 -IMAGEPATH=/opt/opnfv -IMAGENAME=odl_docker_image.tar -SOURCES=/etc/apt/sources.list - - -if [ "$#" -ne 2]; then - echo "Two args not provided, will not touch networking" -else - - # Fix routes - echo "Fixing routes" - #DEBUG - netstat -rn - - echo "delete old def route" - route delete default gw $1 - echo "adding new def route" - route add default gw $2 - - echo " you should see a good nslookup now" - nslookup www.google.ca -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -NEWGW=$2 -IMAGEPATH=/opt/opnfv -IMAGENAME=odl_docker_image.tar -SOURCES=/etc/apt/sources.list - - -if [ "$#" -ne 2]; then - echo "Two args not provided, will not touch networking" -else - - # Fix routes - echo "Fixing routes" - #DEBUG - netstat -rn - - echo "delete old def route" - route delete default gw $1 - echo "adding new def route" - route add default gw $2 - - echo " you should see a good nslookup now" - nslookup www.google.ca -fi - - -if egrep "mirrors.txt" $SOURCES -then - echo "Sources was already updated, not touching" -else - echo "adding the closests mirrors and docker mirror to the mix" - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" >> /etc/apt/sources.list - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - echo "deb https://get.docker.com/ubuntu docker main " > /etc/apt/sources.list.d/docker.list -fi - -echo "Updating" -apt-get update -echo "Installing Docker" -apt-get install -y lxc-docker - -echo "Loading ODL Docker Image" -docker load -i $IMAGEPATH/$IMAGENAME - - diff --git a/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh b/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh deleted file mode 100644 index 42c9451..0000000 --- a/fuel/build/f_lith_odl_docker/scripts/setup_ovs_for_odl.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - - -ok .. so they created br-int - -so lets add a physical nic to it - - -# First - Removal all the bridges you find - -for i in $(ovs-vsctl list-br) -do - if [ "$i" == "br-int" ]; - then - echo "skipped br-int" - elif [ "$i" == "br-prv"]; - then - echo "skipped br-pr" - else - ovs-vsctl del-br $i - fi -done diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp index 436f496..54f1c86 100644 --- a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp @@ -25,6 +25,4 @@ class opnfv { include opnfv::add_packages # Setup OpenDaylight include opnfv::odl_docker - # Setup OpenDaylight - include opnfv::odl_lith_docker } -- cgit 1.2.3-korg From dd8ca32f84388f1bef6100459161855eee0509e9 Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Tue, 25 Aug 2015 11:25:32 -0400 Subject: Removed ODL_DOCKER implementation (DEPRECATED FOR PLUGIN ARCH IN FUEL 6.1/SR1 OF ARNO) Change-Id: I8643d268c5d5e3395725667deb50b5f9df7c3f09 JIRA:0 Signed-off-by: Daniel Smith --- common/puppet-opnfv/manifests/init.pp | 1 - common/puppet-opnfv/manifests/odl_docker.pp | 50 ----- .../manifests/templates/dockerfile/Dockerfile | 82 -------- .../dockerfile/container_scripts/check_feature.sh | 18 -- .../dockerfile/container_scripts/speak.sh | 20 -- .../start_odl_docker_container.sh | 48 ----- fuel/build/Makefile | 2 - fuel/build/f_odl_docker/Makefile | 51 ----- fuel/build/f_odl_docker/dockerfile/Dockerfile | 72 ------- .../dockerfile/container_scripts/check_feature.sh | 8 - .../dockerfile/container_scripts/speak.sh | 17 -- .../container_scripts/start_odl_docker.sh | 38 ---- .../puppet/modules/opnfv/manifests/odl_docker.pp | 77 -------- .../puppet/modules/opnfv/scripts/change.sh | 219 --------------------- .../puppet/modules/opnfv/scripts/config_net_odl.sh | 192 ------------------ .../puppet/modules/opnfv/scripts/stage_odl.sh | 54 ----- .../modules/opnfv/scripts/start_odl_container.sh | 95 --------- fuel/build/f_odl_docker/scripts/config_net_odl.sh | 164 --------------- .../f_odl_docker/scripts/config_neutron_for_odl.sh | 146 -------------- .../f_odl_docker/scripts/prep_nets_for_odl.sh | 90 --------- .../f_odl_docker/scripts/setup_ovs_for_odl.sh | 23 --- .../puppet/modules/opnfv/manifests/init.pp | 2 - 22 files changed, 1469 deletions(-) delete mode 100644 common/puppet-opnfv/manifests/odl_docker.pp delete mode 100644 common/puppet-opnfv/manifests/templates/dockerfile/Dockerfile delete mode 100644 common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/check_feature.sh delete mode 100644 common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/speak.sh delete mode 100644 common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/start_odl_docker_container.sh delete mode 100755 fuel/build/f_odl_docker/Makefile delete mode 100755 fuel/build/f_odl_docker/dockerfile/Dockerfile delete mode 100755 fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh delete mode 100755 fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh delete mode 100755 fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh delete mode 100644 fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp delete mode 100644 fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh delete mode 100755 fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh delete mode 100755 fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh delete mode 100755 fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh delete mode 100644 fuel/build/f_odl_docker/scripts/config_net_odl.sh delete mode 100644 fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh delete mode 100755 fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh delete mode 100644 fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/init.pp b/common/puppet-opnfv/manifests/init.pp index 7b68df5..d26bd7a 100644 --- a/common/puppet-opnfv/manifests/init.pp +++ b/common/puppet-opnfv/manifests/init.pp @@ -18,7 +18,6 @@ class opnfv { include opnfv::resolver include opnfv::ntp include opnfv::add_packages - include opnfv::odl_docker include opnfv::opncheck } diff --git a/common/puppet-opnfv/manifests/odl_docker.pp b/common/puppet-opnfv/manifests/odl_docker.pp deleted file mode 100644 index fdbbe67..0000000 --- a/common/puppet-opnfv/manifests/odl_docker.pp +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -class opnfv::odl_docker -{ - case $::fuel_settings['role'] { - /controller/: { - - file { "/opt": - ensure => "directory", - } - - file { "/opt/opnfv": - ensure => "directory", - owner => "root", - group => "root", - mode => 777, - } - - file { "/opt/opnfv/odl": - ensure => "directory", - } - - file { "/opt/opnfv/odl/odl_docker_image.tar": - ensure => present, - source => "/etc/puppet/modules/opnfv/odl_docker/odl_docker_image.tar", - mode => 750, - } - - file { "/opt/opnfv/odl/docker-latest": - ensure => present, - source => "/etc/puppet/modules/opnfv/odl_docker/docker-latest", - mode => 750, - } - - file { "/opt/opnfv/odl/start_odl_container.sh": - ensure => present, - source => "/etc/puppet/modules/opnfv/scripts/start_odl_container.sh", - mode => 750, - } - } - } -} - diff --git a/common/puppet-opnfv/manifests/templates/dockerfile/Dockerfile b/common/puppet-opnfv/manifests/templates/dockerfile/Dockerfile deleted file mode 100644 index 80a92d8..0000000 --- a/common/puppet-opnfv/manifests/templates/dockerfile/Dockerfile +++ /dev/null @@ -1,82 +0,0 @@ -#################################################################### -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# DOCKERFILE TO CREATE ODL IN CONTAINER AND EXPOSE DLUX AND OVSDB TO ODL -# -############################################################################# - - -#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff -FROM ubuntu:12.04 - -# Maintainer Info -MAINTAINER Daniel Smith - - -#Run apt-get update one start just to check for updates when building -RUN echo "Updating APT" -RUN apt-get update -RUN echo "Adding wget" -RUN apt-get install -y wget -RUN apt-get install -y net-tools -RUN apt-get install -y openjdk-7-jre -RUN apt-get install -y openjdk-7-jdk -RUN apt-get install -y openssh-server -RUN apt-get install -y vim -RUN apt-get install -y expect -RUN apt-get install -y daemontools -RUN mkdir -p /opt/odl_source -RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' - - - -#Now lets got and fetch the ODL distribution -RUN echo "Fetching ODL" -RUN wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz -O /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz - -RUN echo "Untarring ODL inplace" -RUN mkdir -p /opt/odl -RUN tar zxvf /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz -C /opt/odl - -RUN echo "Installing DLUX and other features into ODL" -#COPY dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh -COPY container_scripts/start_odl_docker_container.sh /etc/init.d/ -COPY container_scripts/speak.sh /etc/init.d/ -#COPY dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh -RUN chmod 777 /etc/init.d/start_odl_docker_container.sh -RUN chmod 777 /etc/init.d/speak.sh - - - -# Expose the ports - -# PORTS FOR BASE SYSTEM AND DLUX -EXPOSE 8101 -EXPOSE 6633 -EXPOSE 1099 -EXPOSE 43506 -EXPOSE 8181 -EXPOSE 8185 -EXPOSE 9000 -EXPOSE 39378 -EXPOSE 33714 -EXPOSE 44444 -EXPOSE 6653 - -# PORTS FOR OVSDB AND ODL CONTROL -EXPOSE 12001 -EXPOSE 6640 -EXPOSE 8080 -EXPOSE 7800 -EXPOSE 55130 -EXPOSE 52150 -EXPOSE 36826 - -# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable -CMD ["/etc/init.d/start_odl_docker_container.sh"] diff --git a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/check_feature.sh b/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/check_feature.sh deleted file mode 100644 index 533942e..0000000 --- a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/check_feature.sh +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -#!/usr/bin/expect -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:list | grep -i odl-restconf\r" -send "\r\r\r" -expect "root>" -send "logout\r" - - diff --git a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/speak.sh b/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/speak.sh deleted file mode 100644 index 95bbaf4..0000000 --- a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/speak.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/expect -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# - -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" -send "\r\r\r" -expect "root>" -send "logout\r" diff --git a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/start_odl_docker_container.sh b/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/start_odl_docker_container.sh deleted file mode 100644 index 8ae05f7..0000000 --- a/common/puppet-opnfv/manifests/templates/dockerfile/container_scripts/start_odl_docker_container.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# daniel.smith@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -################################################################################# -# Start up script for calling karaf / ODL inside a docker container. -# -# This script will also call a couple expect scripts to load the feature set that we want - - -#ENV -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 - -#MAIN -echo "Starting up the da Sheilds..." -/opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/karaf server & -echo "Sleeping 5 bad hack" -sleep 10 -echo "should see stuff listening now" -netstat -na -echo " should see proess running for karaf" -ps -efa -echo " Starting the packages we want" -/etc/init.d/speak.sh -echo "Printout the status - if its right, you should see 8181 appear now" -netstat -na -ps -efa - - - -## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute -## Cheap - but effective -while true; -do - echo "Checking status of ODL:" - /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/status - sleep 60 -done - - diff --git a/fuel/build/Makefile b/fuel/build/Makefile index 284f519..4acf5e2 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -42,7 +42,6 @@ SUBDIRS += f_osnaily SUBDIRS += f_l23network SUBDIRS += f_resolvconf SUBDIRS += f_ntp -SUBDIRS += f_odl_docker # f_example is only an example of how to generate a .deb package and # should not be enabled in official builds. @@ -62,7 +61,6 @@ all: @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE) @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE) @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE) - $(MAKE) -C f_odl_docker -f Makefile all @make -C docker @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso diff --git a/fuel/build/f_odl_docker/Makefile b/fuel/build/f_odl_docker/Makefile deleted file mode 100755 index 6135e71..0000000 --- a/fuel/build/f_odl_docker/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -TOP := $(shell pwd) -BUILDTAG := loving_daniel - -# Edit this to match the GENESIS / OPNFV in your environment -export OPNFV_PUPPET := $(BUILD_BASE)/../../common/puppet-opnfv -include ../config.mk - -.PHONY: all -all: - @mkdir -p puppet/modules/opnfv/odl_docker - @rm -rf tmp - @mkdir -p tmp - @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile tmp/. - @docker build -t ${BUILDTAG} tmp/dockerfile/. - @docker save ${BUILDTAG} > puppet/modules/opnfv/odl_docker/odl_docker_image.tar - @wget ${DOCKER_REPO}/${DOCKER_TAG} -O puppet/modules/opnfv/odl_docker/docker-latest - @echo "OPFNV_PUPPET is: ${OPNFV_PUPPET}" - @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile/container_scripts puppet/modules/opnfv - -.PHONY: clean -clean: - @rm -rf tmp - @rm -rf release - -.PHONY: build-clean -build-clean: - @rm -rf tmp - @rm -rf release - @rm -rf puppet/modules/opnfv/odl_docker/odl_docker_image.tar - @rm -rf puppet/modules/opnfv/odl_docker/docker-latest - -.PHONY: validate-cache -validate-cache: - @echo "No cache validation schema available for $(shell pwd)" - @echo "Continuing ..." - -.PHONY: release -release: - # Fetch PP from OPNFV Common - @cp -Rvp ${OPNFV_PUPPET}/manifests/odl_docker.pp ${PUPPET_DEST} - @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_odl_docker/dockerfile/Dockerfile b/fuel/build/f_odl_docker/dockerfile/Dockerfile deleted file mode 100755 index e3c7ee5..0000000 --- a/fuel/build/f_odl_docker/dockerfile/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -#################################################################### -# -# Dockerfile to build a ODL (Karaf) Docker Container -# -# Copyright daniel.smith@ericsson.com -# License: Apache GPL -# -#################################################################### - - -#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff -FROM ubuntu:12.04 - -# Maintainer Info -MAINTAINER Daniel Smith - -#Run apt-get update one start just to check for updates when building -RUN echo "Updating APT" -RUN apt-get update -RUN echo "Adding wget" -RUN apt-get install -y wget -RUN apt-get install -y net-tools -RUN apt-get install -y openjdk-7-jre -RUN apt-get install -y openjdk-7-jdk -RUN apt-get install -y openssh-server -RUN apt-get install -y vim -RUN apt-get install -y expect -RUN apt-get install -y daemontools -RUN mkdir -p /opt/odl_source -RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' - - -#Now lets got and fetch the ODL distribution -RUN echo "Fetching ODL" -RUN wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz -O /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz - -RUN echo "Untarring ODL inplace" -RUN mkdir -p /opt/odl -RUN tar zxvf /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz -C /opt/odl - -RUN echo "Installing DLUX and other features into ODL" -COPY tmp/dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh -COPY tmp/dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh -RUN chmod 777 /etc/init.d/start_odl_docker.sh -RUN chmod 777 /etc/init.d/speak.sh - - -# Expose the ports -# PORTS FOR BASE SYSTEM AND DLUX -EXPOSE 8101 -EXPOSE 6633 -EXPOSE 1099 -EXPOSE 43506 -EXPOSE 8181 -EXPOSE 8185 -EXPOSE 9000 -EXPOSE 39378 -EXPOSE 33714 -EXPOSE 44444 -EXPOSE 6653 - -# PORTS FOR OVSDB AND ODL CONTROL -EXPOSE 12001 -EXPOSE 6640 -EXPOSE 8080 -EXPOSE 7800 -EXPOSE 55130 -EXPOSE 52150 -EXPOSE 36826 - -# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable -CMD ["/etc/init.d/start_odl_docker.sh"] diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh deleted file mode 100755 index 3e5d0b2..0000000 --- a/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/expect -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:list | grep -i odl-restconf\r" -send "\r\r\r" -expect "root>" -send "logout\r" - diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh deleted file mode 100755 index 3ba07a8..0000000 --- a/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/expect -# Ericsson Research Canada -# -# Author: Daniel Smith -# -# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB -# -# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY -# DEPRECATED AFTER ARNO - -spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client -expect "root>" -send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" -send "\r\r\r" -expect "root>" -send "logout\r" - diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh deleted file mode 100755 index 1c72dda..0000000 --- a/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Ericsson Research Canada -# -# Author: Daniel Smith -# -# Start up script for calling karaf / ODL inside a docker container. -# -# This script will also call a couple expect scripts to load the feature set that we want - - -#ENV -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 - -#MAIN -echo "Starting up the da Sheilds..." -/opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/karaf server & -echo "Sleeping 5 bad hack" -sleep 10 -echo "should see stuff listening now" -netstat -na -echo " should see proess running for karaf" -ps -efa -echo " Starting the packages we want" -/etc/init.d/speak.sh -echo "Printout the status - if its right, you should see 8181 appear now" -netstat -na -ps -efa - - - -## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute -## Cheap - but effective -while true; -do - echo "Checking status of ODL:" - /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/status - sleep 60 -done diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp deleted file mode 100644 index 56f0216..0000000 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp +++ /dev/null @@ -1,77 +0,0 @@ -class opnfv::odl_docker -{ - case $::fuel_settings['role'] { - /controller/: { - - file { '/opt': - ensure => 'directory', - } - - file { '/opt/opnfv': - ensure => 'directory', - owner => 'root', - group => 'root', - mode => 777, - } - - file { '/opt/opnfv/odl': - ensure => 'directory', - } - - file { '/opt/opnfv/odl/odl_docker_image.tar': - ensure => present, - source => '/etc/puppet/modules/opnfv/odl_docker/odl_docker_image.tar', - mode => 750, - } - - file { '/opt/opnfv/odl/docker-latest': - ensure => present, - source => '/etc/puppet/modules/opnfv/odl_docker/docker-latest', - mode => 750, - } - - file { '/opt/opnfv/odl/start_odl_container.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', - mode => 750, - } - file { '/opt/opnfv/odl/stage_odl.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/stage_odl.sh', - mode => 750, - } - file { '/opt/opnfv/odl/config_net_odl.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/config_net_odl.sh', - mode => 750, - } - file { '/opt/opnfv/odl/change.sh': - ensure => present, - source => '/etc/puppet/modules/opnfv/scripts/change.sh', - mode => 750, - } - - - # fix failed to find the cgroup root issue - # https://github.com/docker/docker/issues/8791 - case $::operatingsystem { - 'ubuntu': { - package {'cgroup-lite': - ensure => present, - } - - service {'cgroup-lite': - ensure => running, - enable => true, - require => Package['cgroup-lite'], - } - } - 'centos': { - package {'docker-io': - ensure => latest, - } - } - } - } - } -} diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh deleted file mode 100644 index f7f3d6e..0000000 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh +++ /dev/null @@ -1,219 +0,0 @@ -#!/bin/bash -# script to remove bridges and reset networking for ODL - - -#VARS -MODE=0 -DNS=8.8.8.8 - -#ENV -source ~/openrc - -# GET IPS for that node -function get_ips { - BR_MGMT=`grep address /etc/network/ifcfg_backup/ifcfg-br-mgmt | awk -F" " '{print $2}'` - BR_STORAGE=`grep address /etc/network/ifcfg_backup/ifcfg-br-storage | awk -F" " '{print $2}'` - BR_FW_ADMIN=`grep address /etc/network/ifcfg_backup/ifcfg-br-fw-admin | awk -F" " '{print $2}'` - BR_EX=`grep address /etc/network/ifcfg_backup/ifcfg-br-ex | awk -F" " '{print $2}'` - DEF_NETMASK=255.255.255.0 - DEF_GW=172.30.9.1 -} - -function backup_ifcfg { - echo " backing up " - mkdir -p /etc/network/ifcfg_backup - mv /etc/network/interfaces.d/ifcfg-br-ex /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-fw-admin /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-mgmt /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-storage /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-br-prv /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-eth0 /etc/network/ifcfg_backup/. - mv /etc/network/interfaces.d/ifcfg-eth1 /etc/network/ifcfg_backup/. - rm -rf /etc/network/interfaces.d/ifcfg-eth1.300 - rm -rf /etc/network/interfaces.d/ifcfg-eth1.301 - rm -rf /etc/network/interfaces.d/ifcfg-eth1 - rm -rf /etc/network/interfaces.d/ifcfg-eth0 - -} - - -function create_ifcfg_br_mgmt { - echo "migrating br_mgmt" - echo "auto eth1.300" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo "iface eth1.300 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo " address $BR_MGMT" >> /etc/network/interfaces.d/ifcfg-eth1.300 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.300 -} - -function create_ifcfg_br_storage { - echo "migration br_storage" - echo "auto eth1.301" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo "iface eth1.301 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo " address $BR_STORAGE" >> /etc/network/interfaces.d/ifcfg-eth1.301 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.301 -} - -function create_ifcfg_br_fw_admin { - echo " migratinng br_fw_admin" - echo "auto eth1" >> /etc/network/interfaces.d/ifcfg-eth1 - echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1 - echo " address $BR_FW_ADMIN" >> /etc/network/interfaces.d/ifcfg-eth1 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1 -} - -function create_ifcfg_eth0 { - echo "migratinng br-ex to eth0 - temporarily" - echo "auto eth0" >> /etc/network/interfaces.d/ifcfg-eth0 - echo "iface eth0 inet static" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " address $BR_EX" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth0 - echo " gateway $DEF_GW" >> /etc/network/interfaces.d/ifcfg-eth0 -} - -function set_mode { - if [ -d "/var/lib/glance/images" ] - then - echo " controller " - MODE=0 - else - echo " compute " - MODE=1 - fi -} - - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function start_ovs { - echo "Starting OVS" - service openvswitch-switch start - ovs-vsctl show -} - - -function clean_ovs { - echo "cleaning OVS DB" - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - echo "restarting OVS - you should see Nothing there" - start_ovs -} - - - -function reboot_me { - reboot -} - -function allow_challenge { - sed -i -e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config - service ssh restart -} - -function clean_neutron { - subnets=( `neutron subnet-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - networks=( `neutron net-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - ports=( `neutron port-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - routers=( `neutron router-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) - - #display all elements - echo "SUBNETS: ${subnets[@]} " - echo "NETWORKS: ${networks[@]} " - echo "PORTS: ${ports[@]} " - echo "ROUTERS: ${routers[@]} " - - - # get port and subnet for each router - for i in "${routers[@]}" - do - routerport=( `neutron router-port-list $i | awk -F" " '{print $2}' | grep -v id | sed '/^$/d' `) - routersnet=( `neutron router-port-list $i | awk -F" " '{print $8}' | grep -v fixed | sed '/^$/d' | sed 's/,$//' | sed -e 's/^"//' -e 's/"$//' `) - done - - echo "ROUTER PORTS: ${routerport[@]} " - echo "ROUTER SUBNET: ${routersnet[@]} " - - #remove router subnets - echo "router-interface-delete" - for i in "${routersnet[@]}" - do - neutron router-interface-delete ${routers[0]} $i - done - - #remove subnets - echo "subnet-delete" - for i in "${subnets[@]}" - do - neutron subnet-delete $i - done - - #remove nets - echo "net-delete" - for i in "${networks[@]}" - do - neutron net-delete $i - done - - #remove routers - echo "router-delete" - for i in "${routers[@]}" - do - neutron router-delete $i - done - - #remove ports - echo "port-delete" - for i in "${ports[@]}" - do - neutron port-delete $i - done - - #remove subnets - echo "subnet-delete second pass" - for i in "${subnets[@]}" - do - neutron subnet-delete $i - done - -} - -function set_dns { - sed -i -e 's/nameserver 10.20.0.2/nameserver $DNS/g' /etc/resolv.conf -} - - -#OUTPUT - -function check { - echo $BR_MGMT - echo $BR_STORAGE - echo $BR_FW_ADMIN - echo $BR_EX -} - -### MAIN - - -set_mode -backup_ifcfg -get_ips -create_ifcfg_br_mgmt -create_ifcfg_br_storage -create_ifcfg_br_fw_admin -if [ $MODE == "0" ] -then - create_ifcfg_eth0 -fi -allow_challenge -clean_ovs -check -reboot_me - - diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh deleted file mode 100755 index 145da80..0000000 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash -# -# Author: Daniel Smith (Ericsson) -# -# Script to update neutron configuration for OVSDB/ODL integratino -# -# Usage - Set / pass CONTROL_HOST to your needs -# -### SET THIS VALUE TO MATCH YOUR SYSTEM -CONTROL_HOST=192.168.0.2 -BR_EX_IP=172.30.9.70 - -# ENV -source ~/openrc -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUNCTIONS -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - sed -i -e 's/bridge_mappings=physnet2:br-prv/bridge_mappings=physnet1:br-ex/g' $ML2_CONF - echo "[ml2_odl]" >> $ML2_CONF - echo "password = admin" >> $ML2_CONF - echo "username = admin" >> $ML2_CONF - echo "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - -function disable_agent { - echo "Disabling Neutron Plugin Agents from running" - service neutron-plugin-openvswitch-agent stop - echo 'manual' > /etc/init/neutron-plugin-openvswitch-agent.override -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if [ -d "/var/lib/glance/images" ] - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function start_ovs { - echo "Starting OVS" - service openvswitch-vswitch start - ovs-vsctl show -} - - -function control_setup { - echo "Modifying Controller" - stop_neutron - stop_ovs - disable_agent - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. - mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - rm -rf /etc/openvswitch/.conf* - service openvswitch-switch start - ovs-vsctl add-br br-ex - ovs-vsctl add-port br-ex eth0 - ovs-vsctl set interface br-ex type=external - ifconfig br-ex 172.30.9.70/24 up - service neutron-server restart - - echo "setting up networks" - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp - ip link add link eth1 name br-storage type vlan id 301 - ip link add link eth1 name br-prv type vlan id 1000 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp - - echo "Setting ODL Manager IP" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - - # BAD HACK - Should be parameterized - this is to catch up - route add default gw 172.30.9.1 - -} - -function clean_ovs { - echo "cleaning OVS DB" - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. - rm -rf /etc/openvswitch/conf.db - echo "restarting OVS - you should see Nothing there" - start_ovs -} - -function compute_setup { - echo "Modifying Compute" - echo "Disabling neutron openvswitch plugin" - stop_neutron - disable_agent - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp - ip link add link eth1 name br-storage type vlan id 301 - ip link add link eth1 name br-prv type vlan id 1000 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp - - echo "set manager, and route for ODL controller" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - route add 172.17.0.1 gw 192.168.0.2 - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh deleted file mode 100755 index fa14b47..0000000 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Author: Daniel Smith (Ericsson) -# Stages ODL Controlleer -# Inputs: odl_docker_image.tar -# Usage: ./stage_odl.sh - -# ENVS -source ~/.bashrc -source ~/openrc - -LOCALPATH=/opt/opnfv/odl -DOCKERBIN=docker-latest -ODLIMGNAME=odl_docker_image.tar -DNS=8.8.8.8 -HOST_IP=`ifconfig br-ex | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` - - - -# DEBUG ECHOS -echo $LOCALPATH -echo $DOCKERBIN -echo $ODLIMGNAME -echo $DNS -echo $HOST_IP - - -# Set DNS to someting external and default GW - ODL requires a connection to the internet -sed -i -e 's/nameserver 10.20.0.2/nameserver 8.8.8.8/g' /etc/resolv.conf -route delete default gw 10.20.0.2 -route add default gw 172.30.9.1 - -# Start Docker daemon and in background -echo "Starting Docker" -chmod +x $LOCALPATH/$DOCKERBIN -$LOCALPATH/$DOCKERBIN -d & -#courtesy sleep for virtual env -sleep 2 - -# Import the ODL Container -echo "Importing ODL Container" -$LOCALPATH/$DOCKERBIN load -i $LOCALPATH/$ODLIMGNAME - -# Start ODL, load DLUX and OVSDB modules -echo "Removing any old install found - file not found is ok here" -$LOCALPATH/$DOCKERBIN rm odl_docker -echo "Starting up ODL controller in Daemon mode - no shell possible" -$LOCALPATH/$DOCKERBIN run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel - -# Following, you should see the docker ps listed and a port opened -echo " you should reach ODL controller at http://HOST_IP:8181/dlux/index.html" -$LOCALPATH/$DOCKERBINNAME ps -a -netstat -lnt - - diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh deleted file mode 100755 index 7b91f4f..0000000 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# Ericsson Canada Inc. -# Authoer: Daniel Smith -# -# A helper script to install and setup the ODL docker container on the controller -# -# -# Inputs: odl_docker_image.tar -# -# Usage: ./start_odl_docker.sh -echo "DEPRECATED - USE stage_odl.sh instead - this will be removed shortly once automated deployment is working - SR1" - - -# ENVS -source ~/.bashrc -source ~/openrc - -# VARS - -# Switch for Dev mode - uses apt-get on control to cheat and get docker installed locally rather than from puppet source - -DEV=1 - -# Switch for 1:1 port mapping of EXPOSED ports in Docker to the host, if set to 0, then random ports will be used - NOTE: this doesnt work for all web services X port on Host --> Y port in Container, -# especially for SSL/HTTPS cases. Be aware. - -MATCH_PORT=1 - -LOCALPATH=/opt/opnfv/odl -DOCKERBINNAME=docker-latest -DOCKERIMAGENAME=odl_docker_image.tar -DNS=8.8.8.8 -HOST_IP=`ifconfig br-fw-admin | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` - - -# Set this to "1" if you want to have your docker container startup into a shell - - -ENABLE_SHELL=1 - - -echo " Fetching Docker " -if [ "$DEV" -eq "1" ]; -# If testing Locally (on a control node) you can set DEV=1 to enable apt-get based install on the control node (not desired target, but good for testing). -then - echo "Dev Mode - Fetching from Internet"; - echo " this wont work in production builds"; - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - mkdir -p $LOCALPATH - wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O $LOCALPATH/$DOCKERBINNAME - wget http://ftp.us.debian.org/debian/pool/main/d/docker.io/docker.io_1.3.3~dfsg1-2_amd64.deb - chmod 777 $LOCALPATH/$DOCKERBINNAME - echo "done "; -else - echo "Using Binaries delivered from Puppet" - echo "Starting Docker in Daemon mode" - chmod +x $LOCALPATH/$DOCKERBINNAME - $LOCALPATH/$DOCKERBINNAME -d & - - # wait until docker will be fully initialized - # before any further action against just started docker - sleep 5 -fi - - -# We need to perform some cleanup of the Openstack Environment -echo "TODO -- This should be automated in the Fuel deployment at some point" -echo "However, the timing should come after basic tests are running, since this " -echo " part will remove the subnet router association that is deployed automativally" -echo " via fuel. Refer to the ODL + Openstack Integration Page " - -# Import the ODL container into docker - -echo "Importing ODL container into docker" -$LOCALPATH/$DOCKERBINNAME load -i $LOCALPATH/$DOCKERIMAGENAME - -echo " starting up ODL - DLUX and Mapping Ports" -if [ "$MATCH_PORT" -eq "1" ] -then - echo "Starting up Docker..." - $LOCALPATH/$DOCKERBINNAME rm odl_docker -fi - -if [ "$ENABLE_SHELL" -eq "1" ]; -then - echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" - $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash -else - echo "Starting Container in Daemon mode - no shell will be provided and docker attach will not provide shell)" - $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel - echo "should see the process listed here in docker ps -a" - $LOCALPATH/$DOCKERBINNAME ps -a; - echo "Match Port enabled, you can reach the DLUX login at: " - echo "http://$HOST_IP:8181/dlux.index.html" -fi diff --git a/fuel/build/f_odl_docker/scripts/config_net_odl.sh b/fuel/build/f_odl_docker/scripts/config_net_odl.sh deleted file mode 100644 index d292acd..0000000 --- a/fuel/build/f_odl_docker/scripts/config_net_odl.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/bash -# -# Author: Daniel Smith (Ericsson) -# -# Script to update neutron configuration for OVSDB/ODL integratino -# -# Usage - Set / pass CONTROL_HOST to your needs -# -CONTROL_HOST=172.30.9.70 - -# ENV -source ~/openrc - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUNCTIONS - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - cat "[ml2_odl]" >> $ML2_CONF - cat "password = admin" >> $ML2_CONF - cat "username = admin" >> $ML2_CONF - cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if ls -l /var/lib/glance/images - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function control_setup { - echo "Modifying Controller" - stop_neutron - stop_ovs - rm -rf /var/log/openvswitch/* - mkdir -p /opt/opnfv/odl/ovs_back - mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. - mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. - service openvswitch-switch start - ovs-vsctl set-manager tcp:172.30.9.70:6640 - ovs-vsctl add-br br-eth0 - ovs-vsctl add-br br-ex - ovs-vsctl add-port br-eth0 eth0 - ovs-vsctl add-port br-eth0 br-eth0--br-ex - ovs-vsctl add-port br-ex br-ex--br-eth0 - ovs-vsctl set interface br-ex--br-eth0 type=patch - ovs-vsctl set interface br-eth0--br-ex type=patch - ovs-vsctl set interface br-ex--br-eth0 options:peer=br-eth0--br-ex - ovs-vsctl set interface br-eth0--br-ex options:peer=br-ex--br-eth0 - ifconfig br-ex 172.30.9.70/24 up - service neutron-server restart - - echo "setting up networks" - ip link add link eth1 name br-mgmt type vlan id 300 - ip link add link eth1 name br-storage type vlan id 301 - /etc/init.d/networking restart - - - echo "Reset Neutron DB" - #reset_neutrondb - echo "Restarting Neutron Components" - #restart_neutron - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - -} - -function compute_setup { - echo "do compute stuff here" - echo "stopping neutron openvswitch plugin" - stop_neutron - ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 - ip link add link eth1 name br-storage type vlan id 301 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-mgmt | awk -F" " '{print $2}'`/24 - echo "set manager, and route for ODL controller" - ovs-vsctl set-manager tcp:192.168.0.2:6640 - route add 172.17.0.1 gw 192.168.0.2 - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh b/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh deleted file mode 100644 index 3b688ae..0000000 --- a/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -CONTROL_HOST=172.17.0.3 - -# ENV -source ~/openrc - - - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUCNTIONS - - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF -#!/bin/bash -CONTROL_HOST=172.17.0.3 - -# ENV -source ~/openrc - - - -# VARS -ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini -MODE=0 - - -# FUCNTIONS - - -# Update ml2_conf.ini -function update_ml2conf { - echo "Backing up and modifying ml2_conf.ini" - cp $ML2_CONF $ML2_CONF.bak - sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF - sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF - cat "[ml2_odl]" >> $ML2_CONF - cat "password = admin" >> $ML2_CONF - cat "username = admin" >> $ML2_CONF - cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF -} - -function reset_neutrondb { - echo "Reseting DB" - mysql -e "drop database if exists neutron_ml2;" - mysql -e "create database neutron_ml2 character set utf8;" - mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" - neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head -} - -function restart_neutron { - echo "Restarting Neutron Server" - service neutron-server restart - echo "Should see Neutron runing now" - service neutron-server status - echo "Shouldnt be any nets, but should work (return empty)" - neutron net-list -} - -function stop_neutron { - echo "Stopping Neutron / OVS components" - service neutron-plugin-openvswitch-agent stop - if [ $MODE == "0" ] - then - service neutron-server stop - fi -} - - - -function verify_ML2_working { - echo "checking that we can talk via ML2 properly" - curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 - if grep "network" /tmp/check_ml2 - then - echo "Success - ML2 to ODL is working" - else - echo "im sorry Jim, but its dead" - fi - -} - - -function set_mode { - if df -k | grep glance - then - echo "Controller Mode" - MODE=0 - else - echo "Compute Mode" - MODE=1 - fi -} - -function stop_ovs { - echo "Stopping OpenVSwitch" - service openvswitch-switch stop - -} - -function control_setup { - echo "do control stuff here" - echo "Reset Neutron DB" - #reset_neutrondb - echo "Restarting Neutron Components" - #restart_neutron - echo "Verifying ODL ML2 plugin is working" - verify_ML2_working - -} - -function compute_setup { - echo "do compute stuff here" - stop_neutron - verify_ML2_working -} - - -# MAIN -echo "Starting to make call" -#update_ml2conf -echo "Check Mode" -set_mode - -if [ $MODE == "0" ]; -then - echo "Calling control setup" - control_setup -elif [ $MODE == "1" ]; -then - echo "Calling compute setup" - compute_setup - -else - echo "Something is bad - call for help" - exit -fi - - diff --git a/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh b/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh deleted file mode 100755 index dd4fc9f..0000000 --- a/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -NEWGW=$2 -IMAGEPATH=/opt/opnfv -IMAGENAME=odl_docker_image.tar -SOURCES=/etc/apt/sources.list - - -if [ "$#" -ne 2]; then - echo "Two args not provided, will not touch networking" -else - - # Fix routes - echo "Fixing routes" - #DEBUG - netstat -rn - - echo "delete old def route" - route delete default gw $1 - echo "adding new def route" - route add default gw $2 - - echo " you should see a good nslookup now" - nslookup www.google.ca -#!/bin/bash -# a "cheat" way to install docker on the controller -# can only be used if you have a connecting out to the internet - -# Usage: ./install_docker.sh - -OLDGW=$1 -NEWGW=$2 -IMAGEPATH=/opt/opnfv -IMAGENAME=odl_docker_image.tar -SOURCES=/etc/apt/sources.list - - -if [ "$#" -ne 2]; then - echo "Two args not provided, will not touch networking" -else - - # Fix routes - echo "Fixing routes" - #DEBUG - netstat -rn - - echo "delete old def route" - route delete default gw $1 - echo "adding new def route" - route add default gw $2 - - echo " you should see a good nslookup now" - nslookup www.google.ca -fi - - -if egrep "mirrors.txt" $SOURCES -then - echo "Sources was already updated, not touching" -else - echo "adding the closests mirrors and docker mirror to the mix" - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse" >> /etc/apt/sources.list - echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" >> /etc/apt/sources.list - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - echo "deb https://get.docker.com/ubuntu docker main " > /etc/apt/sources.list.d/docker.list -fi - -echo "Updating" -apt-get update -echo "Installing Docker" -apt-get install -y lxc-docker - -echo "Loading ODL Docker Image" -docker load -i $IMAGEPATH/$IMAGENAME - - diff --git a/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh b/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh deleted file mode 100644 index 42c9451..0000000 --- a/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - - -ok .. so they created br-int - -so lets add a physical nic to it - - -# First - Removal all the bridges you find - -for i in $(ovs-vsctl list-br) -do - if [ "$i" == "br-int" ]; - then - echo "skipped br-int" - elif [ "$i" == "br-prv"]; - then - echo "skipped br-pr" - else - ovs-vsctl del-br $i - fi -done diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp index 54f1c86..fabe30a 100644 --- a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp @@ -23,6 +23,4 @@ class opnfv { include opnfv::ntp # Make sure all added packages are installed include opnfv::add_packages - # Setup OpenDaylight - include opnfv::odl_docker } -- cgit 1.2.3-korg From 8ce84b06eb628e3b1a2145a3bfda75ca12082edb Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Mon, 31 Aug 2015 10:36:27 -0400 Subject: Fixes puppet modules to come from Genesis repo This patch deprecates the use of puppet-trystack repo and migrates the puppet modules even to Genesis. deploy.sh now now copies the modules from the current Genesis repo into foreman VM's /vagrant to be used during install (rather than recloning). Associated changes in Khaleesi/QuickStack: - Khaleesi: commit 31b912778847f295d1459a71e5c41c808977c91d - Astapor: commit ac4be11e348d7bcff1e1aa28c96056e18dba5291 JIRA: APEX-8 Change-Id: I322ac797d1d687f17434e07e6775acef8961bdef Signed-off-by: Tim Rozet --- common/puppet-opnfv/manifests/compute.pp | 43 +++++++----- .../puppet-opnfv/manifests/controller_networker.pp | 79 +++++++++++----------- .../manifests/external_net_presetup.pp | 2 +- common/puppet-opnfv/manifests/templates/br_ex.erb | 10 +++ foreman/ci/deploy.sh | 29 +++----- 5 files changed, 85 insertions(+), 78 deletions(-) create mode 100644 common/puppet-opnfv/manifests/templates/br_ex.erb (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/compute.pp b/common/puppet-opnfv/manifests/compute.pp index 0b81757..2fed241 100644 --- a/common/puppet-opnfv/manifests/compute.pp +++ b/common/puppet-opnfv/manifests/compute.pp @@ -51,11 +51,11 @@ class opnfv::compute { if !$ceilometer_metering_secret { $ceilometer_metering_secret = $single_password } ##HA Global params - if $ha_flag { + if $ha_flag and str2bool($ha_flag) { if $private_network == '' { fail('private_network is empty') } if !$keystone_private_vip { fail('keystone_private_vip is empty') } if !$glance_private_vip { fail('glance_private_vip is empty') } - if !$nova_private_vip { fail('nova_private_vip is empty') } + if !$nova_public_vip { fail('nova_public_vip is empty') } if !$nova_db_password { $nova_db_password = $single_password } if !$nova_user_password { $nova_user_password = $single_password } if !$controllers_ip_array { fail('controllers_ip_array is empty') } @@ -78,19 +78,30 @@ class opnfv::compute { } else { ##non HA params - if $ovs_tunnel_if == '' { fail('ovs_tunnel_if is empty') } - if !$private_ip { fail('private_ip is empty') } - $keystone_private_vip = $private_ip - $glance_private_vip = $private_ip - $nova_private_vip = $private_ip - $neutron_private_vip = $private_ip - if !$nova_db_password { fail('nova_db_password is empty') } - if !$nova_user_password { fail('nova_user_password is empty') } - if !$odl_control_ip { $odl_control_ip = $private_ip } - if !$mysql_ip { $mysql_ip = $private_ip } - if !$amqp_ip { $amqp_ip = $private_ip } - if !$amqp_username { $amqp_username = 'guest' } - if !$amqp_password { $amqp_password = 'guest' } + ##Mandatory + if $private_network == '' { fail('private_network is empty') } + if ($odl_flag != '') and str2bool($odl_flag) { + if $odl_control_ip == '' { fail('odl_control_ip is empty') } + } + if $controller_ip == '' { fail('controller_ip is empty') } + + ##Optional + ##Find private interface + $ovs_tunnel_if = get_nic_from_network("$private_network") + ##Find private ip + $private_ip = get_ip_from_nic("$ovs_tunnel_if") + + $keystone_private_vip = $controller_ip + $glance_private_vip = $controller_ip + $nova_public_vip = $controller_ip + $neutron_private_vip = $controller_ip + + if !$nova_db_password { $nova_db_password = $single_password } + if !$nova_user_password { $nova_user_password = $single_password } + if !$mysql_ip { $mysql_ip = $controller_ip } + if !$amqp_ip { $amqp_ip = $controller_ip } + if !$amqp_username { $amqp_username = $single_username } + if !$amqp_password { $amqp_password = $single_password } if !$ceph_mon_host { $ceph_mon_host= ["$private_ip"] } if !$ceph_mon_initial_members { $ceph_mon_initial_members = ["$::hostname"] } } @@ -103,7 +114,7 @@ class opnfv::compute { libvirt_inject_password => 'false', libvirt_inject_key => 'false', libvirt_images_type => 'rbd', - nova_host => $nova_private_vip, + nova_host => $nova_public_vip, nova_db_password => $nova_db_password, nova_user_password => $nova_user_password, private_network => '', diff --git a/common/puppet-opnfv/manifests/controller_networker.pp b/common/puppet-opnfv/manifests/controller_networker.pp index b148ec8..60cae34 100644 --- a/common/puppet-opnfv/manifests/controller_networker.pp +++ b/common/puppet-opnfv/manifests/controller_networker.pp @@ -329,50 +329,47 @@ class opnfv::controller_networker { } } else { - if $ovs_tunnel_if == '' { fail('ovs_tunnel_if is empty') } - if $public_ip == '' { fail('public_ip is empty') } - if $private_ip == '' { fail('private_ip is empty') } - - if $odl_control_ip == '' { $odl_control_ip = $private_ip } - - if $mysql_ip == '' { fail('mysql_ip is empty') } - if $mysql_root_password == '' { fail('mysql_root_password is empty') } - if $amqp_ip == '' { fail('amqp_ip is empty') } - - if $memcache_ip == '' { fail('memcache_ip is empty') } - if $neutron_ip == '' { fail('neutron_ip is empty') } - - if $keystone_db_password == '' { fail('keystone_db_password is empty') } - - if $horizon_secret_key == '' { fail('horizon_secret_key is empty') } - - if $nova_user_password == '' { fail('nova_user_password is empty') } - if $nova_db_password == '' { fail('nova_db_password is empty') } - - if $cinder_user_password == '' { fail('cinder_user_password is empty') } - if $cinder_db_password == '' { fail('cinder_db_password is empty') } - - if $glance_user_password == '' { fail('glance_user_password is empty') } - if $glance_db_password == '' { fail('glance_db_password is empty') } - - if $neutron_user_password == '' { fail('neutron_user_password is empty') } - if $neutron_db_password == '' { fail('neutron_db_password is empty') } - if $neutron_metadata_shared_secret == '' { fail('neutron_metadata_shared_secret is empty') } - - if $ceilometer_user_password == '' { fail('ceilometer_user_password is empty') } - if $ceilometer_metering_secret == '' { fail('ceilometer_user_password is empty') } - - if $heat_user_password == '' { fail('heat_user_password is empty') } - if $heat_db_password == '' { fail('heat_db_password is empty') } - if $heat_auth_encrypt_key == '' { fail('heat_auth_encrypt_key is empty') } - - if $swift_user_password == '' { fail('swift_user_password is empty') } - if $swift_shared_secret == '' { fail('swift_shared_secret is empty') } - if $swift_admin_password == '' { fail('swift_admin_password is empty') } + ##Mandatory Non-HA parameters + if $private_network == '' { fail('private_network is empty') } + if $public_network == '' { fail('public_network is empty') } + ##Optional Non-HA parameters if !$amqp_username { $amqp_username = $single_username } if !$amqp_password { $amqp_password = $single_password } + if !$mysql_root_password { $mysql_root_password = $single_password } + if !$keystone_db_password { $keystone_db_password = $single_password } + if !$horizon_secret_key { $horizon_secret_key = $single_password } + if !$nova_db_password { $nova_db_password = $single_password } + if !$nova_user_password { $nova_user_password = $single_password } + if !$cinder_db_password { $cinder_db_password = $single_password } + if !$cinder_user_password { $cinder_user_password = $single_password } + if !$glance_db_password { $glance_db_password = $single_password } + if !$glance_user_password { $glance_user_password = $single_password } + if !$neutron_db_password { $neutron_db_password = $single_password } + if !$neutron_user_password { $neutron_user_password = $single_password } + if !$neutron_metadata_shared_secret { $neutron_metadata_shared_secret = $single_password } + if !$ceilometer_user_password { $ceilometer_user_password = $single_password } + if !$ceilometer_metering_secret { $ceilometer_metering_secret = $single_password } + if !$heat_user_password { $heat_user_password = $single_password } + if !$heat_db_password { $heat_db_password = $single_password } + if !$heat_auth_encryption_key { $heat_auth_encryption_key = 'octopus1octopus1' } + if !$swift_user_password { $swift_user_password = $single_password } + if !$swift_shared_secret { $swift_shared_secret = $single_password } + if !$swift_admin_password { $swift_admin_password = $single_password } + ##Find private interface + $ovs_tunnel_if = get_nic_from_network("$private_network") + ##Find private ip + $private_ip = get_ip_from_nic("$ovs_tunnel_if") + #Find public NIC + $public_nic = get_nic_from_network("$public_network") + $public_ip = get_ip_from_nic("$public_nic") + + if !$mysql_ip { $mysql_ip = $private_ip } + if !$amqp_ip { $amqp_ip = $private_ip } + if !$memcache_ip { $memcache_ip = $private_ip } + if !$neutron_ip { $neutron_ip = $private_ip } + if !$odl_control_ip { $odl_control_ip = $private_ip } class { "quickstack::neutron::controller_networker": admin_email => $admin_email, @@ -427,6 +424,8 @@ class opnfv::controller_networker { horizon_cert => $quickstack::params::horizon_cert, horizon_key => $quickstack::params::horizon_key, + keystonerc => true, + ml2_mechanism_drivers => $ml2_mech_drivers, #neutron => true, diff --git a/common/puppet-opnfv/manifests/external_net_presetup.pp b/common/puppet-opnfv/manifests/external_net_presetup.pp index b7c7c5f..96038c0 100644 --- a/common/puppet-opnfv/manifests/external_net_presetup.pp +++ b/common/puppet-opnfv/manifests/external_net_presetup.pp @@ -85,7 +85,7 @@ class opnfv::external_net_presetup { owner => 'root', group => 'root', mode => '0644', - content => template('trystack/br_ex.erb'), + content => template('opnfv/br_ex.erb'), before => Class["quickstack::pacemaker::params"], } -> diff --git a/common/puppet-opnfv/manifests/templates/br_ex.erb b/common/puppet-opnfv/manifests/templates/br_ex.erb new file mode 100644 index 0000000..6c0e7e7 --- /dev/null +++ b/common/puppet-opnfv/manifests/templates/br_ex.erb @@ -0,0 +1,10 @@ +DEVICE=br-ex +DEVICETYPE=ovs +IPADDR=<%= @public_nic_ip %> +NETMASK=<%= @public_nic_netmask %> +GATEWAY=<%= @public_gateway %> +BOOTPROTO=static +ONBOOT=yes +TYPE=OVSBridge +PROMISC=yes +PEERDNS=no diff --git a/foreman/ci/deploy.sh b/foreman/ci/deploy.sh index a05b3de..13ed641 100755 --- a/foreman/ci/deploy.sh +++ b/foreman/ci/deploy.sh @@ -415,20 +415,13 @@ clean_tmp() { } ##clone genesis and move to node vm dir -##params: none -##usage: clone_bgs +##params: destination directory +##usage: clone_bgs /tmp/myvm/ clone_bgs() { - cd /tmp/ - rm -rf /tmp/genesis/ - - ##clone artifacts and move into foreman_vm dir - if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/genesis.git; then - printf '%s\n' 'deploy.sh: Unable to clone genesis repo' >&2 - exit 1 - fi - - mv -f /tmp/genesis/foreman/ci $vm_dir/foreman_vm - rm -rf /tmp/genesis/ + script=`realpath $0` + script_dir="`dirname "$script"`" + cp -fr $script_dir/ $1 + cp -fr $script_dir/../../common/puppet-opnfv $1 } ##validates the network settings and update VagrantFile with network settings @@ -911,13 +904,7 @@ start_virtual_nodes() { rm -rf /tmp/genesis/ ##clone genesis and move into node folder - if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/genesis.git; then - printf '%s\n' 'deploy.sh: Unable to clone vagrant repo' >&2 - exit 1 - fi - - mv -f /tmp/genesis/foreman/ci $vm_dir/$node - rm -rf /tmp/genesis/ + clone_bgs $vm_dir/$node cd $vm_dir/$node @@ -1118,7 +1105,7 @@ main() { install_vagrant clean_tmp verify_vm_dir - clone_bgs + clone_bgs $vm_dir/foreman_vm configure_network configure_virtual start_foreman -- cgit 1.2.3-korg From 0b37d5341d714a1bf8ef8b5637d8b8fbd7c948c2 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Tue, 1 Sep 2015 11:33:23 -0400 Subject: Fixes external network to services tenant and no dhcp External network should have been provisioned as services tenant. The external network and subnet are both changed with this patch. The external subnet is also now configured to disable dhcp. JIRA: APEX-9, APEX-10 Change-Id: I3e41dc4b0678efeb0824259147008cf455d8de1e Signed-off-by: Tim Rozet --- common/puppet-opnfv/manifests/external_net_setup.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common/puppet-opnfv') diff --git a/common/puppet-opnfv/manifests/external_net_setup.pp b/common/puppet-opnfv/manifests/external_net_setup.pp index af00f20..fc014d4 100644 --- a/common/puppet-opnfv/manifests/external_net_setup.pp +++ b/common/puppet-opnfv/manifests/external_net_setup.pp @@ -60,7 +60,7 @@ class opnfv::external_net_setup { provider_network_type => flat, provider_physical_network => 'physnet1', router_external => true, - tenant_name => 'admin', + tenant_name => 'services', } -> neutron_subnet { 'provider_subnet': @@ -70,8 +70,9 @@ class opnfv::external_net_setup { gateway_ip => $public_gateway, allocation_pools => [ "start=${public_allocation_start},end=${public_allocation_end}" ], dns_nameservers => $public_dns, + enable_dhcp => false, network_name => 'provider_network', - tenant_name => 'admin', + tenant_name => 'services', } -> neutron_router { 'provider_router': -- cgit 1.2.3-korg