Implemented typedef units statement in generated code.
[yangtools.git] / code-generator / binding-java-api-generator / src / test / resources / compilation / typedef / foo.yang
1 module foo {
2     yang-version 1;
3     namespace "urn:opendaylight.foo";
4     prefix "foo";
5
6     revision "2013-10-08" {
7     }
8
9     typedef int32-ext1 {
10         type int32 {
11             range "2..20";
12         }
13     }
14
15     typedef int32-ext2 {
16         type int32-ext1 {
17             range "3..9|11..max";
18         }
19         units "mile";
20         default "11";
21     }
22
23     typedef string-ext1 {
24         type string {
25             pattern "[a-k]*";
26             length "5..11";
27         }
28     }
29
30     typedef string-ext2 {
31         type string-ext1 {
32             length "6..10";
33         }
34     }
35
36     typedef string-ext3 {
37         type string-ext2 {
38             pattern "[b-u]*";
39         }
40     }
41
42     typedef my-decimal-type {
43         type decimal64 {
44             fraction-digits 6;
45         }
46     }
47
48     typedef union-ext1 {
49         type union {
50             type int16 {
51                 range "1..100";
52             }
53             type int32;
54         }
55     }
56
57     typedef union-ext2 {
58         type union-ext1;
59     }
60
61     typedef union-ext3 {
62         type union {
63             type union-ext2;
64             type string;
65         }
66         units "object id";
67     }
68
69     typedef union-ext4 {
70         type union {
71             type union-ext3;
72             type int32-ext2;
73             type empty;
74             type my-decimal-type;
75         }
76     }
77
78     typedef b1 {
79         type binary;
80     }
81
82     typedef b2 {
83         type b1;
84     }
85
86     typedef b3 {
87         type b2 {
88             length 1..10;
89         }
90     }
91
92     container c1 {
93         leaf id {
94             type b3;
95         }
96     }
97
98 }