[YANGTOOLS-804] Netconf response payload fails to render in JSON, only XML works in RestConf response Created: 03/Aug/17 Updated: 10/Apr/22 Resolved: 17/May/18 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.0.5 |
| Type: | Bug | Priority: | Highest |
| Reporter: | JH | Assignee: | Balaji Varadaraju |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| Attachments: |
|
| External issue ID: | 8927 |
| Description |
|
Version: Boron-SR3. Restconf call to Netconf-mounted router to fetch some data with Accept: json header results in severely truncated response payload. The same call with Accept: xml header results in the entire payload correctly rendered. Setting TRACE options for netconf within karaf shows the netconf data is indeed intact in the router's RPC response. {set TRACE org.opendaylight.netconf.sal.connect.netconf, set TRACE org.opendaylight.netconf}Attachments:
|
| Comments |
| Comment by JH [ 03/Aug/17 ] |
|
Attachment jsonoutputapi.txt has been added with description: RestConf methods, output examples, and karaf log |
| Comment by Jakub Toth [ 10/Aug/17 ] |
|
Hi, Does it happen when you GET any data ? Or JSON Response is incomplete only while do you want to use RPC. Thanks |
| Comment by Jakub Toth [ 10/Aug/17 ] |
|
+ can you please add any testing yang with same structure ? |
| Comment by JH [ 15/Aug/17 ] |
|
Attachment show-system@2017-01-01.yang has been added with description: Requested Yang model for RPC example |
| Comment by JH [ 15/Aug/17 ] |
|
(In reply to Jakub Toth from comment #1) GET appears to be working. Thx |
| Comment by Balaji Varadaraju [ 05/Sep/17 ] |
|
HI Jakub, |
| Comment by Balaji Varadaraju [ 11/Sep/17 ] |
|
Hi Jakub, |
| Comment by Jakub Morvay [ 19/Sep/17 ] |
|
Moving this to Restconf component, since this seems to be related to parsing of normalized nodes to JSON. Particularly, I think there can be some issue with transforming anyxml rpc output normalized node to JSON. |
| Comment by Tomas Cere [ 03/Oct/17 ] |
|
yangtools issue, unit test: |
| Comment by Peter Kajsa [ 05/Oct/17 ] |
| Comment by Balaji Varadaraju [ 19/Oct/17 ] |
|
I took the master distribution from after it is merged to master. the exact build is karaf-0.8.0-20171019.165729-765.zip Thu Oct 19 16:57:58 UTC 2017 328022058 I still see the same issue. I am no able to get the output in JSON for this request. XML works. Is it the correct build? Can you please verify once. |
| Comment by Robert Varga [ 24/Oct/17 ] |
|
Yangtools is currently disconnect from autorelease. This will be integrated with 2.0.0 release. |
| Comment by Atul Gosain [ 13/Nov/17 ] |
|
I have put a patch for yangtools-1.2.x on https://git.opendaylight.org/gerrit/#/c/65394/4 . Please approve/merge it. |
| Comment by Robert Varga [ 14/Nov/17 ] |
|
Reopening for integration in 1.2.2. |
| Comment by Atul Gosain [ 17/Nov/17 ] |
|
We tested with the real input for the device for the same issue and this resulted in null pointer exception. Tested this input with the Unit test for bug8927/input.xml and got the same error back. Following is the input xml for the failing test <?xml version="1.0" encoding="UTF-8"?> <multi-routing-engine-item> <re-name>bsys-re0</re-name> <alarm-information xmlns="bug8927.test"> <multi-routing-engine-item> <re-name>gnf6-re0</re-name> <alarm-information xmlns="http://xml.juniper.net/junos/17.4X48/junos-alarm"> </multi-routing-engine-results> module bug8927 { revision 2017-01-01 { container foo { anyxml multi-routing-engine-results; }} |
| Comment by Balaji Varadaraju [ 07/Dec/17 ] |
|
Fix for nullpointer exception is here |
| Comment by Balaji Varadaraju [ 07/Dec/17 ] |
|
However once we got through this hurdle, we tested some anyxmls fine. So we have made progress. But looks like anyxml to JSON conversion does not handle arrays in XMLs. Looks like fundamentally there is an issue. What does below line result to? It expects the XML tag name to be a static string. The way i understand this can never be true. ANYXML_ARRAY_ELEMENT_ID.equals(firstChildElement.getNodeName() So anyxml to JSON needs the fix to handle arrays. |
| Comment by Robert Varga [ 05/Apr/18 ] |
|
Not only that, Atul's patch cause a NETCONF UT failure and was reverted. |
| Comment by Robert Varga [ 05/Apr/18 ] |
|
De-targeted released versions. This issue looks like it's going to take some doing. Balaji: are you still working on it? |
| Comment by Balaji Varadaraju [ 05/Apr/18 ] |
|
Yes Robert. I've submitted a patch in stable/carbon for your review. I think i have fixed this and tested with many RPCs that produce anyxml on real hardware devices. They produce the JSON response as expected. I've also added a few unit tests. Once we review here I can add the same patch in other branches as per your suggestion.
|
| Comment by Balaji Varadaraju [ 05/Apr/18 ] |
|
Also this is not related to other patch that was reverted. That patch was about issuing http PATCH command on the Netconf devices. This one is just about rendering ANYXML in JSON format. |
| Comment by Atul Gosain [ 06/Apr/18 ] |
|
Robert, im waiting for your comments on the patch that was reverted. Sent a mail to yangtools-dev and netconf-dev earlier this week. |
| Comment by Balaji Varadaraju [ 13/Apr/18 ] |
|
rovarga can you please review the patch? It's been pending for a few weeks now. Thanks for your help. |
| Comment by Robert Varga [ 17/Apr/18 ] |
|
bvaradar that patch needs some serious attention. Can you start by making it pass validation on master? |
| Comment by Balaji Varadaraju [ 17/Apr/18 ] |
|
Thanks rovarga. Master is pushed at https://git.opendaylight.org/gerrit/#/c/71058/. Addressed all comments. Local build is green. Lets see the jenkins build. |