I’m very new to python and confd api’s. I want to do some POC to perform certain operations on host device. I’m looking for python package/modules/library, which is similar to confd-api jar, which can be installed into my development system (windows) for code development. Could someone please point to instructions on this.
The Python API can be found under $CONFD_DIR/src/confd/pyapi and the API docs under doc/api/python
Since ConfD doesn’t run under Windows, you need Linux. The easiest way nowadays would be to install Docker on your Windows machine and run ConfD in a Docker container.
Dockerfile for installing ConfD and running the iter_python example:
FROM python:latest
ARG CONFD_VERSION
ENV CONFD_VERSION=${CONFD_VERSION}
ENV DEBIAN_FRONTEND=noninteractive
ENV CONFD_DIR=/confd
ENV PATH=${CONFD_DIR}/bin:$PATH
ENV CONFD=${CONFD_DIR}/bin/confd
ENV LD_LIBRARY_PATH=${CONFD_DIR}/lib
WORKDIR /
RUN pip install --upgrade pip \
&& pip install --no-cache-dir paramiko \
&& apt-get update \
&& apt-get install psmisc libxml2-utils
COPY confd-${CONFD_VERSION}.linux.x86_64.installer.bin /tmp
COPY confd-${CONFD_VERSION}.examples.tar.gz /tmp
RUN ln -s libcrypto.so /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 \
&& /tmp/confd-${CONFD_VERSION}.linux.x86_64.installer.bin ${CONFD_DIR}
# Add the ConfD cryptography integration and C-library API source
ADD confd-${CONFD_VERSION}.libconfd.tar.gz /tmp
# Rebuild the ConfD crypto integration for libcrypto1.1
WORKDIR /tmp/confd-${CONFD_VERSION}/libconfd
RUN make install_crypto
# Cleanup
RUN rm -rf /tmp/* /var/tmp/* \
&& apt-get autoremove -y \
&& apt-get clean
WORKDIR ${CONFD_DIR}/examples.confd/cdb_subscription/iter_python
# Build and create a startup script for one of the ConfD Python examples
RUN make all \
&& echo "#!/bin/bash" > ./run.sh \
&& echo "confd -c confd.conf --addloadpath $CONFD_DIR/etc/confd; python cdbl.py; tail -F confd.log" >> ./run.sh \
&& chmod +x ./run.sh
# Start one of the ConfD Python examples
EXPOSE 4565 2022
CMD [ "./run.sh" ]
I’m successfully able to run python-confd application. But while listening to config changes, iter_func returns keypath as kp=/tag<1711485895>/tag<2105663071> /tag<840214230>,. But I’m expecting path as something like this ‘kp=/system:system/settings/xyz,’
Could you please let me know anything I’m missing.