977aa6a87eb60c83ac1a2cb8a5a1b22e277f5c4b
[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     import test-types { prefix tt; revision-date 2013-11-27; }
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             leaf extended {
111                 type tt:extend-once;
112             }
113
114             leaf extended-twice {
115                 type tt:extend-twice;
116             }
117
118 /* TODO Add support for enums
119
120             leaf extended-enum {
121                 type tt:extend-enum;
122             }
123 */
124            container dto-c {
125                 leaf simple-arg {
126                     type uint32;
127                 }
128
129                 container dto-a-inner {
130                     leaf simple-arg {
131                         type uint32;
132                     }
133
134                     container dto-a-inner-inner {
135                         leaf simple-arg {
136                             type uint32;
137                         }
138                     }
139                 }
140             }
141
142             leaf simpleInt {
143                 type uint32;
144             }
145
146             leaf simpleBoolean {
147                 type boolean;
148                 default false;
149             }
150
151             leaf simple-long {
152                 type int64  ;
153             }
154
155             leaf simple-long-2 {
156                 type uint32;
157             }
158
159             leaf simple-BigInteger {
160                 type uint64;
161             }
162
163             leaf simple-byte {
164                 type int8;
165             }
166
167             leaf simple-short {
168                 type uint8;
169             }
170
171             leaf simple-test {
172                 type uint16;
173                 default 99;
174             }
175
176             leaf-list simple-list {
177                 type uint16;
178             }
179
180             container dto_d {
181                 leaf simple-int1 {
182                     type uint32;
183                 }
184
185                 leaf simple-int2 {
186                     type uint32;
187                 }
188
189                 leaf simple-int3 {
190                     type uint16;
191                 }
192
193                 leaf-list simple-list {
194                     type uint16;
195                 }
196
197                 list complex-dto-bInner {
198                     leaf-list simple-list {
199                         type uint16;
200                     }
201                     leaf simple-int3 {
202                         type uint16;
203                     }
204
205                     container deep {
206                         leaf simple-int3 {
207                             type uint16;
208                         }
209                     }
210                 }
211             }
212
213             list complex-list {
214                 list simple-list {
215                     leaf simple-int3 {
216                         type uint16;
217                     }
218                 }
219             }
220
221             list peers {
222                     leaf port {
223                         type string;
224                     }
225                     leaf core-size {
226                         type uint32;
227                     }
228                     leaf simple-int3 {
229                         type uint16;
230                     }
231             }
232
233             container testing-dep {
234                 uses config:service-ref {
235                     refine type {
236                         mandatory true;
237                         config:required-identity test:testing;
238                     }
239                 }
240             }
241         }
242     }
243
244     augment "/config:modules/config:module/config:state" {
245         case impl-netconf {
246             when "/config:modules/config:module/config:type = 'impl-netconf'";
247             // rpc
248             rpcx:rpc-context-instance "test-rpc";
249
250             // root runtime bean
251             leaf created-sessions {
252                 type uint32;
253             }
254
255             container asdf {
256                 leaf simpleInt {
257                     type uint16;
258                 }
259
260                 leaf simpleString {
261                     type string;
262                 }
263             }
264
265
266             list inner-running-data-additional {
267                 config:inner-state-bean;
268
269                 // rpc
270                 rpcx:rpc-context-instance "inner-test-rpc";
271
272                 key "simpleString";
273
274                 leaf simple-int3 {
275                         type uint16;
276                 }
277
278                 leaf simpleString {
279                     type string;
280                 }
281
282                 container deep4 {
283                     leaf boool {
284                         type boolean;
285                     }
286                 }
287             }
288
289              list inner-running-data {
290                 config:inner-state-bean;
291
292                 key "simple-int3";
293
294                 leaf simple-int3 {
295                         type uint16;
296                     }
297
298                     container deep2 {
299                     leaf boool {
300                         type boolean;
301                     }
302                  }
303
304                 list inner-inner-running-data {
305                     config:inner-state-bean;
306
307                     rpcx:rpc-context-instance "inner-inner-test-rpc";
308                     rpcx:rpc-context-instance "complex-output-rpc";
309
310                     key "simple-int3";
311
312                     leaf simple-int3 {
313                         type uint16;
314                     }
315
316                     leaf-list list-of-strings {
317                         type string;
318                     }
319
320                     list not-state-bean {
321                         leaf element {
322                             type string;
323                         }
324
325                         list not-state-bean-internal {
326                             // This should be ignored
327                             config:inner-state-bean;
328
329                             leaf element2 {
330                                 type string;
331                             }
332                         }
333                     }
334
335                     container deep3 {
336                         leaf boool {
337                             type boolean;
338                         }
339                     }
340                 }
341             }
342         }
343     }
344
345     identity test-rpc;
346     identity inner-test-rpc;
347     identity inner-inner-test-rpc;
348
349     identity complex-output-rpc;
350
351     rpc no-arg {
352         input {
353             uses rpcx:rpc-context-ref {
354                 refine context-instance {
355                     rpcx:rpc-context-instance test-rpc;
356                 }
357             }
358             leaf arg1 {
359                 type string;
360             }
361         }
362
363         output {
364             leaf result {
365                 type string;
366             }
367         }
368     }
369
370     rpc container-output {
371         input {
372             uses rpcx:rpc-context-ref {
373                 refine context-instance {
374                     rpcx:rpc-context-instance complex-output-rpc;
375                 }
376             }
377         }
378
379         output {
380             container retValContainer {
381                 leaf v1 {
382                     type string;
383                 }
384
385                 leaf v2 {
386                     type uint32;
387                 }
388             }
389         }
390     }
391
392     rpc leaf-list-output {
393         input {
394             uses rpcx:rpc-context-ref {
395                 refine context-instance {
396                     rpcx:rpc-context-instance complex-output-rpc;
397                 }
398             }
399         }
400
401         output {
402             leaf-list result {
403                 type string;
404             }
405         }
406     }
407
408     rpc list-output {
409         input {
410             uses rpcx:rpc-context-ref {
411                 refine context-instance {
412                     rpcx:rpc-context-instance complex-output-rpc;
413                 }
414             }
415         }
416
417         output {
418             list ret-val-list {
419                 leaf v2 {
420                     type uint32;
421                 }
422
423                 leaf v1 {
424                     type boolean;
425                 }
426             }
427         }
428     }
429
430     rpc noArgInner {
431         input {
432             uses rpcx:rpc-context-ref {
433                 refine context-instance {
434                     rpcx:rpc-context-instance inner-test-rpc;
435                 }
436             }
437         }
438     }
439
440     rpc noArgInnerInner {
441         input {
442             uses rpcx:rpc-context-ref {
443                 refine context-instance {
444                     rpcx:rpc-context-instance inner-inner-test-rpc;
445                 }
446             }
447
448             leaf arg1 {
449                 type uint16;
450             }
451
452             leaf arg2 {
453                 type boolean;
454             }
455         }
456          output {
457             leaf result {
458                 type boolean;
459             }
460         }
461     }
462 }