Populate xpath/ hierarchy
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / resources / model / foo.yang
1 module foo {
2     yang-version 1;
3     namespace "urn:opendaylight.foo";
4     prefix "foo";
5
6     import bar {
7         prefix "br";
8         revision-date 2013-07-03;
9     }
10
11     import baz {
12         prefix "bz";
13         revision-date 2013-02-27;
14     }
15
16     include subfoo {
17         revision-date "2013-02-27";
18     }
19
20     organization "opendaylight";
21     contact "http://www.opendaylight.org/";
22
23     revision "2013-02-27" {
24         reference " WILL BE DEFINED LATER";
25     }
26
27     typedef identifier {
28         type int32;
29     }
30
31     leaf int32-leaf {
32         type br:int32-ext2 {
33             range "12..max";
34         }
35     }
36
37     leaf string-leaf {
38         type br:string-ext4;
39     }
40
41     leaf multiple-pattern-string-leaf {
42         type br:multiple-pattern-string;
43     }
44
45     leaf multiple-pattern-direct-string-def-leaf {
46         type string {
47             pattern "[e-z]*";
48             pattern "[A-Z]*-%22!^^}";
49             pattern "[a-d]*";
50         }
51     }
52
53     leaf length-leaf {
54         type br:string-ext2 {
55             length "7..max";
56         }
57     }
58
59     leaf decimal-leaf {
60         type br:my-decimal-type {
61             fraction-digits 6;
62         }
63     }
64
65     leaf decimal-leaf2 {
66         type br:my-decimal-type;
67     }
68
69     container ext {
70         bz:c-define "MY_INTERFACES";
71     }
72
73     leaf union-leaf {
74         type br:my-union-ext;
75     }
76
77     deviation /br:interfaces/br:ifEntry {
78         deviate add {
79             config "true";
80         }
81         reference "system/user ref";
82     }
83
84     leaf custom-union-leaf {
85         type bz:union1;
86     }
87
88     container transfer {
89         choice how {
90             default interval;
91             container input {
92             }
93             list output {
94                 leaf id {
95                     type string;
96                 }
97             }
98             case interval {
99                 leaf interval {
100                     type uint16;
101                     default 30;
102                     units minutes;
103                 }
104             }
105             case daily {
106                 leaf daily {
107                     type empty;
108                 }
109                 leaf time-of-day {
110                     type string;
111                     units 24-hour-clock;
112                     default 1am;
113                 }
114             }
115             case manual {
116                 leaf manual {
117                     type empty;
118                 }
119             }
120         }
121     }
122
123     anyxml datas {
124         description
125           "Copy of the source typesstore subset that matched
126            the filter criteria (if any).  An empty types container
127            indicates that the request did not produce any results.";
128         status obsolete;
129     }
130
131     augment "/br:interfaces/br:ifEntry/bz:augment-holder" {
132         when "br:ifType='ds0'";
133         leaf ds0ChannelNumber {
134             type string;
135         }
136         leaf interface-id {
137             type leafref {
138                 path "/br:interfaces/br:ifEntry/br:ifIndex";
139             }
140         }
141         leaf my-type {
142             type br:int32-ext2;
143         }
144         container schemas {
145         }
146         choice odl {
147             leaf id {
148                 type int8;
149             }
150             case node1 {
151                 description "node1";
152             }
153             case node2 {
154                 description "node2";
155             }
156             container node3 {
157                 description "node3";
158             }
159         }
160     }
161
162     container mycont {
163         container innercont {
164             typedef mytype {
165                 type string;
166             }
167             leaf myleaf {
168                 type mytype;
169             }
170         }
171     }
172
173     uses bz:target {
174         augment "how/interval" {
175             description "inner augment";
176             leaf name {
177                 type string;
178             }
179         }
180     }
181
182     container peer {
183         container destination {
184             uses bz:target {
185                 refine address {
186                     default "1.2.3.4";
187                     description "IP address of target node";
188                     reference "address reference added by refine";
189                     config false;
190                     mandatory false;
191                     must "ifType != 'ethernet' or " +
192                             "(ifType = 'ethernet' and ifMTU = 1500)" {
193                         error-message "An ethernet MTU must be 1500";
194                     }
195                     foo:mountpoint "mnt-extension";
196                 }
197                 refine port {
198                     description "description of port defined by refine";
199                     reference "port reference added by refine";
200                     config false;
201                     presence "presence is required";
202                 }
203                 refine "addresses" {
204                     description "description of addresses defined by refine";
205                     reference "addresses reference added by refine";
206                     config false;
207                     min-elements 2;
208                     max-elements unbounded;
209                 }
210                 refine addresses/id {
211                     description "id of address";
212                 }
213             }
214         }
215     }
216
217     extension mountpoint {
218         description "enter point";
219         argument "name" {
220             yin-element "true";
221         }
222     }
223
224 }