On Tue, Jun 28, 2022 at 2:13 PM Jürgen Schönwälder <
[email protected]> wrote:
> On Tue, Jun 28, 2022 at 10:50:57PM +0200, Carsten Bormann wrote:
> >
> > The alternative would be to trigger on the data, so any string that
> looks like 2022-06-28T20:48:15Z would turn into 1(1656449295). That has
> some interesting security considerations, though.
> >
> > Grüße, Carsten
> >
> > (*) I.e., name equivalence as opposed to structural equivalence.
> > Many YANG types are defined via a regexp (pattern)…
> >
>
> YANG types are defined by their description statements. For example,
> the following two definitions are equivalent:
>
> typedef data-and-time {
> type string;
> description
> "A date-and-time value as defined in Section 5.6 of RFC 3339.";
> }
>
> typedef date-and-time {
> type string {
> pattern '[0-9]{4}-(1[0-2]|0[1-9])-(0[1-9]|[1-2][0-9]|3[0-1])'
> + 'T(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?'
> + '(Z|[\+\-]((1[0-3]|0[0-9]):([0-5][0-9])|14:00))?';
> }
> description
> "A date-and-time value as defined in Section 5.6 of RFC 3339.";
> }
>
>
We only recommend the named type approach, but I see your point that the
YANG type name cannot be used reliably.
A safer approach would be to add some info to the SID 'item' entry.
This has to be done for every data node using the alternate tag.
This 'manual' approach can be done many different ways.
The sender needs to magically encode the correct data nodes.
The receiver simply needs to understand the tag and decode correctly
whenever it is used.
Andy
The next definition is not equivalent:
>
> typedef date-and-time {
> type string {
> pattern '[0-9]{4}-(1[0-2]|0[1-9])-(0[1-9]|[1-2][0-9]|3[0-1])'
> + 'T(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?'
> + '(Z|[\+\-]((1[0-3]|0[0-9]):([0-5][0-9])|14:00))?';
> }
> description "";
> }
>
> /js
>
> --
> Jürgen Schönwälder 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/>
>
_______________________________________________
Anima mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/anima