aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2017-01-03 13:42:46 -0800
committerMarcus G K Williams <marcus.williams@intel.com>2017-04-18 12:57:55 -0700
commit278bcdb154f6e9b62dcd823c9233d8b1d93ba45d (patch)
tree06b30df608a10b82de2ffc2b55c62287cbb034ed
parent1cad4813b60dcea08587375e7cfd7b3f8b407592 (diff)
downloadkolla-278bcdb154f6e9b62dcd823c9233d8b1d93ba45d.tar.gz
kolla-278bcdb154f6e9b62dcd823c9233d8b1d93ba45d.zip
Add OpenDaylight Container to kolla
Implements docker container template for OpenDaylight. Change-Id: Icdcff77f0f6088f5a4db1bf77e37334dbd42074f Partially-Implements: blueprint opendaylight-support
-rw-r--r--contrib/template-override/.keep0
-rw-r--r--contrib/template-override/opendaylight-template-overrides.j222
-rw-r--r--doc/index.rst9
-rw-r--r--doc/template-override/.keep0
-rw-r--r--doc/template-override/opendaylight-source.rst38
-rw-r--r--docker/opendaylight/Dockerfile.j244
-rw-r--r--docker/opendaylight/extend_start.sh10
-rw-r--r--docker/opendaylight/opendaylight.repo5
-rwxr-xr-xkolla/common/config.py15
-rw-r--r--releasenotes/notes/add-opendaylight-fee2807442ce3c6d.yaml3
-rw-r--r--tests/test_build.py4
11 files changed, 150 insertions, 0 deletions
diff --git a/contrib/template-override/.keep b/contrib/template-override/.keep
deleted file mode 100644
index e69de29bb..000000000
--- a/contrib/template-override/.keep
+++ /dev/null
diff --git a/contrib/template-override/opendaylight-template-overrides.j2 b/contrib/template-override/opendaylight-template-overrides.j2
new file mode 100644
index 000000000..e9f6cf38e
--- /dev/null
+++ b/contrib/template-override/opendaylight-template-overrides.j2
@@ -0,0 +1,22 @@
+{% extends parent_template %}
+
+{% block neutron_server_footer %}
+ADD plugins-archive /
+RUN pip --no-cache-dir install /plugins/*
+{% endblock %}
+
+{% block opendaylight_source_install %}
+ {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
+ {% set opendaylight_packages = ['java-1.8.0-openjdk'] %}
+ {% elif base_distro in ['ubuntu', 'debian'] %}
+ {% set opendaylight_packages = ['openjdk-8-jre'] %}
+ {% endif %}
+
+{{ macros.install_packages(opendaylight_packages | customizable("packages")) }}
+
+ {% if opendaylight_distro is not defined %}
+ {% set opendaylight_distro = 'distribution-karaf-0.5.3-Boron-SR3' %}
+ {% endif %}
+ADD opendaylight-archive /opendaylight
+RUN ln -s /opendaylight/{{ opendaylight_distro }} /opt/opendaylight
+{% endblock %}
diff --git a/doc/index.rst b/doc/index.rst
index c63a9d2ed..54e620212 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -55,3 +55,12 @@ Developer Docs
CONTRIBUTING
running-tests
bug-triage
+
+Template Override Docs
+======================
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+
+ template-override/*
diff --git a/doc/template-override/.keep b/doc/template-override/.keep
deleted file mode 100644
index e69de29bb..000000000
--- a/doc/template-override/.keep
+++ /dev/null
diff --git a/doc/template-override/opendaylight-source.rst b/doc/template-override/opendaylight-source.rst
new file mode 100644
index 000000000..caf980774
--- /dev/null
+++ b/doc/template-override/opendaylight-source.rst
@@ -0,0 +1,38 @@
+==================
+OpenDaylight Build
+==================
+
+To build OpenDaylight, use of a template override
+`opendaylight-template-overrides.j2` is needed.
+The template override enables OpenDaylight use
+with OpenStack by installing required networking-odl
+plugin in neutron-server container.
+
+If you wish to install a different version of OpenDaylight
+then distro packages, use a source build (in most cases this is
+a prebuilt binary package).
+
+Building OpenDaylight Containers
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+- For source builds append the following to kolla-build.conf,
+ selecting the version of OpenDaylight to use for your source build.
+
+- Change `opendaylight_distro` to match the folder where OpenDaylight
+ build resides. For example, if using prebuilt archive from OpenDaylight
+ downloads `distribution-karaf-0.5.3-Boron-SR3.tar.gz` becomes
+ `distribution-karaf-0.5.3-Boron-SR3`.
+
+kolla-build.conf
+________________
+.. code-block:: console
+
+ opendaylight_distro = distribution-karaf-0.5.3-Boron-SR3
+ [opendaylight]
+ type = url
+ location = https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.5.3-Boron-SR3/distribution-karaf-0.5.3-Boron-SR3.tar.gz
+
+Build the container (source or binary) by executing the following command::
+::
+ kolla-build --template-override contrib/template-override/opendaylight-template-overrides.j2 opendaylight
diff --git a/docker/opendaylight/Dockerfile.j2 b/docker/opendaylight/Dockerfile.j2
new file mode 100644
index 000000000..81c4a0d74
--- /dev/null
+++ b/docker/opendaylight/Dockerfile.j2
@@ -0,0 +1,44 @@
+FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
+MAINTAINER {{ maintainer }}
+
+{% block opendaylight_header %}{% endblock %}
+
+{% import "macros.j2" as macros with context %}
+
+{{ macros.configure_user(name='opendaylight') }}
+
+{% if install_type == 'binary' %}
+ {% set opendaylight_packages = ['opendaylight'] %}
+ {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
+
+ {% if opendaylight_repo is not defined %}
+ {% set opendaylight_repo = 'opendaylight.repo' %}
+ {% endif %}
+COPY {{ opendaylight_repo }} /etc/yum.repos.d/
+
+ {% elif base_distro in ['ubuntu', 'debian'] %}
+ {% if odl_release_deb_url is not defined %}
+ {% if base_distro in 'ubuntu' %}
+ {% set odl_release_deb_url = 'http://download.opensuse.org/repositories/home:/akshitajha/xUbuntu_16.04/' %}
+ {% elif base_distro in 'debian' %}
+ {% set odl_release_deb_url = 'http://download.opensuse.org/repositories/home:/akshitajha/Debian_8.0/' %}
+ {% endif %}
+ {% endif %}
+RUN sh -c "echo 'deb {{ odl_release_deb_url }} /' > /etc/apt/sources.list.d/opendaylight.list" \
+&& apt-get update
+ {% endif %}
+
+{{ macros.install_packages(opendaylight_packages | customizable("packages")) }}
+
+{% elif install_type == 'source' %}
+{% block opendaylight_source_install %}
+RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
+ && /bin/false
+{% endblock %}
+{% endif %}
+
+COPY extend_start.sh /usr/local/bin/kolla_extend_start
+RUN chmod 755 /usr/local/bin/kolla_extend_start
+
+{% block opendaylight_footer %}{% endblock %}
+{% block footer %}{% endblock %}
diff --git a/docker/opendaylight/extend_start.sh b/docker/opendaylight/extend_start.sh
new file mode 100644
index 000000000..8fdba0726
--- /dev/null
+++ b/docker/opendaylight/extend_start.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+OPENDAYLIGHT_LOG_DIR=/var/log/kolla/opendaylight
+
+if [[ ! -d "${OPENDAYLIGHT_LOG_DIR}" ]]; then
+ mkdir -p "${OPENDAYLIGHT_LOG_DIR}"
+fi
+if [[ $(stat -c %a "${OPENDAYLIGHT_LOG_DIR}") != "755" ]]; then
+ chmod 755 "${OPENDAYLIGHT_LOG_DIR}"
+fi
diff --git a/docker/opendaylight/opendaylight.repo b/docker/opendaylight/opendaylight.repo
new file mode 100644
index 000000000..0962252e1
--- /dev/null
+++ b/docker/opendaylight/opendaylight.repo
@@ -0,0 +1,5 @@
+[opendaylight]
+name=CentOS CBS OpenDaylight Release Repository
+baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-5-release/$basearch/os/
+enabled=1
+gpgcheck=0
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 25b3db351..6001c0c64 100755
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -49,6 +49,7 @@ _PROFILE_OPTS = [
'mariadb',
'memcached',
'mongodb',
+ 'opendaylight',
'openvswitch',
'rabbitmq',
'redis',
@@ -460,6 +461,10 @@ SOURCES = {
'type': 'url',
'location': ('$tarballs_base/neutron-lbaas/'
'neutron-lbaas-master.tar.gz')},
+ 'neutron-server-plugin-networking-odl': {
+ 'type': 'url',
+ 'location': ('$tarballs_base/networking-odl/'
+ 'networking-odl-master.tar.gz')},
'neutron-server-plugin-neutron-dynamic-routing': {
'type': 'url',
'location': ('$tarballs_base/neutron-dynamic-routing/'
@@ -496,6 +501,12 @@ SOURCES = {
'type': 'url',
'location': ('$tarballs_base/octavia/'
'octavia-master.tar.gz')},
+ 'opendaylight': {
+ 'type': 'url',
+ 'location': ('https://nexus.opendaylight.org/content/'
+ 'repositories/opendaylight.release/org/opendaylight/'
+ 'integration/distribution-karaf/0.5.3-Boron-SR3/'
+ 'distribution-karaf-0.5.3-Boron-SR3.tar.gz')},
'panko-base': {
'type': 'url',
'location': ('$tarballs_base/panko/'
@@ -798,6 +809,10 @@ USERS = {
'uid': 42461,
'gid': 42461,
},
+ 'opendaylight-user': {
+ 'uid': 42462,
+ 'gid': 42462,
+ }
}
diff --git a/releasenotes/notes/add-opendaylight-fee2807442ce3c6d.yaml b/releasenotes/notes/add-opendaylight-fee2807442ce3c6d.yaml
new file mode 100644
index 000000000..f1e722f99
--- /dev/null
+++ b/releasenotes/notes/add-opendaylight-fee2807442ce3c6d.yaml
@@ -0,0 +1,3 @@
+---
+features:
+ - Add OpenDaylight docker template and supporting files.
diff --git a/tests/test_build.py b/tests/test_build.py
index 01a9dedce..ebbee7880 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -102,6 +102,7 @@ class BuildTestCentosSource(BuildTest, base.BaseTestCase):
"bifrost-base",
"kafka",
"mistral-base",
+ "opendaylight"
]
def setUp(self):
@@ -142,6 +143,7 @@ class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase):
class BuildTestUbuntuSource(BuildTest, base.BaseTestCase):
excluded_images = [
"bifrost-base",
+ "opendaylight"
]
def setUp(self):
@@ -182,6 +184,7 @@ class BuildTestDebianBinary(BuildTest, base.BaseTestCase):
class BuildTestDebianSource(BuildTest, base.BaseTestCase):
excluded_images = [
"bifrost-base",
+ "opendaylight"
]
def setUp(self):
@@ -220,6 +223,7 @@ class BuildTestOracleLinuxSource(BuildTest, base.BaseTestCase):
excluded_images = [
"bifrost-base",
"kafka",
+ "opendaylight"
]
def setUp(self):