Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-596

Make bits serialization sorted (by position)

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 5561

    Description

      Yang specification describes canonical form for bits to be ordered by position: http://tools.ietf.org/html/rfc6020#section-9.7.3

      But yang-data-api specifies:
      public interface BitsCodec<T> extends Codec<T, Set<String>>{
      and Set loses the ordering.
      This makes ODL report bits in pseudorandom order, which is not nice as users need more logic to compare outputs, or convert them to canonical form if needed.

      getBits() of BitsTypeDefinition already is a List, so it can preserve given ordering. But BitsCodes API change is required to make the ordering visible for serialization. Also, BitsTypeBuilder.build() is already aware of positions, but it does not use this information when passing arguments to constructor of BaseBitsType (usinging positionMap as a TreeMap could fix that).

      As this improvement requires an API change, it could be done as part of Binding Specification v2 initiative.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rovarga Robert Varga
            vrpolak Vratko Polak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: