Fixed some major sonar issues in yang-validation-tool
[yangtools.git] / code-generator / binding-generator-impl / src / test / resources / type-provider / test.yang
1 module test {
2     yang-version 1;
3     namespace "urn:opendaylight:test";
4     prefix "t";
5
6     import ietf-inet-types {
7         prefix "inet";
8     }
9
10     revision "2013-10-08" {
11     }
12
13
14
15     // binary
16     typedef my-binary {
17         type binary;
18     }
19
20     leaf ext-binary {
21         type my-binary;
22         default "TWFu";
23     }
24
25     leaf leaf-binary {
26         type binary;
27         default "TWFu";
28     }
29
30
31
32     // bits
33     typedef my-bits {
34         type bits {
35             bit ctrl;
36             bit alt {
37                 position 5;
38             }
39             bit delete;
40         }
41     }
42
43     leaf ext-bits {
44         type my-bits;
45         default "delete";
46     }
47
48     leaf leaf-bits {
49         type bits {
50             bit ctrl;
51             bit alt {
52                 position 5;
53             }
54             bit delete;
55         }
56         default "delete";
57     }
58
59
60
61     // boolean
62     typedef my-boolean {
63         type boolean;
64     }
65
66     leaf ext-boolean {
67         type my-boolean;
68         default true;
69     }
70
71     leaf leaf-boolean {
72         type boolean;
73         default true;
74     }
75
76
77
78     // decimal64
79     typedef my-decimal64 {
80         type decimal64 {
81             fraction-digits 4;
82         }
83     }
84
85     leaf ext-decimal64 {
86         type my-decimal64;
87         default "3.14";
88     }
89
90     leaf leaf-decimal64 {
91         type decimal64 {
92             fraction-digits 4;
93         }
94         default "3.14";
95     }
96
97
98
99     // empty
100     typedef my-empty {
101         type empty;
102     }
103
104     leaf ext-empty {
105         type my-empty;
106         default false;
107     }
108
109     leaf leaf-empty {
110         type empty;
111         default false;
112     }
113
114
115
116     // enumeration
117     typedef my-enumeration {
118         type enumeration {
119             enum zero;
120             enum one;
121             enum seven {
122                 value 7;
123             }
124         }
125     }
126
127     leaf ext-enumeration {
128         type my-enumeration;
129         default seven;
130     }
131
132     leaf leaf-enumeration {
133         type enumeration {
134             enum zero;
135             enum one;
136             enum seven {
137                 value 7;
138             }
139         }
140         default seven;
141     }
142
143
144
145     // identityref
146     typedef my-identityref {
147         type identityref {
148             base alg;
149         }
150     }
151
152     leaf ext-identityref {
153         type my-identityref;
154     }
155
156     leaf leaf-identityref {
157         type identityref {
158             base alg;
159         }
160     }
161
162
163
164     // int8
165     typedef my-int8 {
166         type int8;
167     }
168
169     leaf ext-int8 {
170         type my-int8;
171         default "11";
172     }
173
174     leaf leaf-int8 {
175         type int8;
176         default "11";
177     }
178
179
180
181     // int16
182     typedef my-int16 {
183         type int16;
184     }
185
186     leaf ext-int16 {
187         type my-int16;
188         default "111";
189     }
190
191     leaf leaf-int16 {
192         type int16;
193         default "111";
194     }
195
196
197
198     // int32
199     typedef my-int32 {
200         type int32;
201     }
202
203     leaf ext-int32 {
204         type my-int32;
205         default "1111";
206     }
207
208     leaf leaf-int32 {
209         type int32;
210         default "1111";
211     }
212
213
214
215     // int64
216     typedef my-int64 {
217         type int64;
218     }
219
220     leaf ext-int64 {
221         type my-int64;
222         default "11111";
223     }
224
225     leaf leaf-int64 {
226         type int64;
227         default "11111";
228     }
229
230
231
232     // leafref
233     typedef my-leafref {
234         type leafref {
235             path "/links/node/id-64";
236         }
237     }
238
239     leaf ext-leafref {
240         type my-leafref;
241         default "1.234";
242     }
243
244     leaf leaf-leafref {
245         type leafref {
246             path "/links/node/id-64";
247         }
248         default "1.234";
249     }
250
251     typedef my-leafref1 {
252         type leafref {
253             path "/links/node/id-for-binary";
254         }
255     }
256
257     leaf ext-leafref1 {
258         type my-leafref1;
259         default "TWFu";
260     }
261
262     leaf leaf-leafref1 {
263         type leafref {
264             path "/links/node/id-for-binary";
265         }
266         default "TWFu";
267     }
268
269
270
271     // string
272     typedef my-string {
273         type string;
274     }
275
276     leaf ext-string {
277         type my-string;
278         default "name";
279     }
280
281     leaf leaf-string {
282         type string;
283         default "name";
284     }
285
286
287
288     // uint8
289     typedef my-uint8 {
290         type uint8;
291     }
292
293     leaf ext-uint8 {
294         type my-uint8;
295         default "11";
296     }
297
298     leaf leaf-uint8 {
299         type uint8;
300         default "11";
301     }
302
303
304
305     // uint16
306     typedef my-uint16 {
307         type uint16;
308     }
309
310     leaf ext-uint16 {
311         type my-uint16;
312         default "111";
313     }
314
315     leaf leaf-uint16 {
316         type uint16;
317         default "111";
318     }
319
320
321
322     // uint32
323     typedef my-uint32 {
324         type uint32;
325     }
326
327     leaf ext-uint32 {
328         type my-uint32;
329         default "1111";
330     }
331
332     leaf leaf-uint32 {
333         type uint32;
334         default "1111";
335     }
336
337
338
339     // uint64
340     typedef my-uint64 {
341         type uint64;
342     }
343
344     leaf ext-uint64 {
345         type my-uint64;
346         default "11111";
347     }
348
349     leaf leaf-uint64 {
350         type uint64;
351         default "11111";
352     }
353
354     // uint64
355     typedef my-union {
356         type union {
357             type string;
358             type my-binary;
359         }
360     }
361
362     leaf ext-union {
363         type my-union;
364         default "111";
365     }
366
367     leaf leaf-union {
368         type union {
369             type string;
370             type int8;
371         }
372         default "111";
373     }
374
375     container c1 {
376         container c2 {
377             typedef nested-union {
378                 type union {
379                     type string;
380                     type int16;
381                 }
382             }
383             container c3 {
384                 leaf id {
385                     type nested-union;
386                     default "111";
387                 }
388             }
389         }
390     }
391
392
393     list links {
394         container node {
395             leaf id-64 {
396                 type decimal64 {
397                     fraction-digits "7";
398                 }
399             }
400             leaf id-for-binary {
401                 type my-binary;
402             }
403         }
404     }
405
406     identity alg {
407     }
408
409     leaf ip-leaf {
410         type inet:ipv4-address;
411         default "0.0.0.1";
412     }
413
414 }