Merge remote-tracking branch 'origin/master' into v4.0
Fix stage3 for v4.0 branch: proper list of components
Change-Id: I97f693e14cd6e6c2c215629700d193fec3c30d76
diff --git a/descriptor-packages/tools/upgrade_descriptor_version.py b/descriptor-packages/tools/upgrade_descriptor_version.py
index e33d234..7db1ec6 100755
--- a/descriptor-packages/tools/upgrade_descriptor_version.py
+++ b/descriptor-packages/tools/upgrade_descriptor_version.py
@@ -129,6 +129,31 @@
if "vnfd:vnfd-catalog" in data or "vnfd-catalog" in data:
descriptor = "VNF"
+ #Check if mgmt-interface is defined:
+ remove_prefix(data, "vnfd:")
+ vnfd_descriptor = data["vnfd-catalog"]
+ vnfd_list = vnfd_descriptor["vnfd"]
+ mgmt_iface = False
+ for vnfd in vnfd_list:
+ vdu_list = vnfd["vdu"]
+ for vdu in vdu_list:
+ interface_list = []
+ external_interface_list = vdu.pop("external-interface", ())
+ for external_interface in external_interface_list:
+ if external_interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'VIRTIO' instead")
+ interface_list = vdu.pop("interface", ())
+ for interface in interface_list:
+ if interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'VIRTIO' instead")
+ if vnfd.get("mgmt-interface"):
+ mgmt_iface = True
+ if vnfd["mgmt-interface"].get("vdu-id"):
+ raise KeyError("'mgmt-iface': Deprecated 'vdu-id' field. Please, use 'cp' field instead")
+ if not mgmt_iface:
+ raise KeyError("'mgmt-iface' is a mandatory field and it is not defined")
myvnfd = vnfd_catalog.vnfd()
pybindJSONDecoder.load_ietf_json(data, None, None, obj=myvnfd)
elif "nsd:nsd-catalog" in data or "nsd-catalog" in data:
@@ -192,6 +217,8 @@
error_position.append("external-interface")
for external_interface in external_interface_list:
error_position[-1] = "external-interface[{}]".format(external_interface["name"])
+ if "rw-vnfd:floating-ip-needed" in external_interface:
+ del external_interface["rw-vnfd:floating-ip-needed"]
external_interface["type"] = "EXTERNAL"
external_interface["external-connection-point-ref"] = \
external_interface.pop("vnfd-connection-point-ref")
@@ -210,6 +237,14 @@
internal_interface.pop("vdu-internal-connection-point-ref")
interface_list.append(internal_interface)
error_position.pop()
+
+ #Removing "rw-vnfd:floating-ip-needed" items from V3 descriptors
+ interfaces = vdu.pop("interface", ())
+ for iface in interfaces:
+ if "rw-vnfd:floating-ip-needed" in iface:
+ del iface["rw-vnfd:floating-ip-needed"]
+ interface_list.append(iface)
+
# order interface alphabetically and set position
if interface_list:
interface_list = sorted(interface_list,
diff --git a/descriptor-packages/tools/validate_descriptor.py b/descriptor-packages/tools/validate_descriptor.py
index 36e7c8d..010ba16 100755
--- a/descriptor-packages/tools/validate_descriptor.py
+++ b/descriptor-packages/tools/validate_descriptor.py
@@ -46,6 +46,28 @@
print(" -i|--input FILE: (same as param FILE) descriptor file to be upgraded")
return
+def remove_prefix(desc, prefix):
+ """
+ Recursively removes prefix from keys
+ :param desc: dictionary or list to change
+ :param prefix: prefix to remove. Must
+ :return: None, param desc is changed
+ """
+ prefix_len = len(prefix)
+ if isinstance(desc, dict):
+ prefixed_list=[]
+ for k,v in desc.items():
+ if isinstance(v, (list, tuple, dict)):
+ remove_prefix(v, prefix)
+ if isinstance(k, str) and k.startswith(prefix) and k != prefix:
+ prefixed_list.append(k)
+ for k in prefixed_list:
+ desc[k[prefix_len:]] = desc.pop(k)
+ elif isinstance(desc, (list, tuple)):
+ for i in desc:
+ if isinstance(desc, (list, tuple, dict)):
+ remove_prefix(i, prefix)
+
if __name__=="__main__":
error_position = []
format_output_yaml = True
@@ -91,6 +113,31 @@
if "vnfd:vnfd-catalog" in data or "vnfd-catalog" in data:
descriptor = "VNF"
+ # Check if mgmt-interface is defined:
+ remove_prefix(data, "vnfd:")
+ vnfd_descriptor = data["vnfd-catalog"]
+ vnfd_list = vnfd_descriptor["vnfd"]
+ mgmt_iface = False
+ for vnfd in vnfd_list:
+ vdu_list = vnfd["vdu"]
+ for vdu in vdu_list:
+ interface_list = []
+ external_interface_list = vdu.pop("external-interface", ())
+ for external_interface in external_interface_list:
+ if external_interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'VIRTIO' instead")
+ interface_list = vdu.pop("interface", ())
+ for interface in interface_list:
+ if interface.get("virtual-interface", {}).get("type") == "OM-MGMT":
+ raise KeyError(
+ "Wrong 'Virtual-interface type': Deprecated 'OM-MGMT' value. Please, use 'VIRTIO' instead")
+ if vnfd.get("mgmt-interface"):
+ mgmt_iface = True
+ if vnfd["mgmt-interface"].get("vdu-id"):
+ raise KeyError("'mgmt-iface': Deprecated 'vdu-id' field. Please, use 'cp' field instead")
+ if not mgmt_iface:
+ raise KeyError("'mgmt-iface' is a mandatory field and it is not defined")
myvnfd = vnfd_catalog.vnfd()
pybindJSONDecoder.load_ietf_json(data, None, None, obj=myvnfd)
elif "nsd:nsd-catalog" in data or "nsd-catalog" in data:
diff --git a/devops-stages/stage-archive.sh b/devops-stages/stage-archive.sh
index 593860b..b89e3c1 100755
--- a/devops-stages/stage-archive.sh
+++ b/devops-stages/stage-archive.sh
@@ -14,13 +14,13 @@
# License for the specific language governing permissions and limitations
# under the License.
-PKG_DIRECTORIES="jenkins installers systest juju-charms descriptor-packages tools"
+PKG_DIRECTORIES="jenkins installers systest juju-charms descriptor-packages tools docker"
MDG_NAME=devops
DEB_INSTALL=debian/osm-$MDG_NAME.install
export DEBEMAIL="mmarchetti@sandvine.com"
export DEBFULLNAME="Michael Marchetti"
-PKG_VERSION=$(git describe --tags --abbrev=0)
+PKG_VERSION=$(git describe --match "v*" --tags --abbrev=0)
PKG_VERSION_PREFIX=$(echo $PKG_VERSION | sed -e 's/v//g')
PKG_VERSION_POST=$(git rev-list $PKG_VERSION..HEAD | wc -l)
if [ "$PKG_VERSION_POST" -eq 0 ]; then
diff --git a/docker/.gitignore b/docker/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/docker/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/docker/Keystone/Dockerfile b/docker/Keystone/Dockerfile
new file mode 100644
index 0000000..9163562
--- /dev/null
+++ b/docker/Keystone/Dockerfile
@@ -0,0 +1,45 @@
+FROM ubuntu:16.04
+
+LABEL Maintainer="esousa@whitestack.com" \
+ Description="Openstack Keystone Instance" \
+ Version="1.0" \
+ Author="Eduardo Sousa"
+
+EXPOSE 5000
+
+WORKDIR /keystone
+
+COPY scripts/start.sh /keystone/start.sh
+
+RUN apt-get update && \
+ apt-get upgrade -y && \
+ apt-get autoremove -y && \
+ apt-get install -y software-properties-common && \
+ add-apt-repository -y cloud-archive:queens && \
+ apt-get update && apt dist-upgrade -y && \
+ apt-get install -y python-openstackclient keystone apache2 libapache2-mod-wsgi net-tools mysql-client && \
+ rm -rf /var/lib/apt/lists/* && \
+ chmod +x start.sh
+
+# DB Hostname
+ENV DB_HOST keystone-db
+
+# DB Port
+ENV DB_PORT 3306
+
+# DB Root User
+ENV ROOT_DB_USER root
+
+# DB Root Password
+ENV ROOT_DB_PASSWORD admin
+
+# Keystone user password
+ENV KEYSTONE_DB_PASSWORD admin
+
+# Admin password
+ENV ADMIN_PASSWORD admin
+
+# NBI password
+ENV NBI_PASSWORD nbi
+
+ENTRYPOINT ./start.sh
\ No newline at end of file
diff --git a/docker/Keystone/Makefile b/docker/Keystone/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/Keystone/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/Keystone/scripts/start.sh b/docker/Keystone/scripts/start.sh
new file mode 100755
index 0000000..4d95c60
--- /dev/null
+++ b/docker/Keystone/scripts/start.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+max_attempts=120
+function wait_db(){
+ db_host=$1
+ db_port=$2
+ attempt=0
+ echo "Wait until $max_attempts seconds for MySQL mano Server ${db_host}:${db_port} "
+ while ! mysqladmin ping -h"$db_host" -P"$db_port" --silent; do
+ #wait 120 sec
+ if [ $attempt -ge $max_attempts ]; then
+ echo
+ echo "Can not connect to database ${db_host}:${db_port} during $max_attempts sec"
+ return 1
+ fi
+ attempt=$[$attempt+1]
+ echo -n "."
+ sleep 1
+ done
+ return 0
+}
+
+function is_db_created() {
+ db_host=$1
+ db_port=$2
+ db_user=$3
+ db_pswd=$4
+ db_name=$5
+
+ RESULT=`mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -o $db_name`
+ if [ "$RESULT" == "$db_name" ]; then
+ echo "DB $db_name exists"
+ return 0
+ else
+ echo "DB $db_name does not exist"
+ return 1
+ fi
+}
+
+wait_db "$DB_HOST" "$DB_PORT" || exit 1
+
+is_db_created "$DB_HOST" "$DB_PORT" "$ROOT_DB_USER" "$ROOT_DB_PASSWORD" "keystone" && DB_EXISTS="Y"
+
+if [ -z $DB_EXISTS ]; then
+ mysql -h"$DB_HOST" -P"$DB_PORT" -u"$ROOT_DB_USER" -p"$ROOT_DB_PASSWORD" --default_character_set utf8 -e "CREATE DATABASE keystone"
+ mysql -h"$DB_HOST" -P"$DB_PORT" -u"$ROOT_DB_USER" -p"$ROOT_DB_PASSWORD" --default_character_set utf8 -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '$KEYSTONE_DB_PASSWORD'"
+ mysql -h"$DB_HOST" -P"$DB_PORT" -u"$ROOT_DB_USER" -p"$ROOT_DB_PASSWORD" --default_character_set utf8 -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '$KEYSTONE_DB_PASSWORD'"
+fi
+
+# Setting Keystone database connection
+sed -i "721s%.*%connection = mysql+pymysql://keystone:$KEYSTONE_DB_PASSWORD@$DB_HOST:$DB_PORT/keystone%" /etc/keystone/keystone.conf
+
+# Setting Keystone tokens
+sed -i "2934s%.*%provider = fernet%" /etc/keystone/keystone.conf
+
+# Populate Keystone database
+if [ -z $DB_EXISTS ]; then
+ su -s /bin/sh -c "keystone-manage db_sync" keystone
+fi
+
+# Initialize Fernet key repositories
+keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
+keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
+
+# Bootstrap Keystone service
+if [ -z $DB_EXISTS ]; then
+ keystone-manage bootstrap --bootstrap-password "$ADMIN_PASSWORD" \
+ --bootstrap-admin-url http://keystone:5000/v3/ \
+ --bootstrap-internal-url http://keystone:5000/v3/ \
+ --bootstrap-public-url http://keystone:5000/v3/ \
+ --bootstrap-region-id RegionOne
+fi
+
+# Restart Apache Service
+service apache2 restart
+
+cat << EOF >> setup_env
+export OS_PROJECT_DOMAIN_NAME=default
+export OS_USER_DOMAIN_NAME=default
+export OS_PROJECT_NAME=admin
+export OS_USERNAME=admin
+export OS_PASSWORD=$ADMIN_PASSWORD
+export OS_AUTH_URL=http://keystone:5000/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_IMAGE_API_VERSION=2
+EOF
+
+source setup_env
+
+# Create NBI User
+if [ -z $DB_EXISTS ]; then
+ openstack user create --domain default --password "$NBI_PASSWORD" nbi
+ openstack project create --domain default --description "Service Project" service
+ openstack role add --project service --user nbi admin
+fi
+
+while [ $(ps -ef | grep -v grep | grep apache2 | wc -l) -ne 0 ]
+do
+ sleep 60
+done
+
+exit 1
diff --git a/docker/LCM/Dockerfile b/docker/LCM/Dockerfile
new file mode 100644
index 0000000..46be58e
--- /dev/null
+++ b/docker/LCM/Dockerfile
@@ -0,0 +1,95 @@
+# This creates som/LCM docker from from last stable package
+
+FROM ubuntu:16.04
+
+# Set the working directory to /app
+WORKDIR /app/osm_lcm
+
+# avoid extra information from packages
+RUN echo 'path-exclude /usr/share/doc/*\n\
+path-include /usr/share/doc/*/copyright\n\
+path-exclude /usr/share/man/*\n\
+path-exclude /usr/share/groff/*\n\
+path-exclude /usr/share/info/*\n\
+path-exclude /usr/share/lintian/*\n\
+path-exclude /usr/share/linda/*\n'\
+> /etc/dpkg/dpkg.cfg.d/01_nodoc && \
+ echo 'APT::Install-Recommends "false";\n\
+APT::AutoRemove::RecommendsImportant "false";\n\
+APT::AutoRemove::SuggestsImportant "false";\n'\
+> /etc/apt/apt.conf.d/99_norecommends
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get update && apt-get install -y git make python3 \
+ python3-pip python3-pymongo python3-yaml python3-aiohttp \
+ python3-all python3-setuptools \
+ python3-bitarray python3-regex python3-lxml dh-python wget tox \
+ python3-cffi \
+ && pip3 install pip==9.0.3 \
+ && pip3 install -U aiokafka pyang lxml six enum34 \
+ && pip3 install websockets==4.0.1 \
+ && pip3 install requests
+
+RUN pip3 install PyNaCl
+
+RUN git clone https://osm.etsi.org/gerrit/osm/N2VC.git \
+ && cd N2VC \
+ && git checkout BUILD_v4.0.1_1 \
+ && cd modules/libjuju && python3 setup.py develop && cd ../.. \
+ && pip3 install -U -r requirements.txt
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} LCM N2VC common" && apt update
+
+ARG LCM_VERSION
+ARG COMMON_VERSION
+ARG N2VC_VERSION
+
+RUN apt-get update && apt-get install -y python3-osm-lcm${LCM_VERSION} \
+ python3-osm-common${COMMON_VERSION} \
+ python3-n2vc${N2VC_VERSION} \
+ && rm -rf /var/lib/apt/lists/*
+
+EXPOSE 9999
+
+LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
+ Description="This implements life cycle management engine for OSM" \
+ Version="1.0" \
+ Author="Alfonso Tierno"
+
+# Used for local storage
+VOLUME /app/storage
+# Used for logs
+VOLUME /app/log
+
+# The following ENV can be added with "docker run -e xxx' to configure LCM
+ENV OSMLCM_RO_HOST ro
+ENV OSMLCM_RO_PORT 9090
+ENV OSMLCM_RO_TENANT osm
+
+# VCA
+ENV OSMLCM_VCA_HOST vca
+ENV OSMLCM_VCA_PORT: 17070
+ENV OSMLCM_VCA_USER: admin
+ENV OSMLCM_VCA_SECRET: secret
+
+# database
+ENV OSMLCM_DATABASE_DRIVER mongo
+ENV OSMLCM_DATABASE_HOST mongo
+ENV OSMLCM_DATABASE_PORT 27017
+ENV OSMLCM_STORAGE_DRIVER local
+ENV OSMLCM_STORAGE_PATH /app/storage
+
+# message
+ENV OSMLCM_MESSAGE_DRIVER kafka
+ENV OSMLCM_MESSAGE_HOST kafka
+ENV OSMLCM_MESSAGE_PORT 9092
+
+# Run app.py when the container launches
+CMD ["python3", "/usr/lib/python3/dist-packages/osm_lcm/lcm.py"]
diff --git a/docker/LCM/Makefile b/docker/LCM/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/LCM/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/MON/Dockerfile b/docker/MON/Dockerfile
new file mode 100644
index 0000000..0da9c91
--- /dev/null
+++ b/docker/MON/Dockerfile
@@ -0,0 +1,56 @@
+# Copyright 2018 Whitestack, LLC
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Whitestack, LLC
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: bdiaz@whitestack.com or glavado@whitestack.com
+##
+
+FROM ubuntu:16.04
+
+LABEL authors="Guillermo Calvino"
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get --yes update \
+ && apt-get --yes install git python python-pip python3 python3-pip libmysqlclient-dev libssl-dev libffi-dev \
+ && pip3 install pip==9.0.3
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} MON common" && apt update
+
+ARG MON_VERSION
+ARG COMMON_VERSION
+
+RUN apt-get --yes update && apt-get -y install python3-osm-common${COMMON_VERSION} python3-osm-mon${MON_VERSION}
+
+COPY scripts/ scripts/
+
+RUN pip3 install -r scripts/requirements.txt
+
+# These ENV must be provided
+# ENV BROKER_URI=kafka:9092
+# ENV OS_NOTIFIER_URI=<IP_ACCESIBLE_FROM_OPENSTACK>:8662
+
+EXPOSE 8662
+
+CMD /bin/bash scripts/runInstall.sh
diff --git a/docker/MON/Makefile b/docker/MON/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/MON/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/MON/scripts/requirements.txt b/docker/MON/scripts/requirements.txt
new file mode 100644
index 0000000..28bb719
--- /dev/null
+++ b/docker/MON/scripts/requirements.txt
@@ -0,0 +1,39 @@
+# Copyright 2017 Intel Research and Development Ireland Limited
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Intel Corporation
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com
+kafka==1.3.*
+lxml==4.2.*
+requests==2.18.*
+logutils==0.3.*
+cherrypy==14.0.*
+jsmin==2.2.*
+jsonschema==2.6.*
+python-openstackclient==3.15.*
+python-novaclient==10.1.*
+python-keystoneclient==3.15.*
+boto==2.48
+python-cloudwatchlogs-logging==0.0.3
+py-cloudwatch==0.0.1
+pyvcloud==19.1.1
+pyopenssl==17.5.*
+six==1.11.*
+bottle==0.12.*
+peewee==3.1.*
+pyyaml==3.*
diff --git a/docker/MON/scripts/runInstall.sh b/docker/MON/scripts/runInstall.sh
new file mode 100755
index 0000000..236aa3d
--- /dev/null
+++ b/docker/MON/scripts/runInstall.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# Copyright 2018 Whitestack, LLC
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Whitestack, LLC
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: bdiaz@whitestack.com or glavado@whitestack.com
+##
+/bin/bash /mon/osm_mon/plugins/vRealiseOps/vROPs_Webservice/install.sh
+python3 /usr/lib/python3/dist-packages/osm_mon/plugins/OpenStack/Aodh/notifier.py &
+python3 ./usr/lib/python3/dist-packages/osm_mon/core/message_bus/common_consumer.py
+
diff --git a/docker/Makefile b/docker/Makefile
new file mode 100644
index 0000000..6e6ae57
--- /dev/null
+++ b/docker/Makefile
@@ -0,0 +1,17 @@
+#
+# Copyright 2017 Sandvine
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+SUBDIRS = MON NBI osmclient RO LCM light-ui POL Keystone
+include mk/dirs.mk
diff --git a/docker/NBI/Dockerfile b/docker/NBI/Dockerfile
new file mode 100644
index 0000000..d2d0c36
--- /dev/null
+++ b/docker/NBI/Dockerfile
@@ -0,0 +1,83 @@
+# This creates osm/NBI docker from local NBI source code
+
+FROM ubuntu:16.04
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
+ python3-pymongo python3-yaml python3-pip python3-keystoneclient \
+ && pip3 install pip==9.0.3 \
+ && pip3 install aiokafka cherrypy==18.0.0 pyangbind keystoneauth1 \
+ && mkdir -p /app/storage/kafka && mkdir -p /app/log
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} NBI IM common" && apt update
+
+ARG NBI_VERSION
+ARG COMMON_VERSION
+ARG IM_VERSION
+
+RUN apt-get update && apt-get -y install python3-osm-nbi${NBI_VERSION} python3-osm-common${COMMON_VERSION} python3-osm-im${IM_VERSION}
+
+# Set the working directory to /app
+WORKDIR /app/osm_nbi
+
+EXPOSE 9999
+
+RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/html_public /app/osm_nbi/html_public
+RUN cp /usr/lib/python3/dist-packages/osm_nbi/nbi.cfg /app/osm_nbi/
+RUN cp -R /usr/lib/python3/dist-packages/osm_nbi/http /app/osm_nbi/
+
+LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
+ Description="This implements a north bound interface for OSM" \
+ Version="1.0" \
+ Author="Alfonso Tierno"
+
+# Used for local storage
+VOLUME /app/storage
+# Used for logs
+VOLUME /app/log
+
+# The following ENV can be added with "docker run -e xxx' to configure
+# server
+ENV OSMNBI_SOCKET_HOST 0.0.0.0
+ENV OSMNBI_SOCKET_PORT 9999
+# storage
+ENV OSMNBI_STORAGE_PATH /app/storage
+# database
+ENV OSMNBI_DATABASE_DRIVER mongo
+ENV OSMNBI_DATABASE_HOST mongo
+ENV OSMNBI_DATABASE_PORT 27017
+# web
+ENV OSMNBI_STATIC_DIR /app/osm_nbi/html_public
+# logs
+ENV OSMNBI_LOG_FILE /app/log
+ENV OSMNBI_LOG_LEVEL DEBUG
+# message
+ENV OSMNBI_MESSAGE_DRIVER kafka
+ENV OSMNBI_MESSAGE_HOST kafka
+ENV OSMNBI_MESSAGE_PORT 9092
+# logs
+ENV OSMNBI_LOG_FILE /app/log/nbi.log
+ENV OSMNBI_LOG_LEVEL DEBUG
+# authentication
+ENV OSMNBI_AUTHENTICATION_BACKEND internal
+#ENV OSMNBI_AUTHENTICATION_BACKEND keystone
+#ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone
+#ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000
+#ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default
+#ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default
+#ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi
+#ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi
+#ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service
+
+HEALTHCHECK --interval=5s --timeout=2s --retries=12 \
+ CMD curl -k https://localhost:9999/osm/ | grep Welcome || exit 1
+
+# Run app.py when the container launches
+CMD ["python3", "/usr/lib/python3/dist-packages/osm_nbi/nbi.py"]
diff --git a/docker/NBI/Makefile b/docker/NBI/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/NBI/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/POL/Dockerfile b/docker/POL/Dockerfile
new file mode 100644
index 0000000..f5ce057
--- /dev/null
+++ b/docker/POL/Dockerfile
@@ -0,0 +1,62 @@
+# Copyright 2018 Whitestack, LLC
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Whitestack, LLC
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: bdiaz@whitestack.com or glavado@whitestack.com
+##
+
+FROM ubuntu:16.04
+
+LABEL authors="Benjamín Díaz"
+
+RUN apt-get --yes update \
+ && apt-get --yes install python3 python3-pip libmysqlclient-dev git \
+ && pip3 install pip==9.0.3
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get --yes update \
+ && apt-get --yes install git python python-pip python3 python3-pip libmysqlclient-dev libssl-dev libffi-dev \
+ && pip3 install pip==9.0.3
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} POL common" && apt update
+
+ARG POL_VERSION
+ARG COMMON_VERSION
+
+RUN apt-get --yes update && apt-get -y install python3-osm-policy-module${POL_VERSION}
+
+ENV OSMPOL_MESSAGE_DRIVER kafka
+ENV OSMPOL_MESSAGE_HOST kafka
+ENV OSMPOL_MESSAGE_PORT 9092
+
+ENV OSMPOL_DATABASE_DRIVER mongo
+ENV OSMPOL_DATABASE_HOST mongo
+ENV OSMPOL_DATABASE_PORT 27017
+
+ENV OSMPOL_SQL_DATABASE_URI sqlite:///mon_sqlite.db
+
+ENV OSMPOL_LOG_LEVEL INFO
+
+CMD osm-policy-agent
diff --git a/docker/POL/Makefile b/docker/POL/Makefile
new file mode 100644
index 0000000..e7833c5
--- /dev/null
+++ b/docker/POL/Makefile
@@ -0,0 +1,4 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
+CONTAINER_NAME=pol
diff --git a/docker/RO/Dockerfile b/docker/RO/Dockerfile
new file mode 100644
index 0000000..0607d91
--- /dev/null
+++ b/docker/RO/Dockerfile
@@ -0,0 +1,52 @@
+from ubuntu:xenial
+
+MAINTAINER Gennadiy Dubina <gennadiy.dubina@dataat.com>; Alfonso Tierno <alfonso.tiernosepulveda@telefoncia.com>
+
+RUN apt-get update && apt-get -y install curl software-properties-common git
+RUN apt-get update && apt-get install -y python-setuptools python-wheel mysql-client python-bitarray
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} RO IM common openvim" && apt update
+
+ARG RO_VERSION
+ARG IM_VERSION
+
+RUN apt-get update && apt-get install -y python-osm-ro${RO_VERSION} python-osm-im${IM_VERSION}
+
+RUN mkdir -p /bin/RO
+
+COPY scripts/ /bin/RO
+
+VOLUME /opt/openmano/logs
+
+EXPOSE 9090
+
+# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers
+# These ENV must be provided
+ENV RO_DB_HOST=""
+ENV RO_DB_OVIM_HOST=""
+ # if empty RO_DB_HOST is assumed
+
+# These ENV should be provided first time for creating database. It will create and init only if empty!
+ENV RO_DB_ROOT_PASSWORD=""
+ENV RO_DB_OVIM_ROOT_PASSWORD=""
+ # if empty RO_DB_ROOT_PASSWORD is assumed
+
+# These ENV can be provided, but default values are ok
+ENV RO_DB_USER=mano
+ENV RO_DB_OVIM_USER=mano
+ENV RO_DB_PASSWORD=manopw
+ENV RO_DB_OVIM_PASSWORD=manopw
+ENV RO_DB_PORT=3306
+ENV RO_DB_OVIM_PORT=3306
+ENV RO_DB_NAME=mano_db
+ENV RO_DB_OVIM_NAME=mano_vim_db
+
+HEALTHCHECK --interval=5s --timeout=2s --retries=12 \
+ CMD curl --silent --fail localhost:9090/openmano/tenants || exit 1
+CMD /bin/RO/start.sh
diff --git a/docker/RO/Makefile b/docker/RO/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/RO/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/RO/scripts/start.sh b/docker/RO/scripts/start.sh
new file mode 100755
index 0000000..1506e3a
--- /dev/null
+++ b/docker/RO/scripts/start.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+
+[ -z "$RO_DB_OVIM_HOST" ] && export RO_DB_OVIM_HOST="$RO_DB_HOST"
+[ -z "$RO_DB_OVIM_ROOT_PASSWORD" ] && export RO_DB_OVIM_ROOT_PASSWORD="$RO_DB_ROOT_PASSWORD"
+
+function is_db_created() {
+ db_host=$1
+ db_port=$2
+ db_user=$3
+ db_pswd=$4
+ db_name=$5
+
+ RESULT=`mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" | grep -v Wildcard | grep -o $db_name`
+ if [ "$RESULT" == "$db_name" ]; then
+
+ RESULT=`mysqlshow -h"$db_host" -P"$db_port" -u"$db_user" -p"$db_pswd" "$db_name" | grep -v Wildcard | grep schema_version`
+ #TODO validate version
+ if [ -n "$RESULT" ]; then
+ echo " DB $db_name exists and inited"
+ return 0
+ else
+ echo " DB $db_name exists BUT not inited"
+ return 1
+ fi
+ fi
+ echo " DB $db_name does not exist"
+ return 1
+}
+
+function configure(){
+ #Database parameters
+ #db_host: localhost
+ #db_user: mano
+ #db_passwd: manopw
+ #db_name: mano_db
+ # Database ovim parameters
+ #db_ovim_host: localhost # by default localhost
+ #db_ovim_user: mano # DB user
+ #db_ovim_passwd: manopw # DB password
+ #db_ovim_name: mano_vim_db # Name of the OVIM MANO DB
+
+
+ sed -i "s/^db_host:.*/db_host: $RO_DB_HOST/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_user:.*/db_user: $RO_DB_USER/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_passwd:.*/db_passwd: $RO_DB_PASSWORD/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_name:.*/db_name: $RO_DB_NAME/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_ovim_host:.*/db_ovim_host: $RO_DB_OVIM_HOST/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_ovim_user:.*/db_ovim_user: $RO_DB_OVIM_USER/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_ovim_passwd:.*/db_ovim_passwd: $RO_DB_OVIM_PASSWORD/" /etc/osm/openmanod.cfg || return 1
+ sed -i "s/^db_ovim_name:.*/db_ovim_name: $RO_DB_OVIM_NAME/" /etc/osm/openmanod.cfg || return 1
+ return 0
+}
+
+max_attempts=120
+function wait_db(){
+ db_host=$1
+ db_port=$2
+ attempt=0
+ echo "Wait until $max_attempts seconds for MySQL mano Server ${db_host}:${db_port} "
+ while ! mysqladmin ping -h"$db_host" -P"$db_port" --silent; do
+ #wait 120 sec
+ if [ $attempt -ge $max_attempts ]; then
+ echo
+ echo "Can not connect to database ${db_host}:${db_port} during $max_attempts sec"
+ return 1
+ fi
+ attempt=$[$attempt+1]
+ echo -n "."
+ sleep 1
+ done
+ return 0
+}
+
+
+echo "1/4 Apply config"
+configure || exit 1
+
+
+echo "2/4 Wait for db up"
+wait_db "$RO_DB_HOST" "$RO_DB_PORT" || exit 1
+[ "$RO_DB_OVIM_HOST" = "$RO_DB_HOST" ] || wait_db "$RO_DB_OVIM_HOST" "$RO_DB_OVIM_PORT" || exit 1
+
+
+echo "3/4 Init database"
+RO_PATH=`python -c 'import osm_ro; print(osm_ro.__path__[0])'`
+echo "RO_PATH: $RO_PATH"
+if ! is_db_created "$RO_DB_HOST" "$RO_DB_PORT" "$RO_DB_USER" "$RO_DB_PASSWORD" "$RO_DB_NAME"
+then
+ if [ -n "$RO_DB_ROOT_PASSWORD" ] ; then
+ mysqladmin -h"$RO_DB_HOST" -uroot -p"$RO_DB_ROOT_PASSWORD" create "$RO_DB_NAME"
+ echo "CREATE USER '${RO_DB_USER}'@'%' IDENTIFIED BY '${RO_DB_PASSWORD}';" |
+ mysql -h"$RO_DB_HOST" -uroot -p"$RO_DB_ROOT_PASSWORD" || echo "user ${RO_DB_USER} already created?"
+ echo "GRANT ALL PRIVILEGES ON ${RO_DB_NAME}.* TO '${RO_DB_USER}'@'%';" |
+ mysql -h"$RO_DB_HOST" -uroot -p"$RO_DB_ROOT_PASSWORD" || echo "user ${RO_DB_USER} already granted?"
+ fi
+ ${RO_PATH}/database_utils/init_mano_db.sh -u "$RO_DB_USER" -p "$RO_DB_PASSWORD" -h "$RO_DB_HOST" \
+ -P "${RO_DB_PORT}" -d "${RO_DB_NAME}" || exit 1
+else
+ echo " migrage database version"
+ ${RO_PATH}/database_utils/migrate_mano_db.sh -u "$RO_DB_USER" -p "$RO_DB_PASSWORD" -h "$RO_DB_HOST" \
+ -P "$RO_DB_PORT" -d "$RO_DB_NAME"
+fi
+
+OVIM_PATH=`python -c 'import lib_osm_openvim; print(lib_osm_openvim.__path__[0])'`
+echo "OVIM_PATH: $OVIM_PATH"
+if ! is_db_created "$RO_DB_OVIM_HOST" "$RO_DB_OVIM_PORT" "$RO_DB_OVIM_USER" "$RO_DB_OVIM_PASSWORD" "$RO_DB_OVIM_NAME"
+then
+ if [ -n "$RO_DB_OVIM_ROOT_PASSWORD" ] ; then
+ mysqladmin -h"$RO_DB_OVIM_HOST" -uroot -p"$RO_DB_OVIM_ROOT_PASSWORD" create "$RO_DB_OVIM_NAME"
+ echo "CREATE USER '${RO_DB_OVIM_USER}'@'%' IDENTIFIED BY '${RO_DB_OVIM_PASSWORD}';" |
+ mysql -h"$RO_DB_OVIM_HOST" -uroot -p"$RO_DB_OVIM_ROOT_PASSWORD" ||
+ echo "user ${RO_DB_OVIM_USER} already created?"
+ echo "GRANT ALL PRIVILEGES ON ${RO_DB_OVIM_NAME}.* TO '${RO_DB_OVIM_USER}'@'%';" |
+ mysql -h"$RO_DB_OVIM_HOST" -uroot -p"$RO_DB_OVIM_ROOT_PASSWORD" ||
+ echo "user ${RO_DB_OVIM_USER} already granted?"
+ fi
+ ${OVIM_PATH}/database_utils/init_vim_db.sh -u "$RO_DB_OVIM_USER" -p "$RO_DB_OVIM_PASSWORD" -h "$RO_DB_OVIM_HOST" \
+ -P "${RO_DB_OVIM_PORT}" -d "${RO_DB_OVIM_NAME}" || exit 1
+else
+ echo " migrage database version"
+ ${OVIM_PATH}/database_utils/migrate_vim_db.sh -u "$RO_DB_OVIM_USER" -p "$RO_DB_OVIM_PASSWORD" -h "$RO_DB_OVIM_HOST"\
+ -P "$RO_DB_OVIM_PORT" -d "$RO_DB_OVIM_NAME"
+fi
+
+
+echo "4/4 Try to start"
+/usr/bin/openmanod -c /etc/osm/openmanod.cfg --log-file=/var/log/osm/openmano.log --create-tenant=osm
diff --git a/docker/light-ui/Dockerfile b/docker/light-ui/Dockerfile
new file mode 100644
index 0000000..5cf9aa7
--- /dev/null
+++ b/docker/light-ui/Dockerfile
@@ -0,0 +1,32 @@
+FROM ubuntu:16.04
+
+WORKDIR /usr/src/app
+
+RUN apt-get update && apt-get install -y npm git python-pip nginx supervisor
+RUN npm install -g bower
+
+ARG LWUI_VERSION=
+RUN git clone https://osm.etsi.org/gerrit/osm/LW-UI /usr/src/app && echo LWUI_VERSION
+
+RUN ln -s /usr/bin/nodejs /usr/bin/node
+RUN bower install --allow-root
+
+RUN pip install -r requirements.txt
+RUN pip install uwsgi
+#
+RUN echo "daemon off;" >> /etc/nginx/nginx.conf
+RUN cp /usr/src/app/nginx-app.conf /etc/nginx/sites-available/default
+RUN cp /usr/src/app/supervisor-app.conf /etc/supervisor/conf.d/
+
+# delete the copy of the database inside the container (if exists)
+RUN rm -f db.sqlite3
+
+ENV DJANGO_ENV=prod
+RUN python manage.py makemigrations authosm
+RUN python manage.py migrate
+RUN python manage.py collectstatic --noinput
+
+
+EXPOSE 80
+
+CMD ["supervisord", "-n"]
diff --git a/docker/light-ui/Makefile b/docker/light-ui/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/light-ui/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/docker/mk/Makefile.include b/docker/mk/Makefile.include
new file mode 100644
index 0000000..fb576e7
--- /dev/null
+++ b/docker/mk/Makefile.include
@@ -0,0 +1,59 @@
+TOPDIR=$(shell readlink -f .|sed -e 's/\/docker\/.*//')
+MKINCLUDE=$(TOPDIR)/docker/mk
+MKBUILD=$(TOPDIR)/docker/build
+
+all: build
+
+TAG ?= latest
+
+REPOSITORY_BASE ?= http://osm-download.etsi.org/repository/osm/debian
+RELEASE ?= ReleaseFOUR-daily
+REPOSITORY_KEY ?= OSM%20ETSI%20Release%20Key.gpg
+REPOSITORY ?= testing
+NO_CACHE ?= --no-cache
+
+LOWER_MDG = $(shell echo $(MDG) | tr '[:upper:]' '[:lower:]')
+
+CONTAINER_NAME ?= $(LOWER_MDG)
+
+CMD_DOCKER_ARGS ?= -q
+DOCKER_ARGS = $(CMD_DOCKER_ARGS)
+
+DEPS := MON IM LCM RO common osmclient devops NBI policy-module Keystone
+
+DEPS_TARGETS = $(addprefix $(MKBUILD)/.dep_, $(DEPS))
+
+Q=@
+
+$(MKBUILD):
+ $Qmkdir -p $(MKBUILD)
+
+$(MKBUILD)/.dep_policy-module:
+ $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m POL -p policy-module > $@
+
+$(MKBUILD)/.dep_%:
+ $Q$(MKINCLUDE)/get_version.sh -r $(REPOSITORY) -R $(RELEASE) -k $(REPOSITORY_KEY) -u $(REPOSITORY_BASE) -m $* > $@
+
+build: $(MKBUILD) $(DEPS_TARGETS)
+ $Qdocker build -t osm/$(LOWER_MDG):$(TAG) \
+ --build-arg RELEASE=$(RELEASE) \
+ --build-arg REPOSITORY=$(REPOSITORY) \
+ --build-arg REPOSITORY_KEY=$(REPOSITORY_KEY) \
+ --build-arg REPOSITORY_BASE=$(REPOSITORY_BASE) \
+ --build-arg MON_VERSION==$(shell cat $(MKBUILD)/.dep_MON) \
+ --build-arg IM_VERSION==$(shell cat $(MKBUILD)/.dep_IM) \
+ --build-arg RO_VERSION==$(shell cat $(MKBUILD)/.dep_RO) \
+ --build-arg LCM_VERSION==$(shell cat $(MKBUILD)/.dep_LCM) \
+ --build-arg COMMON_VERSION==$(shell cat $(MKBUILD)/.dep_common) \
+ --build-arg OSMCLIENT_VERSION==$(shell cat $(MKBUILD)/.dep_osmclient) \
+ --build-arg NBI_VERSION==$(shell cat $(MKBUILD)/.dep_NBI) \
+ --build-arg POL_VERSION==$(shell cat $(MKBUILD)/.dep_policy-module) \
+ --build-arg DEVOPS_VERSION==$(shell cat $(MKBUILD)/.dep_devops) \
+ --build-arg LWUI_VERSION==$(shell date +%s) \
+ $(DOCKER_ARGS) .
+
+clean:
+ rm -f $(MKBUILD)/.dep*
+
+tag:
+ docker tag osm/$(CONTAINER_NAME) osm/$(LOWER_MDG):$(TAG)
diff --git a/docker/mk/dirs.mk b/docker/mk/dirs.mk
new file mode 100644
index 0000000..53846cc
--- /dev/null
+++ b/docker/mk/dirs.mk
@@ -0,0 +1,47 @@
+#
+# Copyright 2017 Sandvine
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+TOPDIR=$(shell readlink -f .|sed -e 's/\/descriptor-packages\/.*//')
+TOOLS_DIR := $(TOPDIR)/tools
+
+SUBDIRS_CLEAN = $(addsuffix .clean, $(SUBDIRS))
+SUBDIRS_TEST = $(addsuffix .test, $(SUBDIRS))
+SUBDIRS_TAG = $(addsuffix .tag, $(SUBDIRS))
+
+.PHONY: $(SUBDIRS) $(SUBDIRS_CLEAN) clean test tag
+
+all: $(SUBDIRS)
+
+clean: $(SUBDIRS_CLEAN)
+
+test: $(SUBDIRS_TEST)
+
+tag: $(SUBDIRS_TAG)
+
+$(SUBDIRS_CLEAN): %.clean:
+ @$(MAKE) --no-print-directory -C $* clean
+
+$(SUBDIRS_TEST): %.test:
+ @$(MAKE) --no-print-directory -C $* test
+
+$(SUBDIRS_TAG): %.tag:
+ @$(MAKE) --no-print-directory -C $* tag
+
+$(SUBDIRS):
+ @$(MAKE) --no-print-directory -C $@
+
+test:
+ $(TOOLS_DIR)/launch_tests.sh
diff --git a/docker/mk/get_version.sh b/docker/mk/get_version.sh
new file mode 100755
index 0000000..7508ac8
--- /dev/null
+++ b/docker/mk/get_version.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+RELEASE="ReleaseFOUR-daily"
+REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
+REPOSITORY="testing"
+REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
+DEBUG=
+
+while getopts ":r:k:u:R:b:-:dm:p:" o; do
+ case "${o}" in
+ r)
+ REPOSITORY=${OPTARG}
+ ;;
+ R)
+ RELEASE=${OPTARG}
+ ;;
+ k)
+ REPOSITORY_KEY=${OPTARG}
+ ;;
+ u)
+ REPOSITORY_BASE=${OPTARG}
+ ;;
+ d)
+ DEBUG=y
+ ;;
+ p)
+ PACKAGE_NAME=${OPTARG}
+ ;;
+ m)
+ MDG=${OPTARG}
+ ;;
+ -)
+ ;;
+ esac
+done
+
+if [ -z "$MDG" ]; then
+ echo "missing MDG"
+fi
+
+[ -z "$PACKAGE_NAME" ] && PACKAGE_NAME=$MDG
+
+if [ -n "$DEBUG" ]; then
+ echo curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages
+fi
+
+curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages 2>/dev/null | awk -v pkg=$PACKAGE_NAME '{
+ if ( /Package:/ && match($2,sprintf("%s$",tolower(pkg)) ) ) {
+ package=1;
+ } else if (package==1 && match($1,"Version:")) {
+ package=0;
+ printf("%s\n", $2);
+ }
+}' | head -1
diff --git a/docker/osmclient/Dockerfile b/docker/osmclient/Dockerfile
new file mode 100644
index 0000000..d544a6e
--- /dev/null
+++ b/docker/osmclient/Dockerfile
@@ -0,0 +1,27 @@
+FROM ubuntu:16.04
+
+LABEL authors="Michael Marchetti"
+
+RUN apt-get update && apt-get -y install curl software-properties-common
+
+RUN apt-get update && apt-get -y install python \
+ libcurl4-gnutls-dev libgnutls-dev iputils-ping python-pip \
+ python-openstackclient wget
+RUN pip install python-magic pytest
+
+ARG REPOSITORY_BASE=http://osm-download.etsi.org/repository/osm/debian
+ARG RELEASE=ReleaseFOUR-daily
+ARG REPOSITORY_KEY=OSM%20ETSI%20Release%20Key.gpg
+ARG REPOSITORY=testing
+
+RUN curl ${REPOSITORY_BASE}/${RELEASE}/${REPOSITORY_KEY} | apt-key add -
+RUN add-apt-repository -y "deb ${REPOSITORY_BASE}/${RELEASE} ${REPOSITORY} devops osmclient" && apt update
+
+ARG OSMCLIENT_VERSION
+ARG DEVOPS_VERSION
+
+RUN apt-get update && apt-get -y install osm-devops${DEVOPS_VERSION} python-osmclient${OSMCLIENT_VERSION}
+
+ENV OSM_SOL005=True
+ENV OSM_HOSTNAME=nbi:9999
+ENV OSM_RO_HOSTNAME=ro:9090
diff --git a/docker/osmclient/Makefile b/docker/osmclient/Makefile
new file mode 100644
index 0000000..d64462a
--- /dev/null
+++ b/docker/osmclient/Makefile
@@ -0,0 +1,3 @@
+include ../mk/Makefile.include
+
+MDG=$(shell basename $(CURDIR))
diff --git a/installers/docker/__keystone-db__.env b/installers/docker/__keystone-db__.env
new file mode 100644
index 0000000..ac2a8d8
--- /dev/null
+++ b/installers/docker/__keystone-db__.env
@@ -0,0 +1 @@
+MYSQL_ROOT_PASSWORD=__MYSQL_ROOT_PASSWORD__
diff --git a/installers/docker/__keystone__.env b/installers/docker/__keystone__.env
new file mode 100644
index 0000000..0b937e4
--- /dev/null
+++ b/installers/docker/__keystone__.env
@@ -0,0 +1,4 @@
+ROOT_DB_PASSWORD=__MYSQL_ROOT_PASSWORD__
+KEYSTONE_DB_PASSWORD=__KEYSTONE_DB_PASSWORD__
+#ADMIN_PASSWORD=__ADMIN_PASSWORD__
+NBI_PASSWORD=__NBI_PASSWORD__
diff --git a/installers/docker/__nbi__.env b/installers/docker/__nbi__.env
new file mode 100644
index 0000000..34671e1
--- /dev/null
+++ b/installers/docker/__nbi__.env
@@ -0,0 +1 @@
+OSMNBI_AUTHENTICATION_SERVICE_PASSWORD=__NBI_PASSWORD__
\ No newline at end of file
diff --git a/installers/docker/docker-compose.yaml b/installers/docker/docker-compose.yaml
index a1e88bc..f4c014e 100644
--- a/installers/docker/docker-compose.yaml
+++ b/installers/docker/docker-compose.yaml
@@ -4,23 +4,30 @@
mongo_db:
mon_db:
osm_packages:
+ keystone_db:
networks:
netOSM:
- external: true
+ external:
+ name: ${OSM_NETWORK:-netosm}
#driver: overlay
#driver_opts:
# com.docker.network.driver.mtu: "1446"
services:
zookeeper:
- image: wurstmeister/zookeeper
+ image: wurstmeister/zookeeper:${ZOOKEEPER_TAG:-latest}
# ports:
# - "2181:2181"
networks:
- netOSM
+ healthcheck:
+ test: echo stat | nc localhost 2181
+ interval: 10s
+ timeout: 10s
+ retries: 3
kafka:
- image: wurstmeister/kafka
+ image: wurstmeister/kafka:${KAFKA_TAG:-latest}
ports:
- - "9092:9092"
+ - "9092"
networks:
- netOSM
environment:
@@ -39,8 +46,28 @@
- netOSM
volumes:
- mongo_db:/data/db
+ keystone-db:
+ image: mariadb:10
+ networks:
+ - netOSM
+ volumes:
+ - keystone_db:/var/lib/mysql
+ env_file:
+ - ./keystone-db.env
+# ports:
+# - "3306:3306"
+ keystone:
+ image: ${DOCKER_USER:-osm}/keystone:${TAG:-latest}
+ networks:
+ - netOSM
+ environment:
+ DB_HOST: keystone-db
+ env_file:
+ - ./keystone.env
+ ports:
+ - "${OSM_KEYSTONE_PORTS:-5000:5000}"
nbi:
- image: osm/nbi
+ image: ${DOCKER_USER:-osm}/nbi:${TAG:-latest}
networks:
- netOSM
volumes:
@@ -48,13 +75,15 @@
environment:
OSMNBI_DATABASE_HOST: mongo
OSMNBI_MESSAGE_HOST: kafka
+ env_file:
+ - ./nbi.env
ports:
- - "9999:9999"
+ - "${OSM_NBI_PORTS:-9999:9999}"
#depends_on:
# - kafka
# - mongo
lcm:
- image: osm/lcm
+ image: ${DOCKER_USER:-osm}/lcm:${TAG:-latest}
networks:
- netOSM
volumes:
@@ -80,7 +109,7 @@
# ports:
# - "3306:3306"
ro:
- image: osm/ro
+ image: ${DOCKER_USER:-osm}/ro:${TAG:-latest}
networks:
- netOSM
environment:
@@ -90,9 +119,9 @@
#depends_on:
# - ro-db
ports:
- - "9090:9090"
+ - "${OSM_RO_PORTS:-9090:9090}"
mon:
- image: osm/mon
+ image: ${DOCKER_USER:-osm}/mon:${TAG:-latest}
networks:
- netOSM
volumes:
@@ -105,9 +134,9 @@
#depends_on:
# - kafka
ports:
- - "8662:8662"
- pm:
- image: osm/pm
+ - "8662"
+ pol:
+ image: ${DOCKER_USER:-osm}/pol:${TAG:-latest}
networks:
- netOSM
environment:
@@ -116,7 +145,7 @@
# - kafka
# - mon
light-ui:
- image: osm/light-ui
+ image: ${DOCKER_USER:-osm}/light-ui:${TAG:-latest}
networks:
- netOSM
environment:
@@ -124,5 +153,4 @@
#depends_on:
# - nbi
ports:
- - "80:80"
-
+ - "${OSM_UI_PORTS:-80:80}"
diff --git a/installers/docker/osm_elk/docker-compose.yml b/installers/docker/osm_elk/docker-compose.yml
index 222a1d0..c74eb67 100644
--- a/installers/docker/osm_elk/docker-compose.yml
+++ b/installers/docker/osm_elk/docker-compose.yml
@@ -37,4 +37,4 @@
networks:
elk:
external:
- name: netOSM
+ name: ${OSM_NETWORK:-netOSM}
diff --git a/installers/docker/osm_metrics/docker-compose.yml b/installers/docker/osm_metrics/docker-compose.yml
index c6832a2..e2ba5c9 100644
--- a/installers/docker/osm_metrics/docker-compose.yml
+++ b/installers/docker/osm_metrics/docker-compose.yml
@@ -1,7 +1,8 @@
version: '3'
networks:
netOSM:
- external: true
+ external:
+ name: ${OSM_NETWORK:-netOSM}
services:
kafka-exporter:
image: osm/kafka-exporter
@@ -32,4 +33,3 @@
- netOSM
depends_on:
- prometheus
-
diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh
index ffd9799..0d2e3ed 100755
--- a/installers/full_install_osm.sh
+++ b/installers/full_install_osm.sh
@@ -26,19 +26,29 @@
echo -e " -b v2.0 (v2.0 branch)"
echo -e " -b tags/v1.1.0 (a specific tag)"
echo -e " ..."
+ echo -e " -s <stack name> user defined stack name, default is osm"
+ echo -e " -H <VCA host> use specific juju host controller IP"
+ echo -e " -S <VCA secret> use VCA/juju secret key"
echo -e " --vimemu: additionally deploy the VIM emulator as a docker container"
echo -e " --elk_stack: additionally deploy an ELK docker stack for event logging"
echo -e " --pm_stack: additionally deploy a Prometheus+Grafana stack for performance monitoring (PM)"
echo -e " -m <MODULE>: install OSM but only rebuild the specified docker images (RO, LCM, NBI, LW-UI, MON, KAFKA, MONGO, NONE)"
echo -e " -o <ADDON>: ONLY (un)installs one of the addons (vimemu, elk_stack, pm_stack)"
echo -e " -D <devops path> use local devops installation path"
+ echo -e " -w <work dir> Location to store runtime installation"
+ echo -e " -t <docker tag> specify osm docker tag (default is latest)"
echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)"
echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)"
+ echo -e " --nojuju: do not juju, assumes already installed"
+ echo -e " --nodockerbuild:do not build docker images (use existing locally cached images)"
+ echo -e " --nohostports: do not expose docker ports to host (useful for creating multiple instances of osm on the same host)"
+ echo -e " --nohostclient: do not install the osmclient"
echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules"
echo -e " --source: install OSM from source code using the latest stable tag"
echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
echo -e " --soui: install classic build of OSM (Rel THREE v3.1, based on LXD containers, with SO and UI)"
echo -e " --lxdimages: (only for Rel THREE with --soui) download lxd images from OSM repository instead of creating them from scratch"
+ echo -e " --pullimages: pull/run osm images from docker.io/opensourcemano"
echo -e " -l <lxd_repo>: (only for Rel THREE with --soui) use specified repository url for lxd images"
echo -e " -p <path>: (only for Rel THREE with --soui) use specified repository path for lxd images"
# echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)"
@@ -72,6 +82,42 @@
return 0
}
+# takes a juju/accounts.yaml file and returns the password specific
+# for a controller. I wrote this using only bash tools to minimize
+# additions of other packages
+function parse_juju_password {
+ password_file="${HOME}/.local/share/juju/accounts.yaml"
+ local controller_name=$1
+ local s='[[:space:]]*' w='[a-zA-Z0-9_-]*' fs=$(echo @|tr @ '\034')
+ sed -ne "s|^\($s\):|\1|" \
+ -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
+ -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $password_file |
+ awk -F$fs -v controller=$controller_name '{
+ indent = length($1)/2;
+ vname[indent] = $2;
+ for (i in vname) {if (i > indent) {delete vname[i]}}
+ if (length($3) > 0) {
+ vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
+ if (match(vn,controller) && match($2,"password")) {
+ printf("%s",$3);
+ }
+ }
+ }'
+}
+
+function remove_volumes() {
+ stack=$1
+ volumes="mongo_db mon_db osm_packages ro_db"
+ for volume in $volumes; do
+ sg docker -c "docker volume rm ${stack}_${volume}"
+ done
+}
+
+function remove_network() {
+ stack=$1
+ sg docker -c "docker network rm net${stack}"
+}
+
function remove_stack() {
stack=$1
if sg docker -c "docker stack ps ${stack}" ; then
@@ -102,36 +148,35 @@
if [ -n "$INSTALL_ELK" ]; then
echo -e "\nUninstalling OSM ELK stack"
remove_stack osm_elk
- sudo rm -rf /etc/osm/docker/osm_elk
+ $WORKDIR_SUDO rm -rf $OSM_DOCKER_WORK_DIR/osm_elk
fi
if [ -n "$INSTALL_PERFMON" ]; then
echo -e "\nUninstalling OSM Performance Monitoring stack"
remove_stack osm_metrics
sg docker -c "docker image rm osm/kafka-exporter"
- sudo rm -rf /etc/osm/docker/osm_metrics
+ $WORKDIR_SUDO rm -rf $OSM_DOCKER_WORK_DIR/osm_metrics
fi
else
echo -e "\nUninstalling OSM"
- remove_stack osm
+ remove_stack $OSM_STACK_NAME
remove_stack osm_elk
remove_stack osm_metrics
echo "Now osm docker images and volumes will be deleted"
newgrp docker << EONG
- docker image rm osm/ro
- docker image rm osm/lcm
- docker image rm osm/light-ui
- docker image rm osm/nbi
- docker image rm osm/mon
- docker image rm osm/pm
- docker image rm osm/kafka-exporter
- docker volume rm osm_mon_db
- docker volume rm osm_mongo_db
- docker volume rm osm_osm_packages
- docker volume rm osm_ro_db
+ docker image rm ${DOCKERUSER}/ro
+ docker image rm ${DOCKERUSER}/lcm
+ docker image rm ${DOCKERUSER}/light-ui
+ docker image rm ${DOCKERUSER}/keystone
+ docker image rm ${DOCKERUSER}/nbi
+ docker image rm ${DOCKERUSER}/mon
+ docker image rm ${DOCKERUSER}/pm
+ docker image rm ${DOCKERUSER}/kafka-exporter
EONG
- echo "Removing /etc/osm and /var/log/osm files"
- sudo rm -rf /etc/osm
- sudo rm -rf /var/log/osm
+ remove_volumes $OSM_STACK_NAME
+ remove_network $OSM_STACK_NAME
+ echo "Removing $OSM_DOCKER_WORK_DIR"
+ $WORKDIR_SUDO rm -rf $OSM_DOCKER_WORK_DIR
+ sg lxd -c "juju destroy-controller --yes $OSM_STACK_NAME"
fi
echo "Some docker images will be kept in case they are used by other docker stacks"
echo "To remove them, just run 'docker image prune' in a terminal"
@@ -488,7 +533,6 @@
CLIENT_RELEASE=${RELEASE#"-R "}
CLIENT_REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
CLIENT_REPOSITORY=${REPOSITORY#"-r "}
- [ -z "$REPOSITORY_BASE" ] && REPOSITORY_BASE="-u https://osm-download.etsi.org/repository/osm/debian"
CLIENT_REPOSITORY_BASE=${REPOSITORY_BASE#"-u "}
key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
curl $key_location | sudo apt-key add -
@@ -579,47 +623,87 @@
echo "Installing juju"
sudo snap install juju --classic
[ -z "$INSTALL_NOLXD" ] && sudo dpkg-reconfigure -p medium lxd
- sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost osm"
- [ $(sg lxd -c "juju status" |grep "osm" |wc -l) -eq 1 ] || FATAL "Juju installation failed"
echo "Finished installation of juju"
+ return 0
+}
+
+function juju_createcontroller() {
+ if ! sg lxd -c "juju show-controller $OSM_STACK_NAME &> /dev/null"; then
+ # Not found created, create the controller
+ sg lxd -c "juju bootstrap --bootstrap-series=xenial localhost $OSM_STACK_NAME"
+ fi
+ [ $(sg lxd -c "juju controllers" | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
}
function generate_docker_images() {
echo "Pulling and generating docker images"
+ _build_from=$COMMIT_ID
+ [ -z "$_build_from" ] && _build_from="master"
+
+ echo "OSM Docker images generated from $_build_from"
+
+ BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
+ BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
+ BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
+ BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
+
if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then
sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
sg docker -c "docker pull wurstmeister/kafka" || FATAL "cannot get kafka docker image"
fi
+
if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MONGO ; then
sg docker -c "docker pull mongo" || FATAL "cannot get mongo docker image"
fi
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}" || FATAL "cannot pull MON docker image"
+ sg docker -c "docker pull ${DOCKER_USER}/pol:${OSM_DOCKER_TAG}" || FATAL "cannot pull POL docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON
git -C ${LWTEMPDIR}/MON checkout ${COMMIT_ID}
sg docker -c "docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t osm/mon --no-cache" || FATAL "cannot build MON docker image"
sg docker -c "docker build ${LWTEMPDIR}/MON/policy_module -f ${LWTEMPDIR}/MON/policy_module/Dockerfile -t osm/pm --no-cache" || FATAL "cannot build PM docker image"
fi
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI ; then
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}" || FATAL "cannot pull NBI docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI ; then
git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI
git -C ${LWTEMPDIR}/NBI checkout ${COMMIT_ID}
sg docker -c "docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi --no-cache" || FATAL "cannot build NBI docker image"
fi
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}" || FATAL "cannot pull RO docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
sg docker -c "docker pull mysql:5" || FATAL "cannot get mysql docker image"
git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
git -C ${LWTEMPDIR}/RO checkout ${COMMIT_ID}
sg docker -c "docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro --no-cache" || FATAL "cannot build RO docker image"
fi
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LCM ; then
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}" || FATAL "cannot pull LCM RO docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LCM ; then
git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LCM
git -C ${LWTEMPDIR}/LCM checkout ${COMMIT_ID}
sg docker -c "docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t osm/lcm --no-cache" || FATAL "cannot build LCM docker image"
fi
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
sg docker -c "docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile --no-cache" || FATAL "cannot build LW-UI docker image"
fi
+
+ if [ -n "$PULL_IMAGES" ]; then
+ sg docker -c "docker pull ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" || FATAL "cannot pull osmclient docker image"
+ elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-osmclient; then
+ sg docker -c "docker build -t osm/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
+ fi
echo "Finished generation of docker images"
}
@@ -628,37 +712,61 @@
file2="$2"
if ! $(cmp "${file1}" "${file2}" >/dev/null 2>&1); then
if [ -f "${file2}" ]; then
- ask_user "The file ${file2} already exists. Overwrite (y/N)? " n && sudo cp -b ${file1} ${file2}
+ ask_user "The file ${file2} already exists. Overwrite (y/N)? " n && cp -b ${file1} ${file2}
else
- sudo cp -b ${file1} ${file2}
+ cp -b ${file1} ${file2}
fi
fi
}
function generate_config_log_folders() {
echo "Generating config and log folders"
- sudo mkdir -p /etc/osm/docker
- sudo cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml /etc/osm/docker/docker-compose.yaml
- sudo mkdir -p /var/log/osm
+ $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
echo "Finished generation of config and log folders"
}
function generate_docker_env_files() {
echo "Generating docker env files"
- echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" |sudo tee /etc/osm/docker/lcm.env
- echo "OSMLCM_VCA_SECRET=${OSMLCM_VCA_SECRET}" |sudo tee -a /etc/osm/docker/lcm.env
+ echo "OSMLCM_VCA_HOST=${OSMLCM_VCA_HOST}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/lcm.env
+ echo "OSMLCM_VCA_SECRET=${OSMLCM_VCA_SECRET}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env
+
MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32`
- if [ ! -f /etc/osm/docker/ro-db.env ]; then
- echo "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee /etc/osm/docker/ro-db.env
+ if [ ! -f $OSM_DOCKER_WORK_DIR/ro-db.env ]; then
+ echo "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/ro-db.env
fi
- if [ ! -f /etc/osm/docker/ro.env ]; then
- echo "RO_DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |sudo tee /etc/osm/docker/ro.env
+ if [ ! -f $OSM_DOCKER_WORK_DIR/ro.env ]; then
+ echo "RO_DB_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/ro.env
fi
- echo "OS_NOTIFIER_URI=http://${DEFAULT_IP}:8662" |sudo tee ${OSM_DEVOPS}/installers/docker/mon.env
- cmp_overwrite ${OSM_DEVOPS}/installers/docker/mon.env /etc/osm/docker/mon.env
+
+ MYSQL_ROOT_PASSWORD=`date +%s | sha256sum | base64 | head -c 32` && sleep 1
+ KEYSTONE_DB_PASSWORD=`date +%s | sha256sum | base64 | head -c 32` && sleep 1
+ #ADMIN_PASSWORD=`date +%s | sha256sum | base64 | head -c 32` && sleep 1
+ NBI_PASSWORD=`date +%s | sha256sum | base64 | head -c 32`
+ if [ ! -f $OSM_DOCKER_WORK_DIR/keystone-db.env ]; then
+ echo "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/keystone-db.env
+ fi
+ if [ ! -f $OSM_DOCKER_WORK_DIR/keystone.env ]; then
+ echo "ROOT_DB_PASSWORD=${MYSQL_ROOT_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/keystone.env
+ echo "KEYSTONE_DB_PASSWORD=${KEYSTONE_DB_PASSWORD}" |$WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/keystone.env
+ #echo "ADMIN_PASSWORD=${ADMIN_PASSWORD}" |$WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/keystone.env
+ echo "NBI_PASSWORD=${NBI_PASSWORD}" |$WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/keystone.env
+ fi
+
+ if [ ! -f $OSM_DOCKER_WORK_DIR/nbi.env ]; then
+ echo "OSMNBI_AUTHENTICATION_SERVICE_PASSWORD=${NBI_PASSWORD}" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/nbi.env
+ fi
+
+ echo "OS_NOTIFIER_URI=http://${DEFAULT_IP}:8662" |$WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/mon.env
+
echo "Finished generation of docker env files"
}
+function generate_osmclient_script () {
+ echo "docker run -ti --network net${OSM_STACK_NAME} osm/osmclient:${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
+ $WORKDIR_SUDO chmod +x "$OSM_DOCKER_WORK_DIR/osm"
+ echo "osmclient sidecar container can be found at: $OSM_DOCKER_WORK_DIR/osm"
+}
+
function init_docker_swarm() {
if [ "${DEFAULT_MTU}" != "1500" ]; then
DOCKER_NETS=`sg docker -c "docker network list" | awk '{print $2}' | egrep -v "^ID$" | paste -d " " -s`
@@ -666,16 +774,45 @@
sg docker -c "docker network create --subnet ${DOCKER_GW_NET} --opt com.docker.network.bridge.name=docker_gwbridge --opt com.docker.network.bridge.enable_icc=false --opt com.docker.network.bridge.enable_ip_masquerade=true --opt com.docker.network.driver.mtu=${DEFAULT_MTU} docker_gwbridge"
fi
sg docker -c "docker swarm init --advertise-addr ${DEFAULT_IP}"
- sg docker -c "docker network create --driver=overlay --attachable --opt com.docker.network.driver.mtu=${DEFAULT_MTU} netOSM"
return 0
}
+function create_docker_network() {
+ echo "creating network"
+ sg docker -c "docker network create --driver=overlay --attachable --opt com.docker.network.driver.mtu=${DEFAULT_MTU} net${OSM_STACK_NAME}"
+ echo "creating network DONE"
+}
+
function deploy_lightweight() {
+
echo "Deploying lightweight build"
- [ -n "$INSTALL_NODOCKER" ] || init_docker_swarm
- remove_stack osm
- sg docker -c "docker stack deploy -c /etc/osm/docker/docker-compose.yaml osm"
- #docker-compose -f /etc/osm/docker/docker-compose.yaml up -d
+ OSM_NBI_PORT=9999
+ OSM_RO_PORT=9090
+ OSM_KEYSTONE_PORT=5000
+ OSM_UI_PORT=80
+
+ if [ -n "$NO_HOST_PORTS" ]; then
+ OSM_PORTS+=(OSM_NBI_PORTS=$OSM_NBI_PORT)
+ OSM_PORTS+=(OSM_RO_PORTS=$OSM_RO_PORT)
+ OSM_PORTS+=(OSM_KEYSTONE_PORTS=$OSM_KEYSTONE_PORT)
+ OSM_PORTS+=(OSM_UI_PORTS=$OSM_UI_PORT)
+ else
+ OSM_PORTS+=(OSM_NBI_PORTS=$OSM_NBI_PORT:$OSM_NBI_PORT)
+ OSM_PORTS+=(OSM_RO_PORTS=$OSM_RO_PORT:$OSM_RO_PORT)
+ OSM_PORTS+=(OSM_KEYSTONE_PORTS=$OSM_KEYSTONE_PORT:$OSM_KEYSTONE_PORT)
+ OSM_PORTS+=(OSM_UI_PORTS=$OSM_UI_PORT:$OSM_UI_PORT)
+ fi
+ echo "export ${OSM_PORTS[@]}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm_ports.sh
+ echo "export OSM_NETWORK=net${OSM_STACK_NAME}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
+ echo "export TAG=${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
+ echo "export DOCKER_USER=${DOCKER_USER}" | $WORKDIR_SUDO tee --append $OSM_DOCKER_WORK_DIR/osm_ports.sh
+
+
+
+ pushd $OSM_DOCKER_WORK_DIR
+ sg docker -c "source ./osm_ports.sh; docker stack deploy -c $OSM_DOCKER_WORK_DIR/docker-compose.yaml $OSM_STACK_NAME"
+ popd
+
echo "Finished deployment of lightweight build"
}
@@ -685,11 +822,11 @@
sg docker -c "docker pull docker.elastic.co/logstash/logstash-oss:6.2.3" || FATAL "cannot get logstash docker image"
sg docker -c "docker pull docker.elastic.co/kibana/kibana-oss:6.2.3" || FATAL "cannot get kibana docker image"
echo "Finished pulling elk docker images"
- sudo mkdir -p /etc/osm/docker/osm_elk
- sudo cp -b ${OSM_DEVOPS}/installers/docker/osm_elk/* /etc/osm/docker/osm_elk
+ $WORKDIR_SUDO mkdir -p "$OSM_DOCKER_WORK_DIR/osm_elk"
+ $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_elk/* $OSM_DOCKER_WORK_DIR/osm_elk
remove_stack osm_elk
echo "Deploying ELK stack"
- sg docker -c "docker stack deploy -c /etc/osm/docker/osm_elk/docker-compose.yml osm_elk"
+ sg docker -c "OSM_NETWORK=net${OSM_STACK_NAME} docker stack deploy -c $OSM_DOCKER_WORK_DIR/osm_elk/docker-compose.yml osm_elk"
echo "Waiting for ELK stack to be up and running"
time=0
step=5
@@ -735,17 +872,20 @@
echo "Generating osm/kafka-exporter docker image"
sg docker -c "docker build ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter -f ${OSM_DEVOPS}/installers/docker/osm_metrics/kafka-exporter/Dockerfile -t osm/kafka-exporter --no-cache" || FATAL "cannot build kafka-exporter docker image"
echo "Finished generation of osm/kafka-exporter docker image"
- sudo mkdir -p /etc/osm/docker/osm_metrics
- sudo cp -b ${OSM_DEVOPS}/installers/docker/osm_metrics/*.yml /etc/osm/docker/osm_metrics
- sudo cp -b ${OSM_DEVOPS}/installers/docker/osm_metrics/*.json /etc/osm/docker/osm_metrics
+ $WORKDIR_SUDO mkdir -p $OSM_DOCKER_WORK_DIR/osm_metrics
+ $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_metrics/*.yml $OSM_DOCKER_WORK_DIR/osm_metrics
+ $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_metrics/*.json $OSM_DOCKER_WORK_DIR/osm_metrics
remove_stack osm_metrics
echo "Deploying PM stack (Kafka exporter + Prometheus + Grafana)"
- sg docker -c "docker stack deploy -c /etc/osm/docker/osm_metrics/docker-compose.yml osm_metrics"
+ sg docker -c "OSM_NETWORK=net${OSM_STACK_NAME} docker stack deploy -c $OSM_DOCKER_WORK_DIR/osm_metrics/docker-compose.yml osm_metrics"
echo "Finished deployment of PM stack"
return 0
}
function install_lightweight() {
+ OSM_DOCKER_WORK_DIR="$OSM_WORK_DIR/stack/$OSM_STACK_NAME"
+ [ ! -d "$OSM_DOCKER_WORK_DIR" ] && $WORKDIR_SUDO mkdir -p $OSM_DOCKER_WORK_DIR
+
[ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges."
[ -z "$ASSUME_YES" ] && ! ask_user "The installation will configure LXD, install juju, install docker CE and init a docker swarm, as pre-requirements. Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1
track proceed
@@ -757,7 +897,9 @@
DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'`
[ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route"
DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
- if [ -z "$INSTALL_NOLXD" ]; then
+
+ # if no host is passed in, we need to install lxd/juju, unless explicilty asked not to
+ if [ -z "$OSMLCM_VCA_HOST" ] && [ -z "$INSTALL_NOLXD" ]; then
need_packages_lw="lxd"
echo -e "Checking required packages: $need_packages_lw"
dpkg -l $need_packages_lw &>/dev/null \
@@ -770,25 +912,38 @@
|| FATAL "failed to install $need_packages_lw"
fi
track prereqok
- install_juju
- OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
- OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'`
- [ -z "$OSMLCM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
- [ -z "$OSMLCM_VCA_SECRET" ] && FATAL "Cannot obtain juju secret"
+ [ -z "$INSTALL_NOJUJU" ] && install_juju
+
+ if [ -z "$OSMLCM_VCA_HOST" ]; then
+ juju_createcontroller
+ OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_STACK_NAME"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
+ [ -z "$OSMLCM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
+ fi
+ if [ -z "$OSMLCM_VCA_SECRET" ]; then
+ OSMLCM_VCA_SECRET=$(parse_juju_password $OSM_STACK_NAME)
+ [ -z "$OSMLCM_VCA_SECRET" ] && FATAL "Cannot obtain juju secret"
+ fi
+
track juju
[ -n "$INSTALL_NODOCKER" ] || install_docker_ce
track docker_ce
#install_docker_compose
- generate_docker_images
+ [ -z "$DOCKER_NOBUILD" ] && generate_docker_images
track docker_build
- generate_config_log_folders
generate_docker_env_files
+ generate_config_log_folders
+
+ [ -n "$INSTALL_NODOCKER" ] || init_docker_swarm
+ # remove old stack
+ remove_stack $OSM_STACK_NAME
+ create_docker_network
deploy_lightweight
+ generate_osmclient_script
track docker_deploy
[ -n "$INSTALL_VIMEMU" ] && install_vimemu && track vimemu
[ -n "$INSTALL_ELK" ] && deploy_elk && track elk
[ -n "$INSTALL_PERFMON" ] && deploy_perfmon && track perfmon
- install_osmclient
+ [ -z "$INSTALL_NOHOSTCLIENT" ] && install_osmclient
track osmclient
wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README2.txt &> /dev/null
track end
@@ -804,19 +959,20 @@
git clone https://osm.etsi.org/gerrit/osm/vim-emu.git $EMUTEMPDIR
# build vim-emu docker
echo "Building vim-emu Docker container..."
- sudo docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile --no-cache $EMUTEMPDIR/ || FATAL "cannot build vim-emu-img docker image"
+
+ sg docker -c "docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile --no-cache $EMUTEMPDIR/" || FATAL "cannot build vim-emu-img docker image"
# start vim-emu container as daemon
echo "Starting vim-emu Docker container 'vim-emu' ..."
if [ -n "$INSTALL_LIGHTWEIGHT" ]; then
# in lightweight mode, the emulator needs to be attached to netOSM
- sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
+ sg docker -c "docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=net${OSM_STACK_NAME} -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py"
else
# classic build mode
- sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
+ sg docker -c "docker run --name vim-emu -t -d --restart always --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py"
fi
echo "Waiting for 'vim-emu' container to start ..."
sleep 5
- export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
+ export VIMEMU_HOSTNAME=$(sg docker -c "docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu")
echo "vim-emu running at ${VIMEMU_HOSTNAME} ..."
# print vim-emu connection info
echo -e "\nYou might be interested in adding the following vim-emu env variables to your .bashrc file:"
@@ -879,8 +1035,8 @@
COMMIT_ID=""
ASSUME_YES=""
INSTALL_FROM_SOURCE=""
-RELEASE="-R ReleaseFOUR"
-REPOSITORY="-r stable"
+RELEASE="ReleaseFOUR"
+REPOSITORY="stable"
INSTALL_VIMEMU=""
INSTALL_FROM_LXDIMAGES=""
LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd"
@@ -892,12 +1048,24 @@
TO_REBUILD=""
INSTALL_NOLXD=""
INSTALL_NODOCKER=""
+INSTALL_NOJUJU=""
NOCONFIGURE=""
RELEASE_DAILY=""
SESSION_ID=`date +%s`
OSM_DEVOPS=
+OSMLCM_VCA_HOST=
+OSMLCM_VCA_SECRET=
+OSM_STACK_NAME=osm
+NO_HOST_PORTS=""
+DOCKER_NOBUILD=""
+REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
+REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
+WORKDIR_SUDO=sudo
+OSM_WORK_DIR="/etc/osm"
+OSM_DOCKER_TAG=latest
+DOCKER_USER=osm
-while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:" o; do
+while getopts ":hy-:b:r:k:u:R:l:p:D:o:m:H:S:s:w:t:" o; do
case "${o}" in
h)
usage && exit 0
@@ -906,16 +1074,20 @@
COMMIT_ID=${OPTARG}
;;
r)
- REPOSITORY="-r ${OPTARG}"
+ REPOSITORY="${OPTARG}"
+ REPO_ARGS+=(-r "$REPOSITORY")
;;
R)
- RELEASE="-R ${OPTARG}"
+ RELEASE="${OPTARG}"
+ REPO_ARGS+=(-R "$RELEASE")
;;
k)
- REPOSITORY_KEY="-k ${OPTARG}"
+ REPOSITORY_KEY="${OPTARG}"
+ REPO_ARGS+=(-k "$REPOSITORY_KEY")
;;
u)
- REPOSITORY_BASE="-u ${OPTARG}"
+ REPOSITORY_BASE="${OPTARG}"
+ REPO_ARGS+=(-u "$REPOSITORY_BASE")
;;
l)
LXD_REPOSITORY_BASE="${OPTARG}"
@@ -926,6 +1098,23 @@
D)
OSM_DEVOPS="${OPTARG}"
;;
+ s)
+ OSM_STACK_NAME="${OPTARG}"
+ ;;
+ H)
+ OSMLCM_VCA_HOST="${OPTARG}"
+ ;;
+ S)
+ OSMLCM_VCA_SECRET="${OPTARG}"
+ ;;
+ w)
+ # when specifying workdir, do not use sudo for access
+ WORKDIR_SUDO=
+ OSM_WORK_DIR="${OPTARG}"
+ ;;
+ t)
+ OSM_DOCKER_TAG="${OPTARG}"
+ ;;
o)
INSTALL_ONLY="y"
[ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue
@@ -963,6 +1152,11 @@
[ "${OPTARG}" == "noconfigure" ] && NOCONFIGURE="y" && continue
[ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
[ "${OPTARG}" == "daily" ] && RELEASE_DAILY="y" && continue
+ [ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue
+ [ "${OPTARG}" == "nojuju" ] && INSTALL_NOJUJU="y" && continue
+ [ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue
+ [ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue
+ [ "${OPTARG}" == "pullimages" ] && DOCKER_USER="opensourcemano" && PULL_IMAGES=true && continue
echo -e "Invalid option: '--$OPTARG'\n" >&2
usage && exit 1
;;
@@ -998,20 +1192,6 @@
# if develop, we force master
[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
-# forcing source from master removed. Now only install from source when explicit
-# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
-
-if [ -z "$OSM_DEVOPS" ]; then
- if [ -n "$TEST_INSTALLER" ]; then
- echo -e "\nUsing local devops repo for OSM installation"
- TEMPDIR="$(dirname $(realpath $(dirname $0)))"
- else
- echo -e "\nCreating temporary dir for OSM installation"
- TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
- trap 'rm -rf "$TEMPDIR"' EXIT
- fi
-fi
-
need_packages="git jq wget curl tar"
echo -e "Checking required packages: $need_packages"
dpkg -l $need_packages &>/dev/null \
@@ -1024,25 +1204,28 @@
|| FATAL "failed to install $need_packages"
if [ -z "$OSM_DEVOPS" ]; then
- if [ -z "$TEST_INSTALLER" ]; then
- echo -e "\nCloning devops repo temporarily"
- git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
- RC_CLONE=$?
- fi
+ if [ -n "$TEST_INSTALLER" ]; then
+ echo -e "\nUsing local devops repo for OSM installation"
+ OSM_DEVOPS="$(dirname $(realpath $(dirname $0)))"
+ else
+ echo -e "\nCreating temporary dir for OSM installation"
+ OSM_DEVOPS="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
+ trap 'rm -rf "$OSM_DEVOPS"' EXIT
- echo -e "\nGuessing the current stable release"
- LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1`
- [ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
- echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
- [ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
+ git clone https://osm.etsi.org/gerrit/osm/devops.git $OSM_DEVOPS
- if [ -n "$RELEASE_DAILY" ]; then
- echo "Using master/HEAD devops"
- git -C $TEMPDIR checkout master
- elif [ -z "$TEST_INSTALLER" ]; then
- git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS
+ if [ -z "$COMMIT_ID" ]; then
+ echo -e "\nGuessing the current stable release"
+ LATEST_STABLE_DEVOPS=`git -C $OSM_DEVOPS tag -l v[0-9].* | sort -V | tail -n1`
+ [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
+
+ echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
+ COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
+ else
+ echo -e "\nDEVOPS Using commit $COMMIT_ID"
+ fi
+ git -C $OSM_DEVOPS checkout $COMMIT_ID
fi
- OSM_DEVOPS=$TEMPDIR
fi
OSM_JENKINS="$OSM_DEVOPS/jenkins"
@@ -1091,14 +1274,14 @@
install_from_lxdimages
else #install from binaries
echo -e "\nCreating the containers and installing from binaries ..."
- $OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed"
+ $OSM_DEVOPS/jenkins/host/install RO ${REPO_ARGS[@]} || FATAL "RO install failed"
ro_is_up && track RO
$OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA install failed"
vca_is_up && track VCA
$OSM_DEVOPS/jenkins/host/install MON || FATAL "MON build failed"
mon_is_up && track MON
- $OSM_DEVOPS/jenkins/host/install SO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "SO install failed"
- $OSM_DEVOPS/jenkins/host/install UI $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "UI install failed"
+ $OSM_DEVOPS/jenkins/host/install SO ${REPO_ARGS[@]} || FATAL "SO install failed"
+ $OSM_DEVOPS/jenkins/host/install UI ${REPO_ARGS[@]} || FATAL "UI install failed"
#so_is_up && track SOUI
track SOUI
fi
diff --git a/installers/install_osm.sh b/installers/install_osm.sh
index 290b519..7cc47e3 100755
--- a/installers/install_osm.sh
+++ b/installers/install_osm.sh
@@ -1,7 +1,7 @@
#!/bin/bash
REPOSITORY_BASE=https://osm-download.etsi.org/repository/osm/debian
-RELEASE=ReleaseFOUR
-REPOSITORY=stable
+RELEASE=ReleaseFIVE
+REPOSITORY=testing
add_repo() {
REPO_CHECK="^$1"
@@ -19,4 +19,4 @@
add_repo "deb [arch=amd64] $REPOSITORY_BASE/$RELEASE $REPOSITORY devops"
sudo DEBIAN_FRONTEND=noninteractive apt-get -q update
sudo DEBIAN_FRONTEND=noninteractive apt-get install osm-devops
-/usr/share/osm-devops/installers/full_install_osm.sh -R $RELEASE -r $REPOSITORY -D /usr/share/osm-devops "$@"
+/usr/share/osm-devops/installers/full_install_osm.sh -R $RELEASE -r $REPOSITORY -D /usr/share/osm-devops --pullimages "$@"
diff --git a/installers/osm_health.sh b/installers/osm_health.sh
new file mode 100755
index 0000000..2be8ce4
--- /dev/null
+++ b/installers/osm_health.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+WAIT_TIME=60
+NUM_SERVICES_WITH_HEALTH=3
+
+while getopts "w:s:n:" o; do
+ case "${o}" in
+ w)
+ WAIT_TIME=${OPTARG}
+ ;;
+ s)
+ STACK_NAME=${OPTARG}
+ ;;
+ n)
+ NUM_SERVICES_WITH_HEALTH=${OPTARG}
+ ;;
+ esac
+done
+
+
+time=0
+step=1
+while [ $time -le "$WAIT_TIME" ]; do
+ if [ "$(docker ps | grep " ${STACK_NAME}_" | grep -i healthy | wc -l)" -ge "$NUM_SERVICES_WITH_HEALTH" ]; then
+ exit 0
+ fi
+
+ sleep $step
+ time=$((time+step))
+done
+
+echo "Not all Docker services are healthy"
+docker ps | grep " ${STACK_NAME}_"
+
+exit 1
diff --git a/jenkins/ci-pipelines/ci_helper.groovy b/jenkins/ci-pipelines/ci_helper.groovy
index 32967f5..1e724ff 100644
--- a/jenkins/ci-pipelines/ci_helper.groovy
+++ b/jenkins/ci-pipelines/ci_helper.groovy
@@ -58,7 +58,7 @@
def start_http_server(repo_dir,server_name) {
sh "docker run -dit --name ${server_name} -v ${repo_dir}:/usr/local/apache2/htdocs/ httpd:2.4"
def http_server_ip = sh(returnStdout:true, script: "docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${server_name}").trim()
- return "-u http://${http_server_ip}/"
+ return "http://${http_server_ip}/"
}
def lxc_get_file(container_name,file,destination) {
diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy
index fd1987d..3c33850 100644
--- a/jenkins/ci-pipelines/ci_stage_3.groovy
+++ b/jenkins/ci-pipelines/ci_stage_3.groovy
@@ -33,11 +33,30 @@
string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'),
+ booleanParam(defaultValue: true, description: '', name: 'SAVE_ARTIFACTS_ON_SMOKE_SUCCESS'),
booleanParam(defaultValue: false, description: '', name: 'DO_STAGE_4'),
+ booleanParam(defaultValue: true, description: '', name: 'DO_BUILD'),
+ booleanParam(defaultValue: true, description: '', name: 'DO_INSTALL'),
+ booleanParam(defaultValue: true, description: '', name: 'DO_SMOKE'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_ARTIFACTS_OVERRIDE'),
])
])
+def uninstall_osm(stackName) {
+ sh """
+ export OSM_USE_LOCAL_DEVOPS=true
+ export PATH=$PATH:/snap/bin
+ installers/full_install_osm.sh -y -w /tmp/osm -t ${stackName} -s ${stackName} --test --nolxd --nodocker --nojuju --nohostports --nohostclient --uninstall
+ """
+}
+
+def run_systest(stackName,tagName,testName) {
+ tempdir = sh(returnStdout: true, script: "mktemp -d").trim()
+ sh "docker run --network net${stackName} -v ${tempdir}:/usr/share/osm-devops/systest/reports osm/osmclient:${tagName} make -C /usr/share/osm-devops/systest ${testName}"
+ sh "cp ${tempdir}/* ."
+ junit '*.xml'
+}
+
node("${params.NODE}") {
sh 'env'
@@ -69,7 +88,7 @@
// grab all stable upstream builds based on the
dir("${RELEASE}") {
- def list = ["SO", "UI", "RO", "openvim", "osmclient", "IM", "devops", "MON", "N2VC", "NBI", "common" ]
+ def list = ["RO", "openvim", "osmclient", "IM", "devops", "MON", "N2VC", "NBI", "common", "LCM"]
for (component in list) {
step ([$class: 'CopyArtifact',
projectName: "${component}${upstream_main_job}/${GERRIT_BRANCH}"])
@@ -103,6 +122,9 @@
// the upstream job name contains suffix with the project. Need this stripped off
def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
+ // Remove the previous artifact for this component. Use the new upstream artifact
+ sh "rm -rf pool/${component}"
+
ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${project_without_branch} :: ${GERRIT_BRANCH}", build_num)
sh "rm -rf dists"
@@ -133,6 +155,7 @@
rm -f changelog/changelog-osm.html
[ ! -d changelog ] || for mdgchange in \$(ls changelog); do cat changelog/\$mdgchange >> changelog/changelog-osm.html; done
"""
+ RELEASE_DIR = sh(returnStdout:true, script: 'pwd').trim()
}
// start an apache server to serve up the images
http_server_name = "${container_name}-apache"
@@ -140,104 +163,134 @@
pwd = sh(returnStdout:true, script: 'pwd').trim()
repo_base_url = ci_helper.start_http_server(pwd,http_server_name)
}
+
+ // now pull the devops package and install in temporary location
+ tempdir = sh(returnStdout: true, script: "mktemp -d").trim()
+ osm_devops_dpkg = sh(returnStdout: true, script: "find . -name osm-devops*.deb").trim()
+ sh "dpkg -x ${osm_devops_dpkg} ${tempdir}"
+ OSM_DEVOPS="${tempdir}/usr/share/osm-devops"
}
- error = null
-
- try {
- stage("Install") {
-
- //will by default always delete containers on complete
- //sh "jenkins/system/delete_old_containers.sh ${container_name_prefix}"
-
- commit_id = ''
- repo_distro = ''
- repo_key_name = ''
- release = ''
-
- if ( params.COMMIT_ID )
- {
- commit_id = "-b ${params.COMMIT_ID}"
+ dir(OSM_DEVOPS) {
+ error = null
+ if ( params.DO_BUILD ) {
+ stage("Build") {
+ sh "make -C docker clean"
+ sh "make -C docker Q= CMD_DOCKER_ARGS= TAG=${container_name} RELEASE=${params.RELEASE} REPOSITORY_BASE=${repo_base_url} REPOSITORY_KEY=${params.REPO_KEY_NAME} REPOSITORY=${params.REPO_DISTRO}"
}
-
- if ( params.REPO_DISTRO )
- {
- repo_distro = "-r ${params.REPO_DISTRO}"
- }
-
- if ( params.REPO_KEY_NAME )
- {
- repo_key_name = "-k ${params.REPO_KEY_NAME}"
- }
-
- if ( params.RELEASE )
- {
- release = "-R ${params.RELEASE}"
- }
-
- sh """
- export OSM_USE_LOCAL_DEVOPS=true
- jenkins/host/start_build system --build-container ${container_name} \
- ${commit_id} \
- ${repo_distro} \
- ${repo_base_url} \
- ${repo_key_name} \
- ${release} \
- ${params.BUILD_FROM_SOURCE}
- """
}
- stage("Smoke") {
- ci_helper.systest_run(container_name, 'smoke')
- junit '*.xml'
- }
+ try {
+ if ( params.DO_INSTALL ) {
+ stage("Install") {
- stage_4_archive = false
- if ( params.DO_STAGE_4 ) {
- stage("stage_4") {
- def downstream_params = [
- string(name: 'CONTAINER_NAME', value: container_name),
- string(name: 'NODE', value: NODE_NAME.split()[0]),
- ]
- stage_4_result = build job: "${params.DOWNSTREAM_STAGE_NAME}/${GERRIT_BRANCH}", parameters: downstream_params, propagate: false
- currentBuild.result = stage_4_result.result
+ //will by default always delete containers on complete
+ //sh "jenkins/system/delete_old_containers.sh ${container_name_prefix}"
- if ( stage_4_result.getResult().equals('SUCCESS') ) {
- stage_4_archive = true;
+ commit_id = ''
+ repo_distro = ''
+ repo_key_name = ''
+ release = ''
+
+ if ( params.COMMIT_ID )
+ {
+ commit_id = "-b ${params.COMMIT_ID}"
+ }
+
+ if ( params.REPO_DISTRO )
+ {
+ repo_distro = "-r ${params.REPO_DISTRO}"
+ }
+
+ if ( params.REPO_KEY_NAME )
+ {
+ repo_key_name = "-k ${params.REPO_KEY_NAME}"
+ }
+
+ if ( params.RELEASE )
+ {
+ release = "-R ${params.RELEASE}"
+ }
+
+ sh """
+ export PATH=$PATH:/snap/bin
+ installers/full_install_osm.sh -y -s ${container_name} --test --nolxd --nodocker --nojuju --nohostports --nohostclient \
+ --nodockerbuild -t ${container_name} \
+ -w /tmp/osm \
+ ${commit_id} \
+ ${repo_distro} \
+ ${repo_base_url} \
+ ${repo_key_name} \
+ ${release} \
+ ${params.BUILD_FROM_SOURCE}
+ """
+ }
+ }
+
+ stage_archive = false
+ if ( params.DO_SMOKE ) {
+ stage("OSM Health") {
+ sh "installers/osm_health.sh -s ${container_name}"
+ }
+ stage("Smoke") {
+ run_systest(container_name,container_name,"smoke")
+ // archive smoke success until stage_4 is ready
+
+ if ( ! currentBuild.result.equals('UNSTABLE') ) {
+ stage_archive = params.SAVE_ARTIFACTS_ON_SMOKE_SUCCESS
+ }
+ }
+ }
+
+ if ( params.DO_STAGE_4 ) {
+ stage("stage_4") {
+ def downstream_params = [
+ string(name: 'CONTAINER_NAME', value: container_name),
+ string(name: 'NODE', value: NODE_NAME.split()[0]),
+ ]
+ stage_4_result = build job: "${params.DOWNSTREAM_STAGE_NAME}/${GERRIT_BRANCH}", parameters: downstream_params, propagate: false
+ currentBuild.result = stage_4_result.result
+
+ if ( stage_4_result.getResult().equals('SUCCESS') ) {
+ stage_archive = true;
+ }
+ }
+ }
+
+ // override to save the artifacts
+ if ( params.SAVE_ARTIFACTS_OVERRIDE || stage_archive ) {
+ stage("Archive") {
+ sh "echo ${container_name} > build_version.txt"
+ archiveArtifacts artifacts: "build_version.txt", fingerprint: true
+
+ // Archive the tested repo
+ dir("${RELEASE_DIR}") {
+ ci_helper.archive(params.ARTIFACTORY_SERVER,RELEASE,GERRIT_BRANCH,'tested')
+ }
}
}
}
+ catch(caughtError) {
+ println("Caught error!")
+ error = caughtError
+ currentBuild.result = 'FAILURE'
+ }
+ finally {
+ sh "docker stop ${http_server_name}"
+ sh "docker rm ${http_server_name}"
- // override to save the artifacts
- if ( params.SAVE_ARTIFACTS_OVERRIDE || stage_4_archive ) {
- stage("Archive") {
- sh "echo ${container_name} > build_version.txt"
- archiveArtifacts artifacts: "build_version.txt", fingerprint: true
-
- // Archive the tested repo
- dir("repo/${RELEASE}") {
- ci_helper.archive(params.ARTIFACTORY_SERVER,RELEASE,GERRIT_BRANCH,'tested')
+ if ( params.DO_INSTALL ) {
+ if (error) {
+ if ( !params.SAVE_CONTAINER_ON_FAIL ) {
+ uninstall_osm container_name
+ }
+ throw error
}
- }
- }
- }
- catch(caughtError) {
- println("Caught error!")
- error = caughtError
- currentBuild.result = 'FAILURE'
- }
- finally {
- sh "docker stop ${http_server_name}"
-
- if (error) {
- if ( !params.SAVE_CONTAINER_ON_FAIL ) {
- sh "lxc delete ${container_name} --force"
- }
- throw error
- }
- else {
- if ( !params.SAVE_CONTAINER_ON_PASS ) {
- sh "lxc delete ${container_name} --force"
+ else {
+ if ( !params.SAVE_CONTAINER_ON_PASS ) {
+ uninstall_osm container_name
+ }
+ }
}
}
}
diff --git a/packer/scripts/get-install-osm.sh b/packer/scripts/get-install-osm.sh
index e04b96a..aefe77a 100755
--- a/packer/scripts/get-install-osm.sh
+++ b/packer/scripts/get-install-osm.sh
@@ -3,9 +3,9 @@
echo "PATH=$PATH"
juju status
-git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
-git clone https://osm.etsi.org/gerrit/osm/devops.git
-eval devops/installers/full_install_osm.sh --nolxd -y "$1"
+wget https://osm-download.etsi.org/ftp/osm-5.0-five/install_osm.sh
+chmod +x install_osm.sh
+./install_osm.sh --nolxd --nodocker --nojuju -y
cat >> ~/.bashrc <<-EOF
export OSM_HOSTNAME=127.0.0.1
diff --git a/packer/scripts/vimemu.sh b/packer/scripts/vimemu.sh
index cd47497..d7313ba 100755
--- a/packer/scripts/vimemu.sh
+++ b/packer/scripts/vimemu.sh
@@ -46,4 +46,4 @@
WantedBy=multi-user.target
EOF
-systemctl enable osm-vimemu-setup.service
+#systemctl enable osm-vimemu-setup.service
diff --git a/systest/Makefile b/systest/Makefile
index 40492aa..b2a66ec 100644
--- a/systest/Makefile
+++ b/systest/Makefile
@@ -26,7 +26,7 @@
OSM_RO_HOSTNAME ?=
OS_AUTH_URL ?=
OS_USERNAME ?=
-OS_PASSWORD_NAME ?=
+OS_PASSWORD ?=
OS_PROJECT_NAME ?=
VIM_CONFIG ?=
VCD_AUTH_URL ?=
@@ -34,6 +34,7 @@
VCD_PASSWORD ?=
VCD_TENANT_NAME ?=
VCD_ORGANIZATION ?=
+VIM_EMU ?=
TOPDIR=$(shell readlink -f .|sed -e 's/systest.*//')
@@ -129,7 +130,7 @@
_run_test: report_dir
-$(Q)py.test \
- --osmhost $(OSM_HOSTNAME) \
+ --osmhost $(OSM_HOSTNAME) --sol005 \
$(OPTION_RO_HOSTNAME) \
$(OPTION_OS_AUTH_URL) \
$(OPTION_OS_USERNAME) \
@@ -169,11 +170,16 @@
OSM_IMAGE_PREFIX ?=
sys_path ?= $(TOPDIR)systest
+ifdef VIM_EMU
+# VIM emulator does not need images pushed to glance.
+else
ifdef OS_AUTH_URL
images/%.qcow2 images/%.img:
$(Q)openstack image show $(OSM_IMAGE_PREFIX)$(shell basename $@) || \
sh -c "make images/cache/$(shell basename $@) && openstack image create --file images/cache/$(shell basename $@) $(OSM_IMAGE_PREFIX)$(shell basename $@)"
endif
+endif
+
ifdef VCD_AUTH_URL
images/%.img:
ovf_converter images/cache/$(OSM_IMAGE_PREFIX)$(shell basename $@) -n cirros
diff --git a/systest/lib/osm/fixtures.py b/systest/lib/osm/fixtures.py
index 2c66ac5..c1becc8 100644
--- a/systest/lib/osm/fixtures.py
+++ b/systest/lib/osm/fixtures.py
@@ -20,6 +20,7 @@
def osm_add_options(parser):
parser.addoption("--osmhost", default="", help="osm hostname")
+ parser.addoption("--sol005",action="store_true", help="enable sol005 API")
parser.addoption("--osm_ro_host", default="", help="osm ro_host")
parser.addoption("--osm-descriptor-packages", default="", help="location of descriptor packages")
parser.addoption("--osm-vnfd-descriptor-packages", default="", help="vnfd packages to test")
@@ -41,6 +42,7 @@
def osm(request):
from lib.osm import osm
osmhost=request.config.getoption("--osmhost")
+ sol005=request.config.getoption("--sol005")
osm_ro_host=request.config.getoption("--osm_ro_host")
descriptors_dir=request.config.getoption("--osm-descriptor-packages")
vnfd_descriptors_list=request.config.getoption("--osm-vnfd-descriptor-packages").split(',')
@@ -48,6 +50,7 @@
ns_name_prefix=request.config.getoption("--osm-ns-name-prefix")
return osm.Osm(osmhost,
ro_host=osm_ro_host,
+ sol005=sol005,
descriptors_dir=descriptors_dir,
vnfd_descriptors_list=vnfd_descriptors_list,
nsd_descriptors_list=nsd_descriptors_list,
diff --git a/systest/lib/osm/osm.py b/systest/lib/osm/osm.py
index f67cf57..35b6144 100644
--- a/systest/lib/osm/osm.py
+++ b/systest/lib/osm/osm.py
@@ -15,11 +15,11 @@
# under the License.
-from osmclient.client import client
+from osmclient import client
class Osm():
- def __init__(self,osmhost,ro_host=None,descriptors_dir=None,vnfd_descriptors_list=None,nsd_descriptors_list=None,ns_name_prefix=None):
- self._OsmApi=client.Client(host=osmhost,ro_host=ro_host)
+ def __init__(self,osmhost,sol005=None,ro_host=None,descriptors_dir=None,vnfd_descriptors_list=None,nsd_descriptors_list=None,ns_name_prefix=None):
+ self._OsmApi=client.Client(host=osmhost,sol005=sol005,ro_host=ro_host)
self._descriptors_dir = descriptors_dir
self.vnfd_descriptors_list = vnfd_descriptors_list
self.nsd_descriptors_list = nsd_descriptors_list
diff --git a/systest/testcases/vim/test_vim.py b/systest/testcases/vim/test_vim.py
index 5193801..a80ae70 100644
--- a/systest/testcases/vim/test_vim.py
+++ b/systest/testcases/vim/test_vim.py
@@ -51,11 +51,10 @@
resp=osm.get_api().vim.get(vim_name)
assert resp['name'] == vim_name
- assert resp['type'] == 'openstack'
+ assert resp['vim_type'] == 'openstack'
assert resp['vim_url'] == os_access['vim-url']
- assert resp['vim_url_admin'] == os_access['vim-url']
- assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
- assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
+ assert resp['vim_user'] == os_access['vim-username']
+ assert resp['vim_tenant_name'] == os_access['vim-tenant-name']
assert not osm.get_api().vim.delete(vim_name)
@pytest.mark.vmware
@@ -73,12 +72,10 @@
resp=osm.get_api().vim.get(vim_name)
assert resp['name'] == vim_name
- assert resp['type'] == 'vmware'
+ assert resp['vim_type'] == 'vmware'
assert resp['vim_url'] == os_access['vim-url']
- assert resp['vim_url_admin'] == os_access['vim-url']
- assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
- assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
-
+ assert resp['vim_user'] == os_access['vim-username']
+ assert resp['vim_tenant_name'] == os_access['vim-tenant-name']
assert not osm.get_api().vim.delete(vim_name)
#@pytest.mark.smoke
@@ -96,11 +93,10 @@
assert not osm.get_api().vim.create(vim['name'],os_access)
resp=osm.get_api().vim.get(vim['name'])
assert resp['name'] == vim['name']
- assert resp['type'] == vim['vim-type']
+ assert resp['vim_type'] == vim['vim-type']
assert resp['vim_url'] == os_access['vim-url']
- assert resp['vim_url_admin'] == os_access['vim-url']
- assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
- assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
+ assert resp['vim_user'] == os_access['vim-username']
+ assert resp['vim_tenant_name'] == os_access['vim-tenant-name']
for vim in osm.get_api().vim.list(False):
osm.get_api().vim.delete(vim['name'])
diff --git a/tools/gen-repo.sh b/tools/gen-repo.sh
index e0d1a66..b332918 100755
--- a/tools/gen-repo.sh
+++ b/tools/gen-repo.sh
@@ -155,4 +155,12 @@
# copy over the changelog file
[ "$CHANGE_LOG_FILE" ] && cp "$CHANGE_LOG_FILE" osm/debian/$RELEASE_DIR
+IM_BASE="osm/debian/$RELEASE_DIR/pool/IM/osm-imdocs_"
+if ls "$IM_BASE"* 1> /dev/null 2>&1; then
+ IM_TMP_DIR=$(mktemp -d)
+ dpkg -x "$IM_BASE"* $IM_TMP_DIR
+ mkdir osm/debian/$RELEASE_DIR/docs
+ cp -R $IM_TMP_DIR/usr/share/osm-im osm/debian/$RELEASE_DIR/docs
+fi
+
rsync -avR $RSYNC_OPTIONS osm/debian/$RELEASE_DIR rsync://$RSYNC_USER_HOST/repos
diff --git a/tools/newtag.sh b/tools/newtag.sh
index 35a2973..62cef0c 100755
--- a/tools/newtag.sh
+++ b/tools/newtag.sh
@@ -12,7 +12,7 @@
tag_header="OSM Release $RELEASE_NAME:"
tag_message="$tag_header version $TAG"
-modules="common devops IM LCM LW-UI MON N2VC NBI openvim osmclient RO vim-emu"
+modules="common devops IM LCM LW-UI MON N2VC NBI openvim osmclient RO vim-emu POL"
list=""
for i in $modules; do
if [ "$1" == "$i" -o "$1" == "all" ]; then