Subject: [netmod] new YANG 1.1 issue: add expression of patterns' relation

From: chong feng <[email-masked]>
Date: Thu, 3 Apr 2014 23:53:46 +0800

Hi all,
    It's not possible to express the relation of patterns. For example,
     leaf a {
            type string {
                 pattern p1;
                 pattern p2;
                 pattern p3;
            }
     }

It's not possible to express ( p1 | p3) & p2.

So, YANG1.1 can add 3 statements:patterns , regex and relation
to express this relation.

'patterns' statement as type(string)'s sub statement, and for compatible,
'pattern' statement will be reserved

'patterns' statement has no argument and has some sub statements listed
below:
 +---------------+--------------+
                 | substatement  | cardinality  |
                 +---------------+--------------+
                 | description   |  0..1        |
                 | error-app-tag |  0..1        |
                 | error-message |  0..1        |
                 | reference     |  0..1        |
                 | pattern       |  0..n        |
                 | relation      |  0..1        |
                 +---------------+--------------+

'pattern' statement is a sub statement of 'patterns' and is not the same to
the 'pattern' statement as the sub statement of type(string).
So, it's called new 'pattern' statement.
the new 'pattern' statement has a argument 'name',it's not regular
expression,it's just a pattern identifier.The new 'pattern' statement
has some sub statements listed below:
 +---------------+--------------+
                 | substatement  | cardinality  |
                 +---------------+--------------+
                 | description   |  0..1        |
                 | error-app-tag |  0..1        |
                 | error-message |  0..1        |
                 | reference     |  0..1        |
                 | regex         |  1           |
                 +---------------+--------------+
 'regex' statement has an argument 'expression',this argument is a regular
expression,and 'regex' statement has no sub statements.

 'realation' statement has an argument "expression", this argument is a
logical expression,such as (p1 | p2)&p3,etc. And this statement has
 no sub statement.

 For example:

     leaf a {
            type string {
                 patterns {
                  pattern p1 {
                     regex "[a-z]";
                  }
                  pattern p2 {
                  regex "[0-9]"
                  }
                  relation "(p1 | p2)";
                 }
                 pattern "abc";

            }
     }

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 04 Apr 2014 10:19:09 +0200 (CEST)

Added as Y32.

/martin

---

From: Per Hedeland <[email-masked]>
Date: Fri, 04 Apr 2014 10:47:10 +0200

> Added as Y32.

Hm, but the problem statement isn't correct, is it? Multliple patterns
are ANDed per 6020, and OR is just standard regexp "branching". I.e.

  ( p1 | p3) & p2

is expressed as

       type string {
            pattern p1|p3;
            pattern p2;
       }

(of course with actual pattern strings p1 and p3 are probably quoted,
and the vertical bar needs to be inside the single pair of quotes for
the combination). Am I missing something?

--Per

> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod