Subject: [Yot] Use of CBOR tags in "draft-ietf-core-yang-cbor"

From: Michel Veillette <[email-masked]>
Date: Thu, 28 Feb 2019 01:01:22 +0000

Hi YANG to CBOR users

In some cases, using a SID instead of a delta can simplify implementations.
My current specific use case is the encoding of an 'anydata' in a logger.
This can be accomplished by tagging the SID with a specific CBOR tag.
See example below.

Another use case for CBOR tags is the encoding of a 'date-and-time' typedef defined in https://tools.ietf.org/html/rfc6021#section-3 .
This typedef is currently encoded using  a 20 byte string  (e.g. "2014-10-26T12:16:31Z").
If we allow the use of the already existing 'Epoch-based date/time' tag, this information can be encoded using a 4 byte integer.
See example below.

YANG tree:

+--ro logger*                SID 1000524
   +--ro notification        anydata
  +--ro timestamp?          SID 1000525
   +--ro sequence-number     SID 1000526

---n yang-library-change     SID 1000465
   +--ro hash                SID 1000466

CBOR diagnostic notation:

{
  1000524 : [
    {
      SID tag(1000465) : {
        1 : h'8A934D83672F309E'
      },
      +1 : 1(1551296644),
      +2 : 123
    }
  ]
}

CBOR encoding:

A1                              # map(1)
   1A 000F444C                  # unsigned(1000524)
   81                           # array(1)
      A3                        # map(3)
         D8 63                  # tag(99)
            1A 000F4411         # unsigned(1000465)
         A1                     # map(1)
            01                  # unsigned(1)
            48                  # bytes(8)
               8A934D83672F309E # "\x8A\x93M\x83g/0\x9E"
         01                     # unsigned(1)
         C1                     # tag(1)
            1A 5C76E884         # unsigned(1551296644)
         02                     # unsigned(2)
         18 7B                  # unsigned(123)

Question:

  *   Should we support the 'Epoch-based date/time' tag in 'draft-ietf-core-yang-cbor' ?
  *   Should we support the 'Absolute SID' tag in 'draft-ietf-core-yang-cbor' ?
  *   Is so, can we get this tag allocated by IANA only based on an IETF draft? (Do we need to wait for the RFC)
  *   Any other use cases for CBOR tags:
     *   phys-address in ietf-yang-types (https://tools.ietf.org/html/rfc6021) ?
     *   mac-address in ietf-yang-types (https://tools.ietf.org/html/rfc6021) ?

Regards
Michel Veillette