Merge "Added reusable string codecs to yang-data-impl"
[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
10     typedef bits-ext {
11         type bits {
12             bit pc {
13                 position 0;
14             }
15             bit bpc {
16                 position 1;
17             }
18             bit dpc {
19                 position 2;
20             }
21             bit lbpc {
22                 position 3;
23             }
24             bit spc {
25                 position 4;
26             }
27             bit sfmof {
28                 position 5;
29             }
30             bit sfapc {
31                 position 6;
32             }
33         }
34     }
35
36     typedef myenum {
37         type enumeration {
38             enum zero;
39             enum one;
40             enum seven {
41                 value 7;
42             }
43         }
44         default one;
45     }
46
47     typedef int32-ext0 {
48         type int32;
49     }
50
51     typedef int32-ext1 {
52         type int32 {
53             range "2..2147483647";
54         }
55     }
56
57     typedef int32-ext2 {
58         type int32-ext1 {
59             range "3..9|11..max";
60         }
61         units "mile";
62         default "11";
63     }
64
65     typedef string-ext1 {
66         type string {
67             pattern "[a-k]*";
68             length "5..11";
69         }
70     }
71
72     typedef string-ext2 {
73         type string-ext1 {
74             length "6..10";
75         }
76     }
77
78     typedef string-ext3 {
79         type string-ext2 {
80             pattern "[b-u]*";
81         }
82     }
83
84     typedef my-decimal-type {
85         type decimal64 {
86             fraction-digits 6;
87             range "1.5..5.5";
88         }
89     }
90
91     typedef union-ext1 {
92         type union {
93             type int16 {
94                 range "1..100";
95             }
96             type int32;
97         }
98     }
99
100     typedef union-ext2 {
101         type union-ext1;
102     }
103
104     typedef union-ext3 {
105         type union {
106             type union-ext2;
107             type string;
108         }
109         units "object id";
110     }
111
112     typedef union-ext4 {
113         type union {
114             type union-ext3;
115             type int32-ext2;
116             type empty;
117             type my-decimal-type;
118         }
119     }
120
121     typedef b1 {
122         type binary;
123     }
124
125     typedef b2 {
126         type b1;
127     }
128
129     typedef b3 {
130         type b2 {
131             length 1..10;
132         }
133     }
134
135     container c1 {
136         leaf id {
137             type b3;
138         }
139     }
140
141
142     typedef a {
143         type int8;
144     }
145
146     typedef b {
147         type int16;
148     }
149
150     typedef c {
151         type int32;
152     }
153
154     typedef d {
155         type int64 {
156             range 0..max;
157         }
158     }
159
160     typedef e {
161         type uint8;
162     }
163
164     typedef f {
165         type uint16;
166     }
167
168     typedef g {
169         type uint32;
170     }
171
172     typedef h {
173         type uint64;
174     }
175
176 }