[CONTROLLER-311] Strings with certain special characters in JSON cause RESTCONF to return 400 Bad Request Created: 14/Apr/14 Updated: 25/Jul/23 Resolved: 16/Oct/14 |
|
| Status: | Resolved |
| Project: | controller |
| Component/s: | restconf |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Zoltan Lajos Kis | Assignee: | Jozef Gloncak |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 720 |
| Description |
|
I have a config datastore model in yang, which contains a string field. When I try to push a new entry via Restconf using JSON, if this string has a colon in it, it gets rewritten. For example, if my original string is "openflow:21", what appears in the datastore is "[openflow - 21]". When using XML, this does not happen; the original string appears in the datastore. |
| Comments |
| Comment by Jozef Gloncak [ 23/Apr/14 ] |
|
Which is YANG type for "openflow:21"? (leafref?) |
| Comment by Zoltan Lajos Kis [ 23/Apr/14 ] |
|
That is just a simple string type leaf in any container. Define the following simple config model for your bundle: grouping mydata { leaf data { type string; }} container mycontainer { } Then try to add an element to this container via restconf, using JSON encoding, where the data string is "openflow:21". What I see in this case is that the POST is successful, but when I try to read back the data (either via restconf, or via the databrokerservice), the string contents turn into "[openflow - 21]". |
| Comment by Jozef Gloncak [ 24/Apr/14 ] |
|
If input string contained colon ( |
| Comment by Jozef Gloncak [ 30/Apr/14 ] |
|
Merged on 28APR2014 |
| Comment by Colin Dixon [ 25/Sep/14 ] |
|
So, it turns out it's not just a colon. I can reproduce this in the latest Helium build as long as the string contains an open angle bracket (<) and a colon ( I found this originally by testing this snippet (which I got from the ONF spec for TTPs) against the TTP project at the URL: { , { "doc": [ "An OpenFlow group identifier (integer) identifying a group table entry", "of the type indicated by the variable name" ], "var": "<<group_entry_types:name>>" } ] The key line is: Things that fail: Things that succeed: I'm just running the most recent Helium karaf distro and then running this in install the relevant features: |
| Comment by Colin Dixon [ 25/Sep/14 ] |
|
The error I get back is: { ] |
| Comment by Jozef Gloncak [ 25/Sep/14 ] |
|
should be fixed |
| Comment by Jozef Gloncak [ 14/Oct/14 ] |
|
The direct e-mail was sent to Giovanni Meo. It was asked for fix merging. |
| Comment by Jozef Gloncak [ 16/Oct/14 ] |
|
merged on 15. october 2014 |