aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/netconf-pnp-simulator/engine/Dockerfile
diff options
context:
space:
mode:
authorebo <eliezio.oliveira@est.tech>2020-04-03 15:24:15 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-08 08:52:09 +0000
commitf986059d04af9eafe85aafe467e3196e8400098c (patch)
treee42f20f8117d752498ba9d302878172280c98a1c /test/mocks/netconf-pnp-simulator/engine/Dockerfile
parent7a3199bf4a05ffe7148ab7139a73df863a659353 (diff)
netconf-pnp-simulator: convenient TLS and SSH configuration
- Simple SSH and TLS configuration. Instead of specific Netopeer2 XML configuration files, the user only needs to provide: For SSH: id_XXX.pub For TLS: server_key.pem, server_cert.pem, and ca.pem - SSH and TLS can be reconfigured at runtime by running /opt/bin/reconfigure-ssh.sh and /opt/bin/reconfigure-tls.sh respectively - Improved log readability by using zlog (on C applications) and loguru for Python See the updated documentation under ../docs for more information. Issue-ID: INT-1516 Change-Id: I21052d2524f0610c6197875a544113cce1a02787 Signed-off-by: ebo <eliezio.oliveira@est.tech>
Diffstat (limited to 'test/mocks/netconf-pnp-simulator/engine/Dockerfile')
-rw-r--r--test/mocks/netconf-pnp-simulator/engine/Dockerfile35
1 files changed, 29 insertions, 6 deletions
diff --git a/test/mocks/netconf-pnp-simulator/engine/Dockerfile b/test/mocks/netconf-pnp-simulator/engine/Dockerfile
index d4776a4e4..a5d17c5e8 100644
--- a/test/mocks/netconf-pnp-simulator/engine/Dockerfile
+++ b/test/mocks/netconf-pnp-simulator/engine/Dockerfile
@@ -17,8 +17,9 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-FROM python:3.7.6-alpine3.11 as build
+FROM python:3.7.7-alpine3.11 as build
+ARG zlog_version=1.2.14
ARG libyang_version=v1.0-r5
ARG sysrepo_version=v0.7.9
ARG libnetconf2_version=v0.12-r2
@@ -77,6 +78,13 @@ RUN set -eux \
&& make \
&& make install
+# zlog
+RUN set -eux \
+ && git clone --branch $zlog_version --depth 1 https://github.com/HardySimpson/zlog \
+ && cd zlog/src \
+ && make PREFIX=/opt \
+ && make install PREFIX=/opt
+
# sysrepo
COPY patches/sysrepo/ ./patches/sysrepo/
RUN set -eux \
@@ -89,6 +97,7 @@ RUN set -eux \
-DCMAKE_INSTALL_PREFIX:PATH=/opt \
-DGEN_PYTHON_VERSION=3 \
-DPYTHON_MODULE_PATH:PATH=/opt/lib/python3.7/site-packages \
+ -DBUILD_EXAMPLES=0 \
.. \
&& make -j2 \
&& make install
@@ -132,18 +141,21 @@ RUN set -eux \
&& make -j2 \
&& make install
-FROM python:3.7.6-alpine3.11
+FROM python:3.7.7-alpine3.11
LABEL authors="eliezio.oliveira@est.tech"
RUN set -eux \
- && pip install supervisor \
+ && pip install loguru supervisor virtualenv \
&& apk update \
&& apk upgrade -a \
&& apk add \
+ coreutils \
libcurl \
libev \
+ openssl \
pcre \
protobuf-c \
+ xmlstarlet \
# v0.9.3 has somes bugs as warned in libnetconf2/CMakeLists.txt:237
&& apk add --repository http://dl-cdn.alpinelinux.org/alpine/v3.10/main libssh==0.8.8-r0 \
&& rm -rf /var/cache/apk/*
@@ -153,14 +165,19 @@ COPY --from=build /opt/ /opt/
ENV LD_LIBRARY_PATH=/opt/lib:/opt/lib64
ENV PYTHONPATH=/opt/lib/python3.7/site-packages
+COPY patches/supervisor/ /usr/src/patches/supervisor/
+
+RUN set -eux \
+ && cd /usr/local/lib/python3.7/site-packages \
+ && for p in /usr/src/patches/supervisor/*.patch; do patch -p1 -i $p; done
+
COPY config/ /config
VOLUME /config
+COPY templates/ /templates
# finish setup and add netconf user
RUN adduser --system --disabled-password --gecos 'Netconf User' netconf
-ENV HOME=/home/netconf
-VOLUME $HOME/.local/share/virtualenvs
# This is NOT a robust health check but it does help tox-docker to detect when
# it can start the tests.
HEALTHCHECK --interval=1s --start-period=2s --retries=10 CMD test -f /run/netopeer2-server.pid
@@ -170,6 +187,12 @@ EXPOSE 830
COPY supervisord.conf /etc/supervisord.conf
RUN mkdir /etc/supervisord.d
-COPY entrypoint.sh /opt/bin/
+COPY zlog.conf /opt/etc/
+
+# Sensible defaults for loguru configuration
+ENV LOGURU_FORMAT="<green>{time:YYYY-DD-MM HH:mm:ss.SSS}</green> {level: <5} [mynetconf] <lvl>{message}</lvl>"
+ENV LOGURU_COLORIZE=True
+
+COPY entrypoint.sh common.sh configure-*.sh reconfigure-*.sh /opt/bin/
CMD /opt/bin/entrypoint.sh