CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

Configuration Modification Not Successful #1587

Closed Lllyh69 closed 1 week ago

Lllyh69 commented 2 weeks ago

Hi, I encountered an issue when attempting to modify the configuration. Initially, I initialized a part of the "ieee802-dot1q-bridge" model as follows:

> get-config --source running --filter-xpath //ieee802-dot1q-bridge:*
DATA
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <bridges xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge">
    <bridge>
      <name>br1</name>
      <address>d6-ad-62-c5-49-ae</address>
      <bridge-type>provider-edge-bridge</bridge-type>
    </bridge>
  </bridges>
</data>

However, when I tried to use edit-config to modify the "address" to "d7-ad-62-c5-49-ae", I encountered some issues:

> edit-config --target running --config=ietf-mac-cfg.xml
OK
> 
notification (2024-06-13T11:00:48.643094137+08:00)
<netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications">
  <changed-by>
    <username>root</username>
    <session-id>0</session-id>
  </changed-by>
  <datastore>running</datastore>
  <edit>
    <target xmlns:dot1q="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge">/dot1q:bridges/dot1q:bridge[dot1q:name='br1']/dot1q:address</target>
    <operation>replace</operation>
  </edit>
</netconf-config-change>

Server Logs:

[INF]: SR: EV ORIGIN: "/ietf-netconf:edit-config" "rpc" ID 9 priority 0 for 1 subscribers published.
[INF]: SR: EV LISTEN: "/ietf-netconf:edit-config" "rpc" ID 9 priority 0 processing (remaining 1 subscribers).
[INF]: NP: edit-config error-option "stop-on-error" not supported, rollback-on-error will be performed.
[INF]: SR: EV ORIGIN: "ieee802-dot1q-bridge" "change" ID 2 priority 0 for 1 subscribers published.
[INF]: SR: EV ORIGIN: "ieee802-dot1q-bridge" "change" ID 2 priority 0 succeeded.
[INF]: SR: EV ORIGIN: "ieee802-dot1q-bridge" "done" ID 2 priority 0 for 1 subscribers published.
[INF]: SR: EV ORIGIN: "ieee802-dot1q-bridge" "done" ID 2 priority 0 succeeded.
[INF]: SR: EV ORIGIN: "ietf-netconf-notifications" "notif" ID 7 priority 0 for 1 subscribers published.
[INF]: SR: EV LISTEN: "/ietf-netconf:edit-config" "rpc" ID 9 priority 0 success (remaining 0 subscribers).
[INF]: SR: EV LISTEN: "ietf-netconf-notifications" "notif" ID 7 processing.
[INF]: SR: EV LISTEN: "ietf-netconf-notifications" "notif" ID 7 priority 0 success (remaining 0 subscribers).
[INF]: SR: EV ORIGIN: "/ietf-netconf:edit-config" "rpc" ID 9 priority 0 succeeded.
[INF]: NP: Session 2: thread 1 event new RPC.

Listener Output:

 ========== EVENT change CHANGES: ====================================

MODIFIED: /ieee802-dot1q-bridge:bridges/bridge[name='br1']/address = d6-ad-62-c5-49-ae
to /ieee802-dot1q-bridge:bridges/bridge[name='br1']/address = d7-ad-62-c5-49-ae

 ========== END OF CHANGES =======================================

 ========== EVENT done CHANGES: ====================================

MODIFIED: /ieee802-dot1q-bridge:bridges/bridge[name='br1']/address = d6-ad-62-c5-49-ae
to /ieee802-dot1q-bridge:bridges/bridge[name='br1']/address = d7-ad-62-c5-49-ae

 ========== END OF CHANGES =======================================

 ========== CONFIG HAS CHANGED, CURRENT RUNNING CONFIG: ==========

/ieee802-dot1q-bridge:bridges (container)
/ieee802-dot1q-bridge:bridges/bridge[name='br1'] (list instance)
/ieee802-dot1q-bridge:bridges/bridge[name='br1']/name = br1
/ieee802-dot1q-bridge:bridges/bridge[name='br1']/address = d6-ad-62-c5-49-ae
/ieee802-dot1q-bridge:bridges/bridge[name='br1']/bridge-type = ieee802-dot1q-bridge:provider-edge-bridge

I find that the configuration changes did not succeed, but there is no indication of what went wrong. Please help me.

Thanks!!

satomhxl commented 2 weeks ago

I update netopeer2 to the latest release these days, and I encountered the same problem,

michalvasko commented 2 weeks ago

You are right that the value in the output is the old one for some reason but everything else looks fine, quite strange. Can you actually check the value, using sysrepocfg -X, for example?

Lllyh69 commented 2 weeks ago

It is my xml:ietf-mac-cfg.xml

<bridges xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"
    xmlns:brtc="urn:nxp:dn:storage:yang:nxp-bridge-vlan-tc-flower"
    xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <bridge>
        <name>br1</name>
        <bridge-type>provider-edge-bridge</bridge-type>
        <address nc:operation="replace">d7-ad-62-c5-49-ae</address>
    </bridge>
</bridges>

If I use: sysrepocfg -d running -m ieee802-dot1q-bridge -X

I still get the old output:d6-ad-62-c5-49-ae

<bridges xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge">
  <bridge>
    <name>br1</name>
    <address>d6-ad-62-c5-49-ae</address>
    <bridge-type>provider-edge-bridge</bridge-type>
  </bridge>
</bridges>

However, I was able to modify the value of l in the examples.yang with some operations。I also think it is quite strange!

michalvasko commented 2 weeks ago

This must be some incompatibility on your end, mixed sysrepo installations or something similar, it does not make sense.

satomhxl commented 2 weeks ago

Is there any method to debug this issue? I think I've uninstall the old version of sysrepo, by executing make uninstall and make clean. And whereis sysrepocfg and whereis sysrepoctl only output one path. sysrepocfg -V is "sysrepocfg - sysrepo configuration manipulation tool, compiled with libsysrepo v2.2.170 (SO v7.24.11)"

Now I can successfully change the sysrepo running datastore by

sysrepocfg --edit=something.xml

But I can't change the sysrepo running datastore by the command below in netopeer2-cli

edit-config --target running --config=something.xml
Lllyh69 commented 2 weeks ago

I can also change the sysrepo running datastore by:

sysrepocfg --edit=$FILE -d running -f xml -m ieee802-dot1q-bridge -v2

But I can't change the sysrepo running datastore by:edit-config

michalvasko commented 2 weeks ago

I am sorry but I am not able to help, I have never seen such an issue and since it occurred after updating, it must be caused by the old version, somehow.

Lllyh69 commented 2 weeks ago

But I haven't downloaded the old version, I've been using the latest version since the beginning. This question is so confusing to me.

michalvasko commented 2 weeks ago

The only explanation is that netopeer2-server is linked with a different sysrepo than sysrepocfg, I cannot help with that. But if you are certain your setup is correct, try using a fresh VM and install everything from scratch. If it does not work this way, post your exact installation steps so that I can reproduce it.

satomhxl commented 2 weeks ago

Hello, this is my steps to reproduce the problem. My host machine: ubuntu 22.04.

Prepare these files: O-RAN.WG4.MP-YANGs-R003-v14.00.zip test_files.zip

# on host machine, create and run docker container
docker pull ubuntu:latest
docker run -it --name new_netopeer2 ubuntu:latest /bin/bash

# copy prepared files from host to docker container
docker cp O-RAN.WG4.MP-YANGs-R003-v14.00.zip test_files.zip <container-id>:/root

# In docker container, install needed softwares
apt update
apt upgrade
apt install -y vim cmake libssh-dev wget unzip libpcre2-dev curl libcurl4-openssl-dev build-essential pkg-config

# install latest netopeer2 release
cd /opt
wget https://github.com/CESNET/libyang/archive/refs/tags/v2.2.8.zip -O libyang-2.2.8.zip
unzip libyang-2.2.8.zip
cd libyang-2.2.8/
mkdir build
cd build
cmake ../
make
make install
cd ../..

wget https://github.com/CESNET/libnetconf2/archive/refs/tags/v3.0.17.zip -O libnetconf2-3.0.17.zip
unzip libnetconf2-3.0.17.zip
cd libnetconf2-3.0.17/
mkdir build
cd build
cmake ../
make
make install
cd ../..

wget https://github.com/sysrepo/sysrepo/archive/refs/tags/v2.2.170.zip -O sysrepo-2.2.170.zip
unzip sysrepo-2.2.170.zip
cd sysrepo-2.2.170/
mkdir build
cd build
cmake ../
make
make install
cd ../..
ldconfig
sysrepoctl -l

wget https://github.com/CESNET/netopeer2/archive/refs/tags/v2.2.19.zip -O netopeer2-2.2.19.zip
unzip netopeer2-2.2.19.zip
cd netopeer2-2.2.19/
mkdir build
cd build
cmake ../
make
make install
cd ../..

# in docker container, install o-ran yangs and prepare test user and nacm.
cd /root
unzip O-RAN.WG4.MP-YANGs-R003-v14.00.zip -d O-RAN.WG4.MP-YANGs-R003-v14.00
unzip test_files.zip
adduser testuser
bash test_deploy.sh

# now you can run netopeer2-server and try to edit the o-ran-sync.yang from netopeer2-cli
netopeer2-server
netopeer2-cli
> connect --host 127.0.0.1 --login testuser
> get --filter-xpath /o-ran-sync:*
# the configuration below should be added to sysrepo successfully
> edit-config --target running --config=sync_ptp_cfg_24.xml
> get --filter-xpath /o-ran-sync:*
# the configuration below can not be applied to sysrepo
> edit-config --target running --config=sync_ptp_cfg_25.xml
> get --filter-xpath /o-ran-sync:*
Lllyh69 commented 2 weeks ago

I have reinstalled netoppeer2 with a new VM as you suggested, and I still have the problem of not being able to modify the configuration data. Here are my steps to install netoppeer2: I used Ubuntu22.04 LTS Download the latest versions of netopeer2, libyang, sysrepo, libnetconf2. Compile libyang --> libnetconf2 --> sysrepo.

unzip  netopeer2.zip
unzip  libyang.zip
unzip  sysrepo.zip
unzip  libnetconf2.zip

cd  libyang
Mkdir build
cd  build
Cmake ..
make
sudo make install
cd

cd  libnetconf2
Mkdir build
cd  build
Cmake ..
make
sudo make install
cd

cd  sysrepo
Mkdir build
cd  build
Cmake ..
make
sudo make install
cd

After compiling, add the lib library to the system lib.

sudo ln -s /usr/local/lib/libsysrepo.so.7 /lib/
sudo ln -s /usr/local/lib/libnetconf2.so.4 /lib/
sudo ln -s /usr/local/lib/libyang.so.3 /lib/

Finally, compile netopeer2.

cd  netopeer2
Mkdir build
cd  build
Cmake ..
make
sudo make install

The only problem is that incmake.. During the process, occurred Not Found Uncrusity, but still successfully compiled. After compiling netoppeer2 can also implementnetopeer2_test, everything is fine. Then I installed ieee802-dot1q-bridge and other yang models, shut down the NACM service, and the above problems occurred.

michalvasko commented 2 weeks ago

Sorry, I forgot to ask you to try using the current devel branches instead of master, there were some issues in this release (although I do not think as severe as this) that should be fixed now.

Lllyh69 commented 2 weeks ago

Do netopeer2, libyang, libnetconf2, sysrepo all need to install the develbranches?

michalvasko commented 2 weeks ago

Yes, ideally, to prevent any problems.

Lllyh69 commented 1 week ago

Thank you! I used the devel version of sysrepo and netopeer2, and now I can successfully modify the configuration by edit-config!