Bug fix.
[sim/o1-interface.git] / ntsimulator / deploy / nts-manager / Dockerfile
index bff4bd8..e5362ea 100644 (file)
@@ -2,12 +2,6 @@ FROM ubuntu:18.04 AS builder
 
 LABEL maintainer="alexandru.stancu@highstreet-technologies.com"
 
-ENV NETCONF_BASE=40000
-ENV NTS_IP="127.0.0.1"
-ENV SCRIPTS_DIR=/opt/dev/scripts
-ENV DOCKER_ENGINE_VERSION="1.40"
-ENV MODELS_IMAGE="ntsim_oran"
-
 RUN \
       apt-get update && apt-get install -y \
       # general tools
@@ -43,12 +37,15 @@ RUN \
       echo "netconf:netconf" | chpasswd
 
 # generate ssh keys for netconf user
+USER netconf
 RUN \
       mkdir -p /home/netconf/.ssh && \
       ssh-keygen -A && \
-      ssh-keygen -t dsa -P '' -f /home/netconf/.ssh/id_dsa && \
-      cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys && \
+      ssh-keygen -t rsa -P '' -f /home/netconf/.ssh/id_dsa && \
+      cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys
 #echo "Host *\n    StrictHostKeyChecking accept-new" >> /home/netconf/.ssh/config
+USER root
+RUN \
       echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
       mkdir -p /root/.ssh && \
       cat /home/netconf/.ssh/id_dsa.pub > /root/.ssh/authorized_keys
@@ -99,7 +96,7 @@ RUN \
       git clone https://github.com/Melacon/Netopeer2.git && \
       cd Netopeer2 && \
       cd keystored && mkdir build && cd build && \
-      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DKEYSTORED_KEYS_DIR=/home/netconf/.ssh .. && \
       make -j2 && \
       make install && \
       ldconfig
@@ -133,23 +130,50 @@ LABEL maintainer="alexandru.stancu@highstreet-technologies.com"
 
 ENV NETCONF_BASE=40000
 ENV NTS_IP="127.0.0.1"
+# ENV EXTERNAL_NTS_IP="172.17.0.1" - this can be given in the docker-compose.yml file to
+# overwrite the IP that is exposed via pnfRegistration or via mount HTTP REST; if not specified, NTS_IP will be used
 ENV SCRIPTS_DIR=/opt/dev/scripts
 ENV DOCKER_ENGINE_VERSION="1.40"
 ENV MODELS_IMAGE="ntsim_oran"
+ENV VesHeartbeatPeriod=0
+ENV IsVesAvailable=true
+ENV IsNetconfAvailable=true
+ENV VesRegistration=false
+ENV VesEndpointPort=8080
+ENV VesEndpointIp="172.17.0.1"
+ENV VesEndpointAuthMethod="no-auth"
+ENV VesEndpointUsername="admin"
+ENV VesEndpointPassword="admin"
+ENV SshConnections=1
+ENV TlsConnections=0
+ENV K8S_DEPLOYMENT=false
+ENV CONTAINER_NAME="ntsim"
+ENV ControllerIp="172.17.0.1"
+ENV ControllerPort=8181
+ENV NetconfCallHomePort=6666
+ENV ControllerUsername="admin"
+ENV ControllerPassword="admin"
+ENV NetconfCallHome=false
+ENV Ipv6Enabled=false
 
 RUN \
-      apt-get update && apt-get install -y supervisor
+      apt-get update && apt-get install -y supervisor bc
 
 # add netconf user
 RUN \
       adduser --system netconf && \
       echo "netconf:netconf" | chpasswd
 
+USER netconf
 # generate ssh keys for netconf user
 RUN \
       mkdir -p /home/netconf/.ssh
 
 COPY --from=builder /home/netconf/.ssh /home/netconf/.ssh
+
+USER root
+COPY --from=builder /etc/ssh /etc/ssh
+COPY --from=builder /root/.ssh /root/.ssh
 COPY --from=builder /usr/local/lib /usr/local/lib
 COPY --from=builder /usr/local/bin /usr/local/bin
 COPY --from=builder /usr/local/include /usr/local/include
@@ -195,13 +219,19 @@ COPY --from=builder /lib/x86_64-linux-gnu/libkeyutils.so.1 /lib/x86_64-linux-gnu
 COPY --from=builder /etc/sysrepo /etc/sysrepo
 COPY --from=builder /var/run /var/run
 
-COPY --from=builder /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem
-COPY --from=builder /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem.pub /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem.pub
+#COPY --from=builder /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem
+#COPY --from=builder /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem.pub /usr/local/etc/keystored/keys/ssh_host_rsa_key.pem.pub
 COPY --from=builder /usr/local/share/libnetconf2 /usr/local/share/libnetconf2
 
 RUN ldconfig
 
 COPY ./deploy/nts-manager/supervisord.conf /etc/supervisord.conf
+
+COPY ./deploy/nts-manager/docker_stats.sh /opt/dev/docker_stats.sh
+# Fix for the NETCONF notifications
+RUN \
+    echo "Fixing the NETCONF notifications..." && \
+    mkdir -p /var/run/sysrepo-subscriptions/ietf-crypto-types
          
 ARG BUILD_DATE
 LABEL build-date=$BUILD_DATE