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