diff options
author | asteroide <thomas.duval@orange.com> | 2017-04-24 11:37:15 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-04-24 11:37:15 +0200 |
commit | d285ffba7b9e2af55cf7765963764d2acd616a24 (patch) | |
tree | cc9d0daa466ac99e95bed4c8ccf603068bceb6bb /moonv4/moon_orchestrator/moon_orchestrator/security_interface.py | |
parent | d182202fc6001983541504ed323d68479086317e (diff) |
Add the moon_orchestrator element.
Change-Id: I09712c0b6e8e7d17a765829a981280ca5fd8af75
Diffstat (limited to 'moonv4/moon_orchestrator/moon_orchestrator/security_interface.py')
-rw-r--r-- | moonv4/moon_orchestrator/moon_orchestrator/security_interface.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/moonv4/moon_orchestrator/moon_orchestrator/security_interface.py b/moonv4/moon_orchestrator/moon_orchestrator/security_interface.py new file mode 100644 index 00000000..656c4340 --- /dev/null +++ b/moonv4/moon_orchestrator/moon_orchestrator/security_interface.py @@ -0,0 +1,45 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. + +import os +from oslo_config import cfg +from oslo_log import log as logging +from moon_orchestrator.dockers import DockerBase + +LOG = logging.getLogger(__name__) +CONF = cfg.CONF +DOMAIN = "moon_orchestrator" + +__CWD__ = os.path.dirname(os.path.abspath(__file__)) +# TODO (dthom): select the right template folder +TEMPLATES_FOLDER = os.path.join(__CWD__, "..", "conf", "dockers") + + +class SecurityInterface(DockerBase): + + id = "moon_interface" + __build = """RUN mkdir -p /etc/moon/ + COPY conf /etc/moon/ + ADD dist/{py_pkg}.tar.gz /root + WORKDIR /root/{py_pkg} + RUN pip3 install -r requirements.txt + RUN pip3 install . + EXPOSE {port} + """ + + def __init__(self, conf_file="", docker=None, network_config=None): + super(SecurityInterface, self).__init__( + name="moon_interface", + id=self.id, + run_cmd=["python3", "-m", "moon_interface"], + host=CONF.interface.host, + conf_file=conf_file, + docker=docker, + network_config=network_config, + tag=CONF.interface.container, + build_cmd=self.__build, + port=CONF.interface.port + ) + |