Merge "BUG-1276: fixed generated union constructor"
[yangtools.git] / code-generator / binding-java-api-generator / src / test / resources / compilation / typedef / foo.yang
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 module foo {
9     yang-version 1;
10     namespace "urn:opendaylight.foo";
11     prefix "foo";
12
13     revision "2013-10-08" {
14     }
15
16
17     typedef bits-ext {
18         type bits {
19             bit pc {
20                 position 0;
21             }
22             bit bpc {
23                 position 1;
24             }
25             bit dpc {
26                 position 2;
27             }
28             bit lbpc {
29                 position 3;
30             }
31             bit spc {
32                 position 4;
33             }
34             bit sfmof {
35                 position 5;
36             }
37             bit sfapc {
38                 position 6;
39             }
40         }
41     }
42
43     typedef myenum {
44         type enumeration {
45             enum zero;
46             enum one;
47             enum seven {
48                 value 7;
49             }
50         }
51         default one;
52     }
53
54     typedef int32-ext0 {
55         type int32;
56     }
57
58     typedef int32-ext1 {
59         type int32 {
60             range "2..2147483647";
61         }
62     }
63
64     typedef int32-ext2 {
65         type int32-ext1 {
66             range "3..9|11..max";
67         }
68         units "mile";
69         default "11";
70     }
71
72     typedef string-ext1 {
73         type string {
74             pattern "[a-k]*";
75             length "5..11";
76         }
77     }
78
79     typedef string-ext2 {
80         type string-ext1 {
81             length "6..10";
82         }
83     }
84
85     typedef string-ext3 {
86         type string-ext2 {
87             pattern "[b-u]*";
88         }
89     }
90
91     typedef my-decimal-type {
92         type decimal64 {
93             fraction-digits 6;
94             range "1.5..5.5";
95         }
96     }
97
98     typedef my-decimal-type2 {
99         type decimal64 {
100             fraction-digits 18;
101             range "0..1";
102         }
103     }
104
105     typedef union-ext1 {
106         type union {
107             type int16 {
108                 range "1..100";
109             }
110             type int32;
111         }
112     }
113
114     typedef union-ext2 {
115         type union-ext1;
116     }
117
118     typedef union-ext3 {
119         type union {
120             type union-ext2;
121             type string;
122         }
123         units "object id";
124     }
125
126     typedef union-ext4 {
127         type union {
128             type union-ext3;
129             type int32-ext2;
130             type empty;
131             type my-decimal-type;
132         }
133     }
134
135     typedef b1 {
136         type binary;
137     }
138
139     typedef b2 {
140         type b1;
141     }
142
143     typedef b3 {
144         type b2 {
145             length 1..10;
146         }
147     }
148
149     container c1 {
150         leaf id {
151             type b3;
152         }
153     }
154
155
156     typedef a {
157         type int8;
158     }
159
160     typedef b {
161         type int16;
162     }
163
164     typedef c {
165         type int32;
166     }
167
168     typedef d {
169         type int64 {
170             range 0..max;
171         }
172     }
173
174     typedef e {
175         type uint8;
176     }
177
178     typedef f {
179         type uint16;
180     }
181
182     typedef g {
183         type uint32;
184     }
185
186     typedef h {
187         type uint64;
188     }
189
190 }