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