Initial code drop of yang model driven configuration system
[controller.git] / opendaylight / config / yang-test / src / main / yang / config-test-impl.yang
1 module config-test-impl {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:controller:test:impl";
4     prefix "it-impl";
5
6     import config-test { prefix test; revision-date 2013-06-13;}
7     import config { prefix config; revision-date 2013-04-05; }
8     import ietf-inet-types { prefix inet; revision-date 2010-09-24;}
9     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
10
11
12     description
13         "Testing IMPL";
14
15     revision "2013-04-03" {
16         description
17             "Initial revision";
18     }
19
20     identity impl {
21         base config:module-type;
22         config:provided-service test:testing;
23         config:java-name-prefix TestImpl;
24     }
25
26     identity impl-dep {
27         base config:module-type;
28         config:provided-service test:testing;
29         config:java-name-prefix DepTestImpl;
30     }
31
32     identity impl-netconf {
33         base config:module-type;
34         config:provided-service test:testing;
35         config:java-name-prefix NetconfTestImpl;
36     }
37
38
39     augment "/config:modules/config:module/config:configuration" {
40         case impl {
41             when "/config:modules/config:module/config:type = 'impl'";
42
43            leaf-list allow-user  {
44                 type string;
45                 description "A list of user name patterns to allow";
46            }
47
48            container dto-a {
49                 leaf simple-arg {
50                     type uint32;
51                 }
52
53                 leaf port {
54                     type inet:port-number;
55                 }
56
57             }
58
59             leaf as-number {
60                 mandatory true;
61                 type inet:as-number;
62             }
63
64
65             leaf simpleInt {
66                 type uint32;
67                 default 99L;
68             }
69
70             container dto_b {
71                 leaf simple-int1 {
72                     type uint32;
73                 }
74
75                 leaf simple-int2 {
76                     type uint32;
77                 }
78             }
79
80         }
81     }
82
83     augment "/config:modules/config:module/config:state" {
84         case impl {
85             when "/config:modules/config:module/config:type = 'impl'";
86             // root runtime bean
87             leaf created-sessions {
88                 type uint32;
89             }
90         }
91     }
92
93     augment "/config:modules/config:module/config:configuration" {
94         case impl-dep {
95             when "/config:modules/config:module/config:type = 'impl-dep'";
96         }
97     }
98
99     augment "/config:modules/config:module/config:configuration" {
100         case impl-netconf {
101             when "/config:modules/config:module/config:type = 'impl-netconf'";
102             leaf binaryLeaf {
103                 type binary;
104             }
105
106             leaf type {
107                 type string;
108             }
109
110            container dto-c {
111                 leaf simple-arg {
112                     type uint32;
113                 }
114
115                 container dto-a-inner {
116                     leaf simple-arg {
117                         type uint32;
118                     }
119
120                     container dto-a-inner-inner {
121                         leaf simple-arg {
122                             type uint32;
123                         }
124                     }
125                 }
126             }
127
128             leaf simpleInt {
129                 type uint32;
130             }
131
132             leaf simpleBoolean {
133                 type boolean;
134                 default false;
135             }
136
137             leaf simple-long {
138                 type int64  ;
139             }
140
141             leaf simple-long-2 {
142                 type uint32;
143             }
144
145             leaf simple-BigInteger {
146                 type uint64;
147             }
148
149             leaf simple-byte {
150                 type int8;
151             }
152
153             leaf simple-short {
154                 type uint8;
155             }
156
157             leaf simple-test {
158                 type uint16;
159                 default 99;
160             }
161
162             leaf-list simple-list {
163                 type uint16;
164             }
165
166             container dto_d {
167                 leaf simple-int1 {
168                     type uint32;
169                 }
170
171                 leaf simple-int2 {
172                     type uint32;
173                 }
174
175                 leaf simple-int3 {
176                     type uint16;
177                 }
178
179                 leaf-list simple-list {
180                     type uint16;
181                 }
182
183                 list complex-dto-bInner {
184                     leaf-list simple-list {
185                         type uint16;
186                     }
187                     leaf simple-int3 {
188                         type uint16;
189                     }
190
191                     container deep {
192                         leaf simple-int3 {
193                             type uint16;
194                         }
195                     }
196                 }
197             }
198
199             list complex-list {
200                 list simple-list {
201                     leaf simple-int3 {
202                         type uint16;
203                     }
204                 }
205             }
206
207             list peers {
208                     leaf port {
209                         type string;
210                     }
211                     leaf core-size {
212                         type uint32;
213                     }
214                     leaf simple-int3 {
215                         type uint16;
216                     }
217             }
218
219             container testing-dep {
220                 uses config:service-ref {
221                     refine type {
222                         mandatory true;
223                         config:required-identity test:testing;
224                     }
225                 }
226             }
227         }
228     }
229
230     augment "/config:modules/config:module/config:state" {
231         case impl-netconf {
232             when "/config:modules/config:module/config:type = 'impl-netconf'";
233             // rpc
234             rpcx:rpc-context-instance "test-rpc";
235
236             // root runtime bean
237             leaf created-sessions {
238                 type uint32;
239             }
240
241             container asdf {
242                 leaf simpleInt {
243                     type uint16;
244                 }
245
246                 leaf simpleString {
247                     type string;
248                 }
249             }
250
251
252             list inner-running-data-additional {
253                 config:inner-state-bean;
254
255                 // rpc
256                 rpcx:rpc-context-instance "inner-test-rpc";
257
258                 key "simpleString";
259
260                 leaf simple-int3 {
261                         type uint16;
262                 }
263
264                 leaf simpleString {
265                     type string;
266                 }
267
268                 container deep4 {
269                     leaf boool {
270                         type boolean;
271                     }
272                 }
273             }
274
275              list inner-running-data {
276                 config:inner-state-bean;
277
278                 key "simple-int3";
279
280                 leaf simple-int3 {
281                         type uint16;
282                     }
283
284                     container deep2 {
285                     leaf boool {
286                         type boolean;
287                     }
288                  }
289
290                 list inner-inner-running-data {
291                     config:inner-state-bean;
292
293                     rpcx:rpc-context-instance "inner-inner-test-rpc";
294
295                     key "simple-int3";
296
297                     leaf simple-int3 {
298                             type uint16;
299                     }
300
301                     list not-state-bean {
302                         leaf element {
303                             type string;
304                         }
305
306                         list not-state-bean-internal {
307                             // This should be ignored
308                             config:inner-state-bean;
309
310                             leaf element2 {
311                                 type string;
312                             }
313                         }
314                     }
315
316                     container deep3 {
317                         leaf boool {
318                             type boolean;
319                         }
320                     }
321                 }
322             }
323         }
324     }
325
326     identity test-rpc;
327     identity inner-test-rpc;
328     identity inner-inner-test-rpc;
329
330     rpc no-arg {
331         input {
332             uses rpcx:rpc-context-ref {
333                 refine context-instance {
334                     rpcx:rpc-context-instance test-rpc;
335                 }
336             }
337             leaf arg1 {
338                 type string;
339             }
340         }
341
342         output {
343             leaf result {
344                 type string;
345             }
346         }
347     }
348
349     rpc noArgInner {
350         input {
351             uses rpcx:rpc-context-ref {
352                 refine context-instance {
353                     rpcx:rpc-context-instance inner-test-rpc;
354                 }
355             }
356         }
357     }
358
359     rpc noArgInnerInner {
360         input {
361             uses rpcx:rpc-context-ref {
362                 refine context-instance {
363                     rpcx:rpc-context-instance inner-inner-test-rpc;
364                 }
365             }
366
367             leaf arg1 {
368                 type uint16;
369             }
370
371             leaf arg2 {
372                 type boolean;
373             }
374         }
375          output {
376             leaf result {
377                 type boolean;
378             }
379         }
380     }
381 }