--- /dev/null
+############################################################################
+# Copyright 2021 ETSI
+#
+# 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.
+############################################################################
+
+# TOX
+.tox/
+
+# Virtualenv
+venv/
+
+# Coverage
+.coverage
+cover
+coverage.xml
+nosetests.xml
+
+# Python
+*.pyc
+*.pyo
+*.eggs/
+*.egg-info/
+
+# logs of openmano
+logs
+
+# pycharm
+.idea
+
+# eclipse
+.project
+.pydevproject
+.settings
+
+# vscode
+.vscode
+
+#local stuff files that end in ".local" or folders called "local"
+vnfs/*.local
+test/*.local
+scenarios/*.local
+instance-scenarios/*.local
+database_utils/*.local
+scripts/*.local
+local
+vnfs/local
+test/local
+scenarios/local
+instance-scenarios/local
+database_utils/local
+scripts/local
+++ /dev/null
-##
-# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U.
-# This file is part of openmano
-# All Rights Reserved.
-#
-# 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 with: nfvlabs@tid.es
-##
-
-# This is a template with common files to be igonored, after clone make a copy to .gitignore
-# cp .gitignore-common .gitignore
-
-.tox/
-venv/
-
-.coverage
-cover
-coverage.xml
-nosetests.xml
-
-*.pyc
-*.pyo
-
-*.eggs/
-*.egg-info/
-
-#auto-ignore
-.gitignore
-
-#logs of openmano
-logs
-
-#pycharm
-.idea
-
-#eclipse
-.project
-.pydevproject
-.settings
-
-#local stuff files that end in ".local" or folders called "local"
-*.local
-vnfs/*.local
-test/*.local
-scenarios/*.local
-instance-scenarios/*.local
-database_utils/*.local
-scripts/*.local
-local
-vnfs/local
-test/local
-scenarios/local
-instance-scenarios/local
-database_utils/local
-scripts/local
-
+++ /dev/null
-##
-# 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.
-##
-
-FROM ubuntu:18.04
-
-LABEL authors="Alfonso Tierno"
-
-RUN apt-get update && apt-get install -y git python3 python3-pip \
- && python3 -m pip install --upgrade pip \
- && DEBIAN_FRONTEND=noninteractive apt-get -y install libssl-dev libmysqlclient-dev mysql-client \
- build-essential libffi-dev cargo \
- && DEBIAN_FRONTEND=noninteractive python3 -m pip install -U networking-l2gw \
- && DEBIAN_FRONTEND=noninteractive python3 -m pip install -U progressbar pyvmomi pyvcloud==19.1.1 \
- && DEBIAN_FRONTEND=noninteractive apt-get -y install genisoimage
-
-# This is not needed, because package dependency will install anyway.
-# But done here in order to harry up image generation using cache
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python3-neutronclient python3-openstackclient \
- python3-requests python3-netaddr python3-argcomplete curl \
- && DEBIAN_FRONTEND=noninteractive curl -Lo /tmp/libzenohc.so https://github.com/eclipse-fog05/fog05/releases/download/v0.1.0/libzenohc.so \
- && mv /tmp/libzenohc.so /usr/local/lib/libzenohc.so \
- && DEBIAN_FRONTEND=noninteractive python3 -m pip install -U jsonrpclib-pelix cvprac "azure==4.0.0" boto \
- pyone "oca @ git+https://github.com/python-oca/python-oca#egg=oca" \
- pyangbind sphinx zenoh==0.3.0 yaks==0.3.0.post1 fog05-sdk==0.2.0 fog05==0.2.0 "cryptography>=2.5"
-
-
-# DEBIAN_FRONTEND=noninteractive apt-get -y install python-openstacksdk python-openstackclient && \
-# TODO py3 DEBIAN_FRONTEND=noninteractive add-apt-repository -y cloud-archive:rocky && apt-get update && apt-get install -y python3-networking-l2gw \
-
-# DEBIAN_FRONTEND=noninteractive apt-get -y install python-cffi libssl-dev libffi-dev python-mysqldb && \
-# && DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \
-# DEBIAN_FRONTEND=noninteractive apt-get -y install wget tox && \
-
-COPY . /root/RO
-
-RUN python3 -m pip install -e /root/RO/RO-plugin && \
- python3 -m pip install -e /root/RO/NG-RO && \
- python3 -m pip install -e /root/RO/RO-VIM-vmware && \
- python3 -m pip install -e /root/RO/RO-VIM-openstack && \
- python3 -m pip install -e /root/RO/RO-VIM-openvim && \
- python3 -m pip install -e /root/RO/RO-VIM-aws && \
- python3 -m pip install -e /root/RO/RO-VIM-azure && \
- python3 -m pip install -e /root/RO/RO-VIM-fos && \
- python3 -m pip install -e /root/RO/RO-SDN-dynpac && \
- python3 -m pip install -e /root/RO/RO-SDN-ietfl2vpn && \
- python3 -m pip install -e /root/RO/RO-SDN-onos_vpls && \
- python3 -m pip install -e /root/RO/RO-SDN-onos_openflow && \
- python3 -m pip install -e /root/RO/RO-SDN-odl_openflow && \
- python3 -m pip install -e /root/RO/RO-SDN-floodlight_openflow && \
- python3 -m pip install -e /root/RO/RO-SDN-arista_cloudvision && \
- python3 -m pip install -e /root/RO/RO-SDN-juniper_contrail && \
- rm -rf /root/.cache && \
- apt-get clean && \
- rm -rf /var/lib/apt/lists/*
-
-EXPOSE 9090
-
-ENV OSMRO_NG True
-
-# database
-ENV OSMRO_DATABASE_DRIVER mongo
-ENV OSMRO_DATABASE_URI mongodb://mongo:27017
-# ENV OSMRO_DATABASE_COMMONKEY xxx
-# ENV OSMRO_DATABASE_USER xxx
-# ENV OSMRO_DATABASE_PASSWORD xxx
-
-# message
-ENV OSMRO_MESSAGE_DRIVER kafka
-ENV OSMRO_MESSAGE_HOST kafka
-ENV OSMRO_MESSAGE_PORT 9092
-
-# logs
-ENV OSMRO_LOG_LEVEL DEBUG
-
-CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]
-
-# HEALTHCHECK --start-period=30s --interval=10s --timeout=5s --retries=12 \
-# CMD curl --silent --fail http://localhost:9090/ro || exit 1
-
--- /dev/null
+############################################################################
+# Copyright 2021 ETSI
+#
+# 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.
+############################################################################
+
+FROM ubuntu:18.04 as INSTALL
+
+WORKDIR /build
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
+ DEBIAN_FRONTEND=noninteractive apt-get --yes install \
+ gcc python3 python3-dev python3-venv python3-pip \
+ python3-setuptools curl git genisoimage netbase && \
+ python3 -m pip install -U pip build
+
+COPY . /build
+
+RUN git clone https://osm.etsi.org/gerrit/osm/common.git
+
+RUN python3 -m pip install -r requirements.txt \
+ -r common/requirements.txt
+
+RUN python3 -m build /build/common && \
+ python3 -m pip install /build/common/dist/*.whl
+
+RUN python3 -m build /build/RO-plugin && \
+ python3 -m pip install /build/RO-plugin/dist/*.whl
+
+RUN python3 -m build /build/NG-RO && \
+ python3 -m pip install /build/NG-RO/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-vmware && \
+ python3 -m pip install /build/RO-VIM-vmware/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-openstack && \
+ python3 -m pip install /build/RO-VIM-openstack/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-openvim && \
+ python3 -m pip install /build/RO-VIM-openvim/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-aws && \
+ python3 -m pip install /build/RO-VIM-aws/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-azure && \
+ python3 -m pip install /build/RO-VIM-azure/dist/*.whl
+
+RUN python3 -m build /build/RO-VIM-fos && \
+ python3 -m pip install /build/RO-VIM-fos/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-dynpac && \
+ python3 -m pip install /build/RO-SDN-dynpac/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-ietfl2vpn && \
+ python3 -m pip install /build/RO-SDN-ietfl2vpn/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-onos_vpls && \
+ python3 -m pip install /build/RO-SDN-onos_vpls/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-onos_openflow && \
+ python3 -m pip install /build/RO-SDN-onos_openflow/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-odl_openflow && \
+ python3 -m pip install /build/RO-SDN-odl_openflow/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-floodlight_openflow && \
+ python3 -m pip install /build/RO-SDN-floodlight_openflow/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-arista_cloudvision && \
+ python3 -m pip install /build/RO-SDN-arista_cloudvision/dist/*.whl
+
+RUN python3 -m build /build/RO-SDN-juniper_contrail && \
+ python3 -m pip install /build/RO-SDN-juniper_contrail/dist/*.whl
+
+FROM ubuntu:18.04
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get --yes update && \
+ DEBIAN_FRONTEND=noninteractive apt-get --yes install python3-minimal
+
+COPY --from=INSTALL /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
+COPY --from=INSTALL /usr/local/lib/python3.6/dist-packages /usr/local/lib/python3.6/dist-packages
+COPY --from=INSTALL /usr/bin/genisoimage /usr/bin/genisoimage
+COPY --from=INSTALL /etc/protocols /etc/protocols
+
+VOLUME /var/log/osm
+
+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
+ENV OPENMANO_TENANT=osm
+
+# database
+ENV OSMRO_DATABASE_DRIVER mongo
+ENV OSMRO_DATABASE_URI mongodb://mongo:27017
+# ENV OSMRO_DATABASE_COMMONKEY xxx
+# ENV OSMRO_DATABASE_USER xxx
+# ENV OSMRO_DATABASE_PASSWORD xxx
+
+# message
+ENV OSMRO_MESSAGE_DRIVER kafka
+ENV OSMRO_MESSAGE_HOST kafka
+ENV OSMRO_MESSAGE_PORT 9092
+
+# logs
+ENV OSMRO_LOG_LEVEL INFO
+
+CMD ["python3", "-u", "-m", "osm_ng_ro.ro_main"]