CESNET / netopeer2

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

Netopeer2-server exit when applying edit-config with tag mismatch in xml file #1512

Closed KimKold1 closed 7 months ago

KimKold1 commented 7 months ago

When I from netopeer2-cli run this command:

edit-config --target running --config=xml/adduseracm1.xml I get this reply: nc ERROR: SSH channel poll error (Socket error: disconnected). cli_send_recv: Failed to receive a reply

And the netopeer2-server has exit.

The used xml file has mismatching (missing) tags:

<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm">
    <groups>
        <group>
        <name>nms</name>
        <user-name>testnms</user-name>
        </group>
</nacm>

When doing the same using sysrepocfg I am politely notified about the missing closing tag:

/usr/share/sysrepo# sysrepocfg --edit=adduseracm1.xm-d startup -f xml -m ietf-netconf-acm l ibyang error: Opening ("groups") and closing ("nacm") elements tag mismatch. (Data location "/ietf-netconf-acm:nacm/groups/group[name='nms']", line number 7.) sysrepocfg error: Data parsing failed

The exit seems to be cause by an assert validation in libyang tree_data.c line 2436: netopeer2-server: /home/kkk/svn/step1/Vitis/sw_services/libyang_v2_1_30/src/src/tree_data.c:2436: lyd_path_set: Assertion `!parent || !iter->schema || !parent->schema || (lysc_data_parent(iter->schema) == parent->schema) || (!lysc_data_parent(iter->schema) && (LYD_CTX(iter) !=

We use these versions: netopeer2: 2.1.42 libnetconf2: 2.1.25 sysrepo: 2.2.12 libyang: 2.1.30

Not the latest versions, but not far from.

michalvasko commented 7 months ago

Tested with the current devel, the result:

> edit-config --target running --config=config.xml 
ERROR
        type:     application
        tag:      operation-failed
        severity: error
        message:  Opening ("groups") and closing ("nacm") elements tag mismatch.
KimKold1 commented 7 months ago

Thanks Michal for a very prompt reply ! Do you know if this is working on latest Master tag 2.1.71 and associated NC2/SR/LY ?

michalvasko commented 7 months ago

No, but you should be able to check that easily. For me the important thing is that it works in the very latest version.

KimKold1 commented 7 months ago

That is a reasonable reply ! Thanks for your help