Closed vpestret closed 3 years ago
Here is full Dockerfile attached
FROM ubuntu:18.04
# defaults
RUN \
apt-get update && apt-get install -y \
git \
curl \
wget \
libssl-dev \
libtool \
build-essential \
vim \
autoconf \
automake \
pkg-config \
libgtk-3-dev \
make \
valgrind \
doxygen \
libev-dev \
libpcre2-dev \
unzip \
sudo \
python3 \
bison \
flex \
swig \
libcmocka0 \
libcmocka-dev \
cmake \
inetutils-syslogd \
libzmq3-dev \
supervisor
# Adding netconf user
RUN adduser --system netconf
RUN mkdir -p /home/netconf/.ssh
RUN echo "netconf:1" | chpasswd && adduser netconf sudo
# Clearing and setting authorized ssh keys
RUN \
echo '' > /home/netconf/.ssh/authorized_keys && \
ssh-keygen -A && \
ssh-keygen -t rsa -b 4096 -P '' -f /home/netconf/.ssh/id_rsa && \
cat /home/netconf/.ssh/id_rsa.pub >> /home/netconf/.ssh/authorized_keys
# Updating shell to bash
RUN sed -i s#/home/netconf:/bin/false#/home/netconf:/bin/bash# /etc/passwd
RUN mkdir /opt/dev && sudo chown -R netconf /opt/dev
# set password for user (same as the username)
RUN echo "root:1" | chpasswd
# libssh
RUN \
cd /opt/dev && \
git clone https://git.libssh.org/projects/libssh.git && cd libssh && \
git checkout stable-0.9 && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE="Release" -DWITH_ZLIB=ON -DWITH_NACL=OFF -DWITH_PCAP=OFF .. && \
make -j && \
make install
# libyang
RUN \
cd /opt/dev && \
git clone https://github.com/CESNET/libyang.git && cd libyang && \
git checkout v2.0.7 && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE:String="Debug" .. && \
make -j && \
make install
# sysrepo
RUN \
cd /opt/dev && \
git clone https://github.com/sysrepo/sysrepo.git && cd sysrepo && \
git checkout v2.0.1 && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE:String="Debug" .. && \
make -j && \
make install
# libnetconf2
RUN \
cd /opt/dev && \
git clone https://github.com/CESNET/libnetconf2.git && cd libnetconf2 && \
git checkout v2.0.1 && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE:String="Debug" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_BUILD_TESTS=OFF .. && \
make -j && \
make install
# netopeer 2
RUN \
cd /opt/dev && \
git clone https://github.com/CESNET/Netopeer2.git && cd Netopeer2 && \
git checkout v2.0.0 && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE:String="Debug" .. && \
make -j && \
make install
ENV EDITOR vim
EXPOSE 830
COPY tests/oven.yang /home/netconf
RUN sysrepoctl -i /home/netconf/oven.yang
COPY configs/supervisord-m-plane.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
also supervisor file
[supervisord]
nodaemon=true
logfile=/var/log/supervisord.log
loglevel=debug
[program:syslogd]
command=/usr/sbin/syslogd
autorestart=false
startsecs=0
redirect_stderr=true
priority=3
[program:netopeer2-server]
command=/usr/bin/netopeer2-server -d
autorestart=true
redirect_stderr=true
priority=3
enjoy!
by the way is there a documentation about libyang library architecture?
Okay, the crash should be fixed but note that you should not use subtree filters with elements without a namespace. In all likelihood they inherit some namespace from the RPC, which is not what you want.
is there a documentation about libyang library architecture?
I am not sure libyang has some specific architecture. But the documentation is here.
Thank you very much for looking into this. Thank you for the good advice about namespaces. I've found this documentation already and started to study, in fact, there was a reference from the main page. As much as I can I'm glad to help improving such a great project!
The bugfix provided helped to fix the crash asked but there is another crash appear:
#0 0x000055e5ac61df27 in filter_xpath_buf_append_node (node=0x7f3e58025db0, buf=0x7f3e6b4b4a88, size=1) at /opt/dev/Netopeer2/src/common.c:730
#1 0x000055e5ac61e0d8 in filter_xpath_buf_add_r (node=0x7f3e58025db0, buf=0x7f3e6b4b4a88, size=1, filter=0x7f3e6b4b4b30) at /opt/dev/Netopeer2/src/common.c:761
#2 0x000055e5ac61e368 in op_filter_subtree2xpath (node=0x7f3e58025db0, filter=0x7f3e6b4b4b30) at /opt/dev/Netopeer2/src/common.c:837
#3 0x000055e5ac61f388 in np2srv_rpc_get_cb (session=0x7f3e58002370, UNUSED_sub_id=113, op_path=0x55e5acd51670 "/ietf-netconf:get-config", input=0x7f3e58025bb0, event=SR_EV_RPC, UNUSED_request_id=1,
output=0x7f3e5800ad40, UNUSED_private_data=0x0) at /opt/dev/Netopeer2/src/netconf.c:249
#4 0x00007f3e6d16a7d9 in sr_shmsub_rpc_listen_call_callback (rpc_sub=0x55e5acdcb670, ev_sess=0x7f3e58002370, input_op=0x7f3e58025bb0, event=SR_SUB_EV_RPC, request_id=1, output_op=0x7f3e6b4b4cc0,
err_code=0x7f3e6b4b4c88) at /opt/dev/sysrepo/src/shm_sub.c:2897
#5 0x00007f3e6d16b528 in sr_shmsub_rpc_listen_process_rpc_events (rpc_subs=0x55e5acd4e100, conn=0x55e5acd1fbc0) at /opt/dev/sysrepo/src/shm_sub.c:3182
#6 0x00007f3e6d12ab2f in sr_process_events (subscription=0x55e5aceb82e0, session=0x0, stop_time_in=0x7f3e6b4b4de0) at /opt/dev/sysrepo/src/sysrepo.c:3060
#7 0x00007f3e6d16c47f in sr_shmsub_listen_thread (arg=0x55e5aceb82e0) at /opt/dev/sysrepo/src/shm_sub.c:3575
#8 0x00007f3e6d6d86db in start_thread (arg=0x7f3e6b4b5700) at pthread_create.c:463
#9 0x00007f3e6ce4c71f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Anyway when I've tried to supply correct subtree filter file with namespaces both crashes not happen.
<oven xmlns="urn:sysrepo:oven"/>
You just need to update netopeer2, I have already fixed that, too, just not mentioned it.
When I've checked out Netopeer2 version 91f862f94f60b9bc112f6810e8fe293b18a8d9a5 (VERSION bump to version 2.0.2) and libyang to version 0b8573eb2b9acdab119823c143b47d06af76b1b1 (VERSION bump to version 2.0.8 ) then it worked thanks!!!
Hi, I have Netopeer2 application and when tried filtering I've got crash get-config --source running --filter-subtree=tests/filters/oven.xml
oven.xml file contents:
stack trace:
my Dockerfile fragment: