blob: b96d9181ba38b6cc9176638791f676a6ef9ac150 [file] [log] [blame]
tiernod125caf2018-11-22 16:05:54 +00001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
tiernoa8d63632018-05-10 13:12:32 +020014# This creates osm/NBI docker from local NBI source code
15
Mike Marchettic678d042018-04-18 13:51:27 -040016FROM ubuntu:16.04
17
18# Set the working directory to /app
tierno7bfe2672019-08-30 15:12:47 +000019WORKDIR /app/NBI
Mike Marchettic678d042018-04-18 13:51:27 -040020
tiernoa8d63632018-05-10 13:12:32 +020021RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
Eduardo Sousa819d34c2018-07-31 01:20:02 +010022 python3-pymongo python3-yaml python3-pip python3-keystoneclient \
Mike Marchettic678d042018-04-18 13:51:27 -040023 && pip3 install pip==9.0.3 \
tiernob7e42f02019-09-03 07:24:17 +000024 && pip3 install aiokafka aiohttp cherrypy==18.1.2 keystoneauth1 requests \
Mike Marchettic678d042018-04-18 13:51:27 -040025 && mkdir -p /app/storage/kafka && mkdir -p /app/log
tiernoaae4dc42018-06-11 18:55:50 +020026
27# OSM_COMMON
tierno4c57e2e2018-11-16 22:59:35 +010028RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \
29 && pip3 install -e /app/common
Eduardo Sousa56e698a2018-10-10 17:47:12 +010030# && cd common && python3 setup.py develop && cd ..
tiernoa8d63632018-05-10 13:12:32 +020031# && pip3 install -U -r requirements.txt \
32# && cd ..
33
tiernoaae4dc42018-06-11 18:55:50 +020034# OSM_IM
35RUN pip3 install pyang && mkdir -p /app && cd /app \
tierno4d34ece2018-10-29 10:16:01 +000036 && git -C /app clone https://github.com/robshakir/pyangbind \
37 && pip3 install -e /app/pyangbind \
38 && git -C /app clone https://osm.etsi.org/gerrit/osm/IM \
tierno557f8822019-11-21 16:15:33 +000039 && mkdir -p /app/IM/osm_im \
tierno1bfe4e22019-09-02 16:03:25 +000040 && pyang --plugindir /app/pyangbind/pyangbind/plugin -f pybind -p /app/IM/models/yang \
41 -o /app/IM/osm_im/vnfd.py /app/IM/models/yang/vnfd.yang \
42 && pyang --plugindir /app/pyangbind/pyangbind/plugin -f pybind -p /app/IM/models/yang \
43 -o /app/IM/osm_im/nsd.py /app/IM/models/yang/nsd.yang \
44 && pyang --plugindir /app/pyangbind/pyangbind/plugin -f pybind -p /app/IM/models/yang \
45 -o /app/IM/osm_im/nst.py /app/IM/models/yang/nst.yang \
tierno4d34ece2018-10-29 10:16:01 +000046 && pip3 install -e /app/IM
Mike Marchettic678d042018-04-18 13:51:27 -040047
48EXPOSE 9999
49
50LABEL Maintainer="alfonso.tiernosepulveda@telefonica.com" \
51 Description="This implements a north bound interface for OSM" \
52 Version="1.0" \
53 Author="Alfonso Tierno"
54
55# Used for local storage
56VOLUME /app/storage
57# Used for logs
58VOLUME /app/log
59
60# The following ENV can be added with "docker run -e xxx' to configure
61# server
Eduardo Sousa819d34c2018-07-31 01:20:02 +010062ENV OSMNBI_SOCKET_HOST 0.0.0.0
63ENV OSMNBI_SOCKET_PORT 9999
tierno7bfe2672019-08-30 15:12:47 +000064ENV OSMNBI_SERVER_SSL_CERTIFICATE /app/NBI/osm_nbi/http/cert.pem
65ENV OSMNBI_SERVER_SSL_PRIVATE_KEY /app/NBI/osm_nbi/http/privkey.pem
Mike Marchettic678d042018-04-18 13:51:27 -040066# storage
Eduardo Sousa7e0eb132019-06-21 11:50:21 +010067ENV OSMNBI_STORAGE_DRIVER local
Eduardo Sousa819d34c2018-07-31 01:20:02 +010068ENV OSMNBI_STORAGE_PATH /app/storage
Eduardo Sousa7e0eb132019-06-21 11:50:21 +010069#ENV OSMNBI_STORAGE_DRIVER mongo
70#ENV OSMNBI_STORAGE_URI mongodb://mongo:27017
71#ENV OSMNBI_STORAGE_COLLECTION files
Mike Marchettic678d042018-04-18 13:51:27 -040072# database
Eduardo Sousa819d34c2018-07-31 01:20:02 +010073ENV OSMNBI_DATABASE_DRIVER mongo
74ENV OSMNBI_DATABASE_HOST mongo
75ENV OSMNBI_DATABASE_PORT 27017
tiernod985a8d2018-10-19 14:12:28 +020076# ENV OSMNBI_DATABASE_USER xxx
77# ENV OSMNBI_DATABASE_PASSWORD xxx
tierno92c1c7d2018-11-12 15:22:37 +010078# ENV OSMNBI_DATABASE_COMMONKEY xxx
Mike Marchettic678d042018-04-18 13:51:27 -040079# web
tierno4c57e2e2018-11-16 22:59:35 +010080ENV OSMNBI_STATIC_DIR /app/NBI/osm_nbi/html_public
Mike Marchettic678d042018-04-18 13:51:27 -040081# logs
tierno0c01ffa2018-11-19 14:39:33 +010082# ENV OSMNBI_LOG_FILE /app/log/nbi.log
Eduardo Sousa819d34c2018-07-31 01:20:02 +010083ENV OSMNBI_LOG_LEVEL DEBUG
Mike Marchettic678d042018-04-18 13:51:27 -040084# message
Eduardo Sousa819d34c2018-07-31 01:20:02 +010085ENV OSMNBI_MESSAGE_DRIVER kafka
86ENV OSMNBI_MESSAGE_HOST kafka
87ENV OSMNBI_MESSAGE_PORT 9092
Eduardo Sousa819d34c2018-07-31 01:20:02 +010088# authentication
89ENV OSMNBI_AUTHENTICATION_BACKEND internal
90#ENV OSMNBI_AUTHENTICATION_BACKEND keystone
91#ENV OSMNBI_AUTHENTICATION_AUTH_URL keystone
92#ENV OSMNBI_AUTHENTICATION_AUTH_PORT 5000
93#ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME default
94#ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME default
95#ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME nbi
96#ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD nbi
97#ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT service
Eduardo Sousa29933fc2018-11-14 06:36:35 +000098# RBAC
99ENV OSMNBI_RBAC_RESOURCES_TO_OPERATIONS /app/NBI/osm_nbi/resources_to_operations.yml
100ENV OSMNBI_RBAC_ROLES_TO_OPERATIONS /app/NBI/osm_nbi/roles_to_operations.yml
vijay.r35ef2f72019-04-30 17:55:49 +0530101# prometheus
102ENV OSMNBI_PROMETHEUS_HOST prometheus
103ENV OSMNBI_PROMETHEUS_PORT 9090
Mike Marchettic678d042018-04-18 13:51:27 -0400104
tierno4c57e2e2018-11-16 22:59:35 +0100105# Copy the current directory contents into the container at /app
Felipe Vicens07f31722018-10-29 15:16:44 +0100106ADD . /app/NBI
107
Mike Marchettic678d042018-04-18 13:51:27 -0400108# Run app.py when the container launches
tierno7bfe2672019-08-30 15:12:47 +0000109CMD python3 -m osm_nbi.nbi
110