[NETCONF-877] Fail to process PATCH to data root with a top-level container as target Created: 06/May/22  Updated: 13/May/22  Resolved: 13/May/22

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: 3.0.0, 3.0.1, 3.0.2
Fix Version/s: 4.0.0, 3.0.3

Type: Bug Priority: Medium
Reporter: Sangwook Ha Assignee: Sangwook Ha
Resolution: Done Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Controller fails to process a PATCH request to the data root with a top-level container as target.

For example, with the following YANG model:

module foo {
    namespace "urn:foo";
    prefix orig;

    container foo {
        leaf bar {
            type string;
        }
    }
}

The following PATCH request fails:

PATCH /rests/data
{
    "ietf-yang-patch:yang-patch": {
        "patch-id": "patch-1",
        "edit": [
            {
                "edit-id": "edit1",
                "operation": "merge",
                "target": "/foo:foo",
                "value": {
                    "foo:foo": {
                        "bar": "apple"
                    }
                }
            }
        ]
    }
}

with the following error:

{
    "errors": {
        "error": [
            {
                "error-tag": "malformed-message",
                "error-info": "Cannot execute on empty stack",
                "error-message": "Error parsing json input: Cannot execute on empty stack",
                "error-type": "protocol"
            }
        ]
    }
}

The following equivalent requests work:

PATCH /rests/data/foo:foo
{
    "ietf-yang-patch:yang-patch": {
        "patch-id": "patch-1",
        "edit": [
            {
                "edit-id": "edit1",
                "operation": "merge",
                "target": "/",
                "value": {
                    "foo:foo": {
                        "bar": "apple"
                    }
                }
            }
        ]
    }
}
PATCH /rests/data
{
    "ietf-yang-patch:yang-patch": {
        "patch-id": "patch-1",
        "edit": [
            {
                "edit-id": "edit1",
                "operation": "merge",
                "target": "/foo:foo/bar",
                "value": {
                    "bar": "apple"
                }
            }
        ]
    }
}


 Comments   
Comment by Sangwook Ha [ 06/May/22 ]

Test cases to reproduce the issue: https://git.opendaylight.org/gerrit/c/netconf/+/101003/2

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