Fix VIM/WIM validation schemas
[osm/NBI.git] / Dockerfile.local
1 # 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
14 # This creates osm/NBI docker from local NBI source code
15
16 FROM ubuntu:16.04
17
18 # Set the working directory to /app
19 WORKDIR /app/NBI
20
21 RUN apt-get update && apt-get install -y git python3 python3-jsonschema \
22     python3-pymongo python3-yaml python3-pip python3-keystoneclient \
23     && pip3 install pip==9.0.3 \
24     && pip3 install aiokafka aiohttp cherrypy==18.1.2 keystoneauth1 requests \
25     && mkdir -p /app/storage/kafka && mkdir -p /app/log 
26
27 # OSM_COMMON
28 RUN git -C /app clone https://osm.etsi.org/gerrit/osm/common.git \
29     && pip3 install -e /app/common
30 #    && cd common  && python3 setup.py develop && cd ..
31 #    && pip3 install -U -r requirements.txt \
32 #    && cd ..
33
34 # OSM_IM
35 RUN pip3 install pyang && mkdir -p /app && cd /app \
36     && 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 \
39     && mkdir /app/IM/osm_im \
40     && 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 \
46     && pip3 install -e /app/IM
47
48 EXPOSE 9999
49
50 LABEL 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
56 VOLUME /app/storage
57 # Used for logs
58 VOLUME /app/log
59
60 # The following ENV can be added with "docker run -e xxx' to configure
61 # server
62 ENV OSMNBI_SOCKET_HOST                          0.0.0.0
63 ENV OSMNBI_SOCKET_PORT                          9999
64 ENV OSMNBI_SERVER_SSL_CERTIFICATE               /app/NBI/osm_nbi/http/cert.pem
65 ENV OSMNBI_SERVER_SSL_PRIVATE_KEY               /app/NBI/osm_nbi/http/privkey.pem
66 # storage
67 ENV OSMNBI_STORAGE_PATH                         /app/storage
68 # database
69 ENV OSMNBI_DATABASE_DRIVER                      mongo
70 ENV OSMNBI_DATABASE_HOST                        mongo
71 ENV OSMNBI_DATABASE_PORT                        27017
72 # ENV OSMNBI_DATABASE_USER                      xxx
73 # ENV OSMNBI_DATABASE_PASSWORD                  xxx
74 # ENV OSMNBI_DATABASE_COMMONKEY                 xxx
75 # web
76 ENV OSMNBI_STATIC_DIR                           /app/NBI/osm_nbi/html_public
77 # logs
78 # ENV OSMNBI_LOG_FILE                             /app/log/nbi.log
79 ENV OSMNBI_LOG_LEVEL                            DEBUG
80 # message
81 ENV OSMNBI_MESSAGE_DRIVER                       kafka
82 ENV OSMNBI_MESSAGE_HOST                         kafka
83 ENV OSMNBI_MESSAGE_PORT                         9092
84 # authentication
85 ENV OSMNBI_AUTHENTICATION_BACKEND               internal
86 #ENV OSMNBI_AUTHENTICATION_BACKEND               keystone
87 #ENV OSMNBI_AUTHENTICATION_AUTH_URL              keystone
88 #ENV OSMNBI_AUTHENTICATION_AUTH_PORT             5000
89 #ENV OSMNBI_AUTHENTICATION_USER_DOMAIN_NAME      default
90 #ENV OSMNBI_AUTHENTICATION_PROJECT_DOMAIN_NAME   default
91 #ENV OSMNBI_AUTHENTICATION_SERVICE_USERNAME      nbi
92 #ENV OSMNBI_AUTHENTICATION_SERVICE_PASSWORD      nbi
93 #ENV OSMNBI_AUTHENTICATION_SERVICE_PROJECT       service
94 # RBAC
95 ENV OSMNBI_RBAC_RESOURCES_TO_OPERATIONS         /app/NBI/osm_nbi/resources_to_operations.yml
96 ENV OSMNBI_RBAC_ROLES_TO_OPERATIONS             /app/NBI/osm_nbi/roles_to_operations.yml
97 # prometheus
98 ENV OSMNBI_PROMETHEUS_HOST                      prometheus
99 ENV OSMNBI_PROMETHEUS_PORT                      9090
100
101 # Copy the current directory contents into the container at /app
102 ADD . /app/NBI
103
104 # Run app.py when the container launches
105 CMD python3 -m osm_nbi.nbi
106