Commit a8c40070 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Telemetry Backend:

- Add download, build and install of libyang
- Clone OpenConfig data models
parent 013799d6
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -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"]