Fixed bug in uses statement resolving.
[yangtools.git] / yang / yang-parser-impl / src / test / resources / grouping-test / uses-grouping.yang
1 module uses-grouping {
2         yang-version 1;
3         namespace "urn:opendaylight:params:xml:ns:yang:uses-grouping";
4         prefix "ug";
5
6         import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
7
8         organization "opendaylight";
9         contact "asdf";
10
11         revision "2013-07-30" {
12         }
13         
14         typedef int-ext {
15             type union {
16                 type uint8;
17                 type protocol-version;
18             }
19         }
20
21         typedef protocol-version {
22                 type uint8 {
23                         range 1..7;
24                 }
25         }
26
27         grouping bandwidth-object {
28                 uses object-header;
29
30                 container bandwidth {
31                         uses ieee754-32;
32                 }
33         }
34
35         grouping base-header {
36                 leaf delete {
37                         type uint32;
38                         mandatory true;
39                 }
40                 leaf setup {
41                         type uint32;
42                         mandatory true;
43                 }
44         }
45
46         grouping endpoints-object {
47                 uses object;
48
49                 choice address-family {
50                         case ipv4 {
51                                 leaf source-ipv4-address {
52                                         type inet:ipv4-address;
53                                         mandatory true;
54                                 }
55                         }
56                         case ipv6 {
57                                 leaf source-ipv6-address {
58                                         type inet:ipv6-address;
59                                         mandatory true;
60                                 }
61                         }
62                 }
63         }
64
65         grouping ieee754-32 {
66                 reference "IEEE 754-2008";
67                 leaf fraction {
68                         type uint32 {
69                                 range 0..1677215;
70                         }
71                         mandatory true;
72                 }
73         }
74
75         grouping lsp-attributes {
76                 container bandwidth {
77                         uses bandwidth-object;
78                 }
79         }
80
81         grouping message-header {
82                 leaf version {
83                         type protocol-version;
84                         default 1;
85                 }
86                 leaf type {
87                     type int-ext;
88                 }
89         }
90
91         grouping metric-object {
92                 uses object;
93                 leaf metric-type {
94                         type uint8;
95                         mandatory true;
96                 }
97         }
98         
99         grouping object {
100                 uses object-header;
101
102                 container box {
103                 }
104         }
105
106         grouping object-header {
107                 leaf processing-rule {
108                         type boolean;
109                 }
110                 leaf ignore {
111                         type boolean;
112                 }
113         }
114         
115         grouping path-key-object {
116                 uses object-header;
117
118                 list path-keys {
119                 }
120         }
121         
122         grouping route-object {
123                 uses object-header;
124
125                 list subobjects {
126                 }
127         }
128
129         grouping rp-object {
130                 uses object {
131                         augment "box" {
132                                 container order {
133                                         uses base-header;
134                                 }
135                         }
136                 }
137
138                 leaf priority {
139                         type uint8 {
140                                 range 1..7;
141                         }
142                 }
143         }
144         
145         grouping svec-object {
146                 uses object-header;
147
148                 leaf link-diverse {
149                         type boolean;
150                         default false;
151                 }
152         }
153
154
155         notification pcreq {
156                 uses message-header;
157
158                 list requests {
159                         container rp {
160                                 uses rp-object;
161                         }
162                         container path-key-expansion {
163                                 when "rp/path-key = true";
164                                 container path-key {
165                                         uses path-key-object {
166                                             augment path-keys {
167                                                 uses message-header;
168                                             }
169                                         }
170                                 }
171                         }
172                         container segment-computation {
173                                 when "rp/path-key = false";
174
175                                 container p2p {
176                                         when "../rp/p2mp = false";
177
178                                         container endpoints {
179                                                 uses endpoints-object;
180                                         }
181                                         container reported-route {
182                                                 uses route-object;
183
184                                                 container bandwidth {
185                                                         uses bandwidth-object;
186                                                 }
187                                         }
188
189                                         uses lsp-attributes;
190                                 }
191                         }
192                 }
193
194                 list svec {
195                         uses svec-object;
196                         list metric {
197                                 uses metric-object;
198                         }
199                 }
200         }
201
202 }