[NETCONF-205] PATCH with "target":"/" error Created: 19/May/16  Updated: 15/Mar/19  Resolved: 05/Aug/16

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

Type: Bug
Reporter: Vratko Polak Assignee: Ivan Hrasko
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 5915

 Description   

Beryllium bug, this is what happens when attempting to replace the whole car:cars container:

$ curl -u'admin:admin' -X PATCH -H "Content-Type:application/yang.patch+json" -d '{"ietf-restconf:yang-patch":{"patch-id":"0","edit":[{"edit-id":"0","operation":"replace","target":"/","value":{"car:cars":{"car-entry":[

{"id":"0"}

]}}}]}' 127.0.0.1:8181/restconf/config/car:cars ;echo

{"errors":{"error":[{"error-type":"protocol","error-tag":"malformed-message","error-message":"Error parsing json input: Could not parse Instance Identifier '/car:cars/'. Offset: 10 : Reason: Identifier cannot end with '/'.","error-info":"java.lang.IllegalArgumentException: Could not parse Instance Identifier '/car:cars/'. Offset: 10 : Reason: Identifier cannot end with '/'.\n\tat com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)\n\tat org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.checkValid(XpathStringParsingPathArgumentBuilder.java:255)\n
(and so on)



 Comments   
Comment by Ivan Hrasko [ 25/May/16 ]

Patch: https://git.opendaylight.org/gerrit/#/c/39361/
Unit tests: https://git.opendaylight.org/gerrit/#/c/38574/

Comment by Ivan Hrasko [ 25/May/16 ]

(In reply to Ivan Hrasko from comment #1)
> Patch: https://git.opendaylight.org/gerrit/#/c/39361/
> Unit tests: https://git.opendaylight.org/gerrit/#/c/38574/

The above does not belong to this bug.

Comment by Abbas P Pareedkunju [ 31/May/16 ]

On the latest build it seems working fine. Am I running it in the right way?
The below output against today's build.

opendaylight-user@root>shell:exec curl -u'admin:admin' -X PATCH -H "Content-Type:application/yang.patch+json" -d '{"ietf-restconf:yang-patch":{"patch-id":"0","edit":[{"edit-id":"0","operation":"replace","target":"/","value":{"car:cars":{"car-entry":[

{"id":"0"}

]}}}]}' localhost:8080/restconf/config/car:cars ;echo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 152 0 0 100 152 0 542 -::- -::- -::- 540

opendaylight-user@root>

Comment by Vratko Polak [ 31/May/16 ]

This is how distribution-karaf-0.4.3-20160531.093344-196.zip behaves for me:

opendaylight-user@root>feature:install odl-restconf odl-clustering-test-app
opendaylight-user@root>shell:exec curl -u'admin:admin' -X PATCH -H "Content-Type:application/yang.patch+json" -d '{"ietf-restconf:yang-patch":{"patch-id":"0","edit":[{"edit-id":"0","operation":"replace","target":"/","value":{"car:cars":{"car-entry":[

{"id":"0"}

]}}}]}' localhost:8080/restconf/config/car:cars ;echo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8026 0 7874 100 152 17556 338 -{"errors":{"error":[{"error-type":"protocol","error-tag":"malformed-message","error-message":"Error parsing json input: Could not parse Instance Identifier '/car:cars/'. Offset: 10 : Reason: Identifier cannot end with '/'.","error-info":"java.lang.IllegalArgumentException: Could not parse Instance Identifier '/car:cars/'. Offset: 10 : Reason: Identifier cannot end with '/'.\n\tat com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)\n\tat org.opendaylight.yangtools.yang.data.util.XpathStringParsingPathArgumentBuilder.checkValid(XpathStringPars100 8026 0 7874 100 152 17465 337 --::- -::- -::- 17694-:-:- -::- 17814
.data.util.XpathStringParsingPathArgumentBuilder.computeNextArgument(XpathStringParsingPathArgumentBuilder.java:98)\n
(and many more)

Comment by Ivan Hrasko [ 29/Jun/16 ]

Patch:
https://git.opendaylight.org/gerrit/#/c/40991/

Comment by Ivan Hrasko [ 11/Jul/16 ]

Needs to be adapted also for XML

Comment by Ivan Hrasko [ 18/Jul/16 ]

adapted for both json and xml:
https://git.opendaylight.org/gerrit/#/c/40991/

Comment by Ivan Hrasko [ 19/Jul/16 ]

Merged to Be, needs port to Boron.

Comment by Ivan Hrasko [ 27/Jul/16 ]

Cherry pick to Boron old Restconf:
https://git.opendaylight.org/gerrit/#/c/42460/

Comment by Ivan Hrasko [ 29/Jul/16 ]

Cherry pick merged to Boron.

Comment by Ivan Hrasko [ 05/Aug/16 ]

patch for new restconf has been merged to master:
https://git.opendaylight.org/gerrit/#/c/41833/

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