e4b47628e349ad01c45f4eb3ab555c26f11c8bf4
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / resources / test-type-provider.yang
1 module test-type-provider {
2     yang-version 1;
3     namespace "urn:opendaylight:org:test:type:provider:model";
4     prefix "tp";
5
6     import base-yang-types { prefix types; }
7
8     organization "OPEN DAYLIGHT";
9     contact "http://www.opendaylight.org/";
10
11     description "This module contains model for providing test data for Type Provider Test implementation.";
12
13     revision "2014-09-12" {
14         reference "Initial Revision.";
15     }
16
17     identity crypto-alg {
18         description
19             "Base identity from which all crypto algorithms
20             are derived.";
21     }
22
23     identity aes {
24         base "crypto-alg";
25     }
26
27     typedef extended-yang-int8 {
28         type types:yang-int8 {
29             range 1..100;
30         }
31         default 10;
32     }
33
34     typedef inner-union {
35         type union {
36             type int32;
37             type int16;
38         }
39     }
40
41     typedef restricted-string {
42         type string {
43             length "0..4";
44             pattern "[0-9a-fA-F]*";
45         }
46     }
47
48     typedef empty-pattern-string {
49         type string {
50             pattern "";
51         }
52     }
53
54     typedef complex-union {
55         type union {
56             type restricted-string;
57             type inner-union;
58             type union {
59                 type enumeration {
60                     enum a;
61                     enum b;
62                     enum c;
63                 }
64             }
65         }
66     }
67
68     typedef complex-string-int-union {
69         type union {
70             type inner-union;
71             type string;
72         }
73     }
74
75     typedef aes-identityref-type {
76         type identityref {
77             base "aes";
78         }
79     }
80
81     typedef bar-item-leafref-id {
82         type leafref {
83             path "/foo/bars/bar-item/id";
84         }
85     }
86
87     container foo {
88         container bars {
89             list bar-item {
90                 key "id";
91
92                 leaf id {
93                     type types:yang-int16;
94                 }
95             }
96         }
97
98         leaf yang-int8-type {
99             type types:yang-int8;
100         }
101
102         leaf bug-1862-restricted-typedef {
103             type types:yang-int8 {
104                 range "1..100";
105             }
106         }
107
108         leaf restricted-int8-type {
109             type types:yang-int8-restricted;
110         }
111
112         leaf restricted-int {
113             type int16 {
114                 range "1..100";
115             }
116         }
117
118         leaf resolve-enum-leaf {
119             type types:yang-enumeration;
120         }
121
122         leaf resolve-direct-use-of-enum {
123             type enumeration {
124                 enum x;
125                 enum y;
126                 enum z;
127             }
128         }
129
130         leaf-list list-of-enums {
131             type enumeration {
132                 enum x;
133                 enum y;
134                 enum z;
135             }
136         }
137
138         leaf crypto {
139             type identityref {
140                 base "crypto-alg";
141             }
142         }
143     }
144
145     container bar {
146         leaf leafref-value {
147             type leafref {
148                 path "../../foo/yang-int8-type";
149             }
150         }
151     }
152
153     container use-of-unions {
154         leaf complex-union {
155             type complex-union;
156         }
157
158         leaf complex-string-int-union {
159             type complex-string-int-union;
160         }
161
162         leaf simple-int-types-union {
163             type types:yang-union;
164         }
165     }
166
167     container construction-type-test {
168         leaf yang-boolean {
169             type types:yang-boolean;
170         }
171
172         leaf yang-empty {
173             type types:yang-empty;
174         }
175
176         leaf yang-enumeration {
177             type types:yang-enumeration;
178         }
179
180         leaf direct-use-of-enum {
181             type enumeration {
182                 enum x;
183                 enum y;
184                 enum z;
185             }
186         }
187
188         leaf yang-int8 {
189             type types:yang-int8;
190         }
191
192         leaf yang-int8-restricted {
193             type types:yang-int8-restricted;
194         }
195
196         leaf yang-int16 {
197             type types:yang-int16;
198         }
199
200         leaf yang-int32 {
201             type types:yang-int32;
202         }
203
204         leaf yang-int64 {
205             type types:yang-int64;
206         }
207
208         leaf yang-string {
209             type types:yang-string;
210         }
211
212         leaf yang-decimal64 {
213             type types:yang-decimal64;
214         }
215
216         leaf yang-uint8 {
217             type types:yang-uint8;
218         }
219
220         leaf yang-uint16 {
221             type types:yang-uint16;
222         }
223
224         leaf yang-uint32 {
225             type types:yang-uint32;
226         }
227
228         leaf yang-uint64 {
229             type types:yang-uint64;
230         }
231
232         leaf complex-union {
233             type complex-union;
234         }
235
236         leaf complex-string-int-union {
237             type complex-string-int-union;
238         }
239
240         leaf simple-int-types-union {
241             type types:yang-union;
242         }
243
244         leaf direct-union-leaf {
245             type union {
246                 type int32;
247                 type int64;
248             }
249             default "128";
250         }
251
252         leaf yang-binary {
253             type types:yang-binary;
254         }
255
256         leaf yang-bits {
257             type types:yang-bits;
258         }
259
260         leaf bar-id {
261             type bar-item-leafref-id;
262             default "128";
263         }
264
265         leaf foo-leafref-value {
266             type leafref {
267                 path "../../foo/yang-int8-type";
268             }
269         }
270
271         leaf foo-cond-bar-item {
272             type leafref {
273                 path "../../foo/bars/bar-item[id=10]";
274             }
275         }
276
277         leaf aes-identityref-type {
278             type aes-identityref-type;
279         }
280
281         leaf foo-container-id {
282             type instance-identifier;
283         }
284     }
285
286     leaf root-bits-leaf {
287         type bits {
288             bit disable-nagle {
289                 position 0;
290             }
291             bit auto-sense-speed {
292                 position 1;
293             }
294             bit 10-Mb-only {
295                 position 2;
296             }
297         }
298         default "auto-sense-speed";
299     }
300
301     leaf root-union-leaf {
302         type union {
303             type int32;
304             type int64;
305         }
306         default "256";
307     }
308 }