Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-impl / src / test / resources / rfc7950 / bug6878 / foo.yang
1 module foo {
2     namespace foo;
3     prefix foo;
4     yang-version 1.1;
5
6     revision 2016-02-24;
7
8     identity interface-type;
9
10     identity ethernet {
11         base interface-type;
12     }
13
14     identity fast-ethernet {
15         base ethernet;
16     }
17
18     identity gigabit-ethernet {
19         base ethernet;
20     }
21
22     list interface {
23         key "name";
24         leaf name {
25             type string;
26         }
27
28         leaf type {
29             type identityref {
30                 base interface-type;
31             }
32         }
33
34         leaf enabled {
35             type boolean;
36         }
37     }
38
39     leaf outgoing-interface {
40         type leafref {
41             path "/interface/name";
42         }
43
44         must 'count(/interface[re-match(name, "eth0\.\d+")]) = 3';
45     }
46
47     container mgmt-interface {
48         leaf name {
49             type leafref {
50                 path "/interface/name";
51             }
52         }
53         leaf type {
54             type leafref {
55                 path "/interface[name=current()/../name]/type";
56             }
57             must 'derived-from-or-self(deref(.), "foo:ethernet")';
58         }
59     }
60
61     container my-cont {
62         leaf enum-value {
63             type enumeration {
64                 enum a {
65                     value 1;
66                 }
67                 enum b {
68                     value 2;
69                 }
70             }
71         }
72
73         must "enum-value(current()/enum-value) = 1";
74
75         leaf bit-is-set {
76             type bits {
77                 bit x;
78                 bit y;
79                 bit z;
80             }
81         }
82
83         leaf bits-leaf {
84             type bits {
85                 bit a;
86                 bit b;
87                 bit c;
88             }
89         }
90
91         must 'bit-is-set(current()/bit-is-set, "z") and bit-is-set(current()/bits-leaf, "c")';
92     }
93 }