[NETCONF-1177] PUT requests failing with "insert" query parameter on testool models Created: 05/Oct/23  Updated: 02/Feb/24

Status: Confirmed
Project: netconf
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0

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

Attachments: File PUT with insert&point parameters.postman_collection.json     File karaf.log     File testtool.log     File user-ordered-list@2023-10-04.yang    
Issue Links:
Blocks
is blocked by NETCONF-1245 Full list delete fails when called on... Open
is blocked by YANGTOOLS-1565 Ordered list item order cannot be cha... Open
is blocked by NETCONF-1239 Exception on building get-config list... Resolved
Relates
relates to NETCONF-1178 POST request with insert parameter fa... In Progress
relates to NETCONF-1163 Create tests for POST "insert" query ... Resolved
relates to NETCONF-1180 PUT request with insert=after cannot ... Confirmed
relates to NETCONF-1202 Optimize Restconf-Netconf operations ... Confirmed

 Description   

PUT requests with query parameters: insert=first, insert=after&point, insert=before&point are failing

{
    "errors": {
        "error": [
            {
                "error-tag": "operation-failed",
                "error-info": "TransactionCommitFailedException{message=Netconf transaction commit failed, errorList=[RpcError [message=Netconf transaction commit failed, severity=ERROR, errorType=APPLICATION, tag=operation-failed, applicationTag=null, info=null, cause=NetconfDocumentedException{error-type=APPLICATION, error-tag=operation-failed, error-severity=ERROR, error-info={}, message=RPC during tx failed. Unexpected error <error>java.lang.IllegalArgumentException: Input is empty while expecting 1 item</error>}]]}",
                "error-message": "Transaction(PUT) not committed correctly",
                "error-type": "application"
            }
        ]
    }
}

Steps to reproduce:
1. Run testtool with the provided [^user-ordered-list@2023-10-04.yang]

2. Use the 'insert&point' parameters from the PUT with insert&point parameters.postman_collection.json and try to PUT 2 or more items into the 'ordered-by user' list.
 
 
 



 Comments   
Comment by Ruslan Kashapov [ 28/Nov/23 ]

the main cause of the issue seems to be incorrect removal of a list through netconf protocol.

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>

 

Comment by Ruslan Kashapov [ 02/Feb/24 ]

The issue with list deletion on remote device is extracted to https://jira.opendaylight.org/browse/NETCONF-1245 so it can be resolved independently.

Current issue cannot be solved unless there is a netconf device which supports list items deletion then insertion in new order within same transaction.
Neither ODL testtool nor netopeed respect new order for now.

Blocker issue added to resolve storage issue at least for ODL device simulator – https://jira.opendaylight.org/browse/YANGTOOLS-1565
So the expected behavior can be tested/verified

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