[CONTROLLER-143] MD-SAL not unmarshalling not yet seen Identifiers Created: 29/Jan/14  Updated: 25/Jul/23  Resolved: 25/Feb/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: David Bainbridge Assignee: Maros Marsalek
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Issue Links:
Blocks
blocks CONTROLLER-114 RESTCONF Operations (RPC) Toaster inv... Resolved
External issue ID: 388

 Description   

Using the toaster sample and the release distribution, when I issue a request to "make-toast" a null pointer exception is being thrown in

org.opendaylight.controller.sample.toaster.provider.OpendaylightToaster.logToastInput(OpendaylightToaster.java:100).

It appears the the toasterToastType input parameter is not correctly be marshalled as the value in the internal structure is even though it has been set on the API call. The toasterDoneness value is being marshalled correctly.

My concern is that this may mean that general marshalling for the RESTCONF interface is not working correctly.

The API is being invoked using the following curl:

curl -v -H "Content-Type: application/vnd.yang.operation+json" -XPOST http://admin:admin@localhost:8080/restconf/operations/toaster:make-toast -d '{ "input" :

{ "toasterDoneness" : 3, "toasterToastType" : "white-bread" }

}'



 Comments   
Comment by Martin Sunal [ 04/Feb/14 ]

This commit https://git.opendaylight.org/gerrit/#/c/5035/ added media types:
application/yang.operation+json
application/yang.operation+xml

I check also all arguments which are sent and all are correctly sent to transaction. If you still get NPE then a problem is in another component and bug should be moved to MD-SAL.

Comment by David Bainbridge [ 07/Feb/14 ]

Traces this down to ValueWithQName in yang tools (LazyGeneratedCodecRegistry.java:544). The dynamically generated codec does not seem to be unmashaling the data correctly.

Comment by David Bainbridge [ 07/Feb/14 ]

It seems to get the proper value from MutableCompositeNodeTOImpl, and the AbstractNodeTO returns the value as a QName
print value
value = "(http://netconfcentral.org/ns/toaster?revision=2009-11-20)white-bread"
pool-21-thread-1[1] print value.getClass()
value.getClass() = "class org.opendaylight.yangtools.yang.common.QName"

Comment by David Bainbridge [ 07/Feb/14 ]

seems to note be able to find find a reference to the class WhiteBread at line 960 in LazyGeneratedCodecRegistry.java.

Comment by Tony Tkacik [ 19/Feb/14 ]

Fix is submitted to code review: https://git.opendaylight.org/gerrit/#/c/5414/

Comment by David Bainbridge [ 20/Feb/14 ]

I just pulled a fresh clone of the controller. Did a git fetch https://git.opendaylight.org/gerrit/controller refs/changes/14/5414/2 && git checkout FETCH_HEAD to git this patch merged into my source. Removed $HOME/.m2/respository/org. Did a mvn -U -DskipTests clean install. Ran the new build and attempted:
POST make-toast: recieved 402 (no content) and saw notification messages in log (yeah!)
PUT toaster:toaster: with
{
"toaster:toaster" :

{ "toasterManufacturer" : "test", "toasterModelNumber" : "1234567", "toasterStatus" : "Up" }

}
returned 200 OK, but failed with an exception in the console during deserialization.
GET toaster:toaster (from config) returned what i PUT
GET toaster:toaster (from operational) return 404

Comment by Tony Tkacik [ 25/Feb/14 ]

Original bug is fixed. Opened followup CONTROLLER-186 for behaviour you are seeing.

Generated at Wed Feb 07 19:52:18 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.