[YANGTOOLS-531] JSON for "type bits" in YANG models not handled correctly Created: 20/Oct/15  Updated: 10/Apr/22  Resolved: 19/Nov/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Lori Jakab Assignee: Peter Kajsa
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: 4501
Priority: Normal

 Description   

We have a section with flags in one of our models, like this:

leaf lrs-bits {
type bits {
bit lookup

{ description "Lookup bit."; }

bit rloc-probe

{ description "RLOC-probe bit."; }

bit strict

{ description "Strict bit."; }

}
description
"Flag bits per hop.";
}

I'm trying to use RESTCONF to set more than one bit. However, if I use an array, only the last one mentioned is actually set:

"hop": [

{ "address": "192.0.2.1", "lrs-bits": ["lookup", "rloc-probe", "strict"] }

,

{ "address": "192.0.2.2", "lrs-bits": ["lookup", "rloc-probe"] }

,

{ "address": "192.0.2.3", "lrs-bits": ["lookup", "rloc-probe", "strict"] }

]

That is, when I read back the restcnf entry, only "strict" is set for the first hop, "rloc-probe" for the second hop, and "strict" for the last hop. I tried a few different combinations, but all were rejected.



 Comments   
Comment by Robert Varga [ 20/Oct/15 ]

BitsTypeCodec (used by JSON parser via TypeDefinitionAwareCodec) uses a space-separated string for representing a set of bits.

This should work fine, but the JSON parser should probably be more resistent to incorrect formatting – by either rejecting the array form, or correctly interpreting it.

Comment by Vratko Polak [ 20/Oct/15 ]

> BitsTypeCodec (used by JSON parser via TypeDefinitionAwareCodec) uses a space-separated string for representing a set of bits.

https://tools.ietf.org/html/draft-lhotka-netmod-yang-json-02#section-3.3.5

> either rejecting the array form, or correctly interpreting it.

Not rejecting as Beryllium Bug; not interpreting as lack of Boron Improvement?

Comment by Peter Kajsa [ 21/Oct/15 ]

quickfix - rejecting incorrect array form: https://git.opendaylight.org/gerrit/#/c/28614/

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