diff --git a/src/telemetry/backend/Dockerfile b/src/telemetry/backend/Dockerfile index 7448f1ebc60015e13499a7a702750c75214494bc..b8d262181f7e6b14c86368b0ab891be824ad3db0 100644 --- a/src/telemetry/backend/Dockerfile +++ b/src/telemetry/backend/Dockerfile @@ -16,9 +16,24 @@ FROM python:3.9-slim # Install dependencies RUN apt-get --yes --quiet --quiet update && \ - apt-get --yes --quiet --quiet install wget g++ git && \ + apt-get --yes --quiet --quiet install wget g++ git build-essential cmake libpcre2-dev python3-dev python3-cffi && \ rm -rf /var/lib/apt/lists/* +# Download, build and install libyang. Note that APT package is outdated +# - Ref: https://github.com/CESNET/libyang +# - Ref: https://github.com/CESNET/libyang-python/ +RUN mkdir -p /var/libyang +RUN git clone https://github.com/CESNET/libyang.git /var/libyang +WORKDIR /var/libyang +RUN git fetch +RUN git checkout v2.1.148 +RUN mkdir -p /var/libyang/build +WORKDIR /var/libyang/build +RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. +RUN make +RUN make install +RUN ldconfig + # Set Python to show logs as they occur ENV PYTHONUNBUFFERED=0 @@ -69,5 +84,18 @@ COPY src/kpi_manager/__init__.py kpi_manager/__init__.py COPY src/telemetry/__init__.py telemetry/__init__.py COPY src/telemetry/backend/. telemetry/backend/ +# Clone OpenConfig YANG models +RUN mkdir -p /tmp/openconfig +RUN git clone https://github.com/openconfig/public.git /tmp/openconfig +WORKDIR /tmp/openconfig +RUN git fetch +RUN git checkout v4.4.0 +RUN rm -rf /var/teraflow/telemetry/backend/collectors/gnmi_openconfig/git +RUN mkdir -p /var/teraflow/telemetry/backend/collectors/gnmi_openconfig/git/openconfig/public +RUN mv /tmp/openconfig/release /var/teraflow/telemetry/backend/collectors/gnmi_openconfig/git/openconfig/public +RUN mv /tmp/openconfig/third_party /var/teraflow/telemetry/backend/collectors/gnmi_openconfig/git/openconfig/public +RUN rm -rf /tmp/openconfig +WORKDIR /var/teraflow + # Start the service ENTRYPOINT ["python", "-m", "telemetry.backend.service"]