Fix union/bits string mapping
[mdsal.git] / binding / mdsal-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             type bits-ext;
133         }
134     }
135
136     typedef b1 {
137         type binary;
138     }
139
140     typedef b2 {
141         type b1;
142     }
143
144     typedef b3 {
145         type b2 {
146             length 1..10;
147         }
148     }
149
150     container c1 {
151         leaf id {
152             type b3;
153         }
154     }
155
156
157     typedef a {
158         type int8;
159     }
160
161     typedef b {
162         type int16;
163     }
164
165     typedef c {
166         type int32;
167     }
168
169     typedef d {
170         type int64 {
171             range 0..max;
172         }
173     }
174
175     typedef e {
176         type uint8;
177     }
178
179     typedef f {
180         type uint16;
181     }
182
183     typedef g {
184         type uint32;
185     }
186
187     typedef h {
188         type uint64;
189     }
190     container cont1 {
191         leaf leaf1 {
192             type union-ext1;
193         }
194     }
195
196 }