[NETCONF-1245] Full list delete fails when called on remote device via restconf Created: 02/Feb/24  Updated: 02/Feb/24

Status: Open
Project: netconf
Component/s: netconf, restconf-nb
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Ruslan Kashapov Assignee: Ruslan Kashapov
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks NETCONF-1177 PUT requests failing with "insert" qu... Confirmed

 Description   

The full list deletion could be invoked on processing new item insertion into ordered list.

See  NETCONF-1177

When netconf edit-config message is constructed for remove operation using yang instance identifier pointing to list the message like below occurs

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-19">
    <edit-config>
        <target>
            <candidate/>
        </target>
        <config>
            <root xmlns="http://example.com/user-ordered-list" xmlns:op="urn:ietf:params:xml:ns:netconf:base:1.0" op:operation="remove">
                <items/>
            </root>
        </config>
    </edit-config>
</rpc>

According to https://datatracker.ietf.org/doc/html/rfc6241#section-7.2 the operation expected to be defined on element the operation being applied to.

The message above instructs to remove parent container (instead of list elements within), and empty <items/> causes parse error, because the key is mandatory.

In order to remove all the elements belonging to requested list all the elements require to be listed like below

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-19">
    <edit-config>
        <target>
            <candidate/>
        </target>
        <config>
            <root xmlns="http://example.com/user-ordered-list" xmlns:op="urn:ietf:params:xml:ns:netconf:base:1.0">
                <items op:operation="remove">
                    <id>0</id>
                </items>
                <items op:operation="remove">
                    <id>1</id>
                </items>
            </root>
        </config>
    </edit-config>
</rpc>

Generated at Wed Feb 07 20:17:01 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.