Subject: [yang-doctors] Definition for base64

From: Mahesh Jethanandani <[email-masked]>
Date: Fri, 17 Aug 2018 10:26:29 -0700

Is there a definition for base64 defined in one of the YANG models? I would prefer to use one if it defined. If not, I was going to define one as

 typedef base64 {
    type string {
      pattern '(([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|'
            + '[A-Za-z0-9+/]{2}==)?){1}';
    }
    description
      "A binary-to-text encoding scheme to represent binary data in
       an ASCII string format.";
    reference
      "RFC 4648, The Base16, Base32, and Base64 Data Encodings";
  }

Mahesh Jethanandani
[email-masked]

---

From: Andy Bierman <[email-masked]>
Date: Fri, 17 Aug 2018 10:40:07 -0700

Hi,

Aren't you confusing YANG data types with message encoding?
A base64 string at the YANG level is just a string. There are no
non-printable chars
like a binary string could have.  Not sure why the type base64 is
interesting in YANG data models.

Andy

On Fri, Aug 17, 2018 at 10:26 AM, Mahesh Jethanandani <
[email-masked]> wrote:

> Is there a definition for base64 defined in one of the YANG models? I
> would prefer to use one if it defined. If not, I was going to define one as
>
>  typedef base64 {
>     type string {
> _______________________________________________
> yang-doctors mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-doctors
>

---

From: Mahesh Jethanandani <[email-masked]>
Date: Fri, 17 Aug 2018 10:46:55 -0700

I have a protocol (Babel) that defines router-id as a base64 string of 8 octets. I could define it as a string, but isn’t it the case that base64 includes only a set of printable characters defined by the regex below? Not all printable characters are included in the set.

> On Aug 17, 2018, at 10:40 AM, Andy Bierman <[email-masked]> wrote:
> 
> Hi,
> 
> A base64 string at the YANG level is just a string. There are no non-printable chars
> like a binary string could have.  Not sure why the type base64 is interesting in YANG data models.
> 
> 
> Andy
> 
> 
> On Fri, Aug 17, 2018 at 10:26 AM, Mahesh Jethanandani <[email-masked] <mailto:[email-masked]>> wrote:
> [email-masked] <mailto:[email-masked]>
> 
> [email-masked] <mailto:[email-masked]>
> https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>
> 

Mahesh Jethanandani
[email-masked]

---

From: "Acee Lindem (acee)" <[email-masked]>
Date: Fri, 17 Aug 2018 18:05:19 +0000

Hi Mahesh,

As Andy states, the base64 encodings are type string in the existing YANG data nodes.

See search for base64:

https://www.yangcatalog.org/yang-search/yang-search.php
Thanks,
Acee

From: yang-doctors <[email-masked]> on behalf of Mahesh Jethanandani <[email-masked]>
Date: Friday, August 17, 2018 at 1:46 PM
To: Andy Bierman <[email-masked]>
Cc: YANG Doctors <[email-masked]>
Subject: Re: [yang-doctors] Definition for base64

On Aug 17, 2018, at 10:40 AM, Andy Bierman <[email-masked]<mailto:[email-masked]>> wrote:

Hi,

Andy

On Fri, Aug 17, 2018 at 10:26 AM, Mahesh Jethanandani <[email-masked]<mailto:[email-masked]>> wrote:
Is there a definition for base64 defined in one of the YANG models? I would prefer to use one if it defined. If not, I was going to define one as

 typedef base64 {
    type string {

Mahesh Jethanandani
[email-masked]<mailto:[email-masked]>

_______________________________________________
yang-doctors mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/yang-doctors

Mahesh Jethanandani
[email-masked]<mailto:[email-masked]>

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Fri, 17 Aug 2018 21:03:51 +0200

> I have a protocol (Babel) that defines router-id as a base64 string of 8 octets. I could define it as a string, but isn’t it the case that base64 includes only a set of printable characters defined…

RFC 6126 section 4.1.2 says:

4.1.2.  Router-Id

   A router-id is an arbitrary 8-octet value.  Router-ids SHOULD be
   assigned in modified EUI-64 format [ADDRARCH].

Where does it say that it is a string on 8 octets base64? Note, if you
use binary with length of 8, you actually get a base64 encoding on the
wire. But then there might be another doument that says the router-id
is to rendered as base64 but then the base64 string obviously is
longer than 8 octets. If you work off the information model, then I
might understand that you are confused because
draft-ietf-babel-information-model-03 says:

   base64      An opaque array of bytes.

What is that? Does this mean a base64 encoded opaque array of bytes?
Or something else? I would check how babel people and implementors
prefer to represent router-ids in textual format. Do they really
want trailing characters?

  import base64
  print(base64.b64encode(bytes(8)))

Gives me:

  b'AAAAAAAAAAA='

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>

---

From: Andy Bierman <[email-masked]>
Date: Fri, 17 Aug 2018 12:14:23 -0700

On Fri, Aug 17, 2018 at 12:03 PM, Juergen Schoenwaelder <
[email-masked]> wrote:

> > I have a protocol (Babel) that defines router-id as a base64 string of 8
> octets. I could define it as a string, but isn’t it the case that base64
> includes only a set of printable characters defined by the regex below? Not
> all printable characters are included in the set.
>

IMO the correct YANG data model would use type binary { length 8; }

Andy

---

From: Mahesh Jethanandani <[email-masked]>
Date: Fri, 17 Aug 2018 15:58:13 -0700

Hi Juergen,

I was going off of the information model. 

Let me check with the WG whether the router-id is a string of 8 octets or binary data of length 8.

Thanks.

> On Aug 17, 2018, at 12:03 PM, Juergen Schoenwaelder <[email-masked]> wrote:
> 

Mahesh Jethanandani
[email-masked]