Merge "Fixed deserialization of IdentityRefs in Restconf URI."
[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                     default 1;
52                 }
53
54                 leaf port {
55                     type inet:port-number;
56                     default 8080;
57                 }
58
59                 leaf ip4 {
60                     type inet:ipv4-address;
61                     default 127.0.0.1;
62                 }
63
64                 leaf ip {
65                     type inet:ip-address;
66                     // TODO defaults for union default 0:0:0:0:0:0:0:1;
67                 }
68             }
69
70             leaf as-number {
71                 type inet:as-number;
72                 default 44;
73             }
74
75
76             leaf simpleInt {
77                 type uint32;
78                 default 99;
79             }
80
81             container dto_b {
82                 leaf simple-int1 {
83                     type uint32;
84                     default 32;
85                 }
86
87                 leaf simple-int2 {
88                     type uint32;
89                 }
90             }
91
92         }
93     }
94
95     augment "/config:modules/config:module/config:state" {
96         case impl {
97             when "/config:modules/config:module/config:type = 'impl'";
98             // root runtime bean
99             leaf created-sessions {
100                 type uint32;
101             }
102         }
103     }
104
105     augment "/config:modules/config:module/config:configuration" {
106         case impl-dep {
107             when "/config:modules/config:module/config:type = 'impl-dep'";
108         }
109     }
110
111     augment "/config:modules/config:module/config:configuration" {
112         case impl-netconf {
113             when "/config:modules/config:module/config:type = 'impl-netconf'";
114             leaf binaryLeaf {
115                 type binary;
116                 default ZGVmYXVsdEJpbg==;
117             }
118
119             leaf type {
120                 type string;
121                 default "default-string";
122             }
123
124             leaf extended {
125                 type tt:extend-once;
126                 default 1;
127             }
128
129             leaf extended-twice {
130                 type tt:extend-twice;
131                 default 2;
132             }
133
134             leaf extended-enum {
135                 type tt:extend-enum;
136                 default ONE;
137             }
138
139             leaf sleep-factor {
140                 type decimal64 {
141                     fraction-digits 2;
142                 }
143                 default 2.00;
144             }
145
146            container dto-c {
147                 leaf simple-arg {
148                     type uint32;
149                 }
150
151                 container dto-a-inner {
152                     leaf simple-arg {
153                         type uint32;
154                     }
155
156                     container dto-a-inner-inner {
157                         leaf simple-arg {
158                             type uint32;
159                         }
160                     }
161                 }
162             }
163
164             leaf simpleInt {
165                 type uint32;
166             }
167
168             leaf simpleBoolean {
169                 type boolean;
170                 default false;
171             }
172
173             leaf simple-long {
174                 type int64;
175                 default -45;
176             }
177
178             leaf simple-long-2 {
179                 type uint32;
180                 default 445;
181             }
182
183             leaf simple-BigInteger {
184                 type uint64;
185                 default 545454;
186             }
187
188             leaf simple-byte {
189                 type int8;
190                 default -4;
191             }
192
193             leaf simple-short {
194                 type uint8;
195                 default 45;
196             }
197
198             leaf simple-test {
199                 type uint16;
200                 default 99;
201             }
202
203             leaf-list simple-list {
204                 type uint16;
205             }
206
207             container dto_d {
208                 leaf simple-int1 {
209                     type uint32;
210                 }
211
212                 leaf simple-int2 {
213                     type uint32;
214                 }
215
216                 leaf simple-int3 {
217                     type uint16;
218                 }
219
220                 leaf-list simple-list {
221                     type uint16;
222                 }
223
224                 list complex-dto-bInner {
225                     leaf-list simple-list {
226                         type uint16;
227                     }
228                     leaf simple-int3 {
229                         type uint16;
230                     }
231
232                     container deep {
233                         leaf simple-int3 {
234                             type uint16;
235                             default 0;
236                         }
237                     }
238                 }
239             }
240
241             list complex-list {
242                 list simple-list {
243                     leaf simple-int3 {
244                         type uint16;
245                     }
246                 }
247             }
248
249             list peers {
250                     leaf port {
251                         type string;
252                     }
253                     leaf core-size {
254                         type uint32;
255                     }
256                     leaf simple-int3 {
257                         type uint16;
258                     }
259             }
260
261             container testing-dep {
262                 uses config:service-ref {
263                     refine type {
264                         mandatory true;
265                         config:required-identity test:testing;
266                     }
267                 }
268             }
269
270             list testing-deps {
271                 uses config:service-ref {
272                     refine type {
273                         mandatory true;
274                         config:required-identity test:testing;
275                     }
276                 }
277             }
278         }
279     }
280
281     augment "/config:modules/config:module/config:state" {
282         case impl-netconf {
283             when "/config:modules/config:module/config:type = 'impl-netconf'";
284             // rpc
285             rpcx:rpc-context-instance "test-rpc";
286
287             // root runtime bean
288             leaf created-sessions {
289                 type uint32;
290             }
291
292             container asdf {
293                 leaf simpleInt {
294                     type uint16;
295                 }
296
297                 leaf simpleString {
298                     type string;
299                 }
300             }
301
302
303             list inner-running-data-additional {
304                 config:inner-state-bean;
305
306                 // rpc
307                 rpcx:rpc-context-instance "inner-test-rpc";
308
309                 key "simpleString";
310
311                 leaf simple-int3 {
312                         type uint16;
313                 }
314
315                 leaf simpleString {
316                     type string;
317                 }
318
319                 container deep4 {
320                     leaf boool {
321                         type boolean;
322                     }
323                 }
324             }
325
326              list inner-running-data {
327                 config:inner-state-bean;
328
329                 key "simple-int3";
330
331                 leaf simple-int3 {
332                         type uint16;
333                     }
334
335                     container deep2 {
336                     leaf boool {
337                         type boolean;
338                     }
339                  }
340
341                 list inner-inner-running-data {
342                     config:inner-state-bean;
343
344                     rpcx:rpc-context-instance "inner-inner-test-rpc";
345                     rpcx:rpc-context-instance "complex-output-rpc";
346
347                     key "simple-int3";
348
349                     leaf simple-int3 {
350                         type uint16;
351                     }
352
353                     leaf-list list-of-strings {
354                         type string;
355                     }
356
357                     list not-state-bean {
358                         leaf element {
359                             type string;
360                         }
361
362                         list not-state-bean-internal {
363                             // This should be ignored
364                             config:inner-state-bean;
365
366                             leaf element2 {
367                                 type string;
368                             }
369                         }
370                     }
371
372                     container deep3 {
373                         leaf boool {
374                             type boolean;
375                         }
376                     }
377                 }
378             }
379         }
380     }
381
382     identity test-rpc;
383     identity inner-test-rpc;
384     identity inner-inner-test-rpc;
385
386     identity complex-output-rpc;
387
388     rpc no-arg {
389         input {
390             uses rpcx:rpc-context-ref {
391                 refine context-instance {
392                     rpcx:rpc-context-instance test-rpc;
393                 }
394             }
395             leaf arg1 {
396                 type string;
397             }
398         }
399
400         output {
401             leaf result {
402                 type string;
403             }
404         }
405     }
406
407     rpc container-output {
408         input {
409             uses rpcx:rpc-context-ref {
410                 refine context-instance {
411                     rpcx:rpc-context-instance complex-output-rpc;
412                 }
413             }
414         }
415
416         output {
417             container retValContainer {
418                 leaf v1 {
419                     type string;
420                     default "from rpc";
421                 }
422
423                 leaf v2 {
424                     type uint32;
425                 }
426             }
427         }
428     }
429
430     rpc leaf-list-output {
431         input {
432             uses rpcx:rpc-context-ref {
433                 refine context-instance {
434                     rpcx:rpc-context-instance complex-output-rpc;
435                 }
436             }
437         }
438
439         output {
440             leaf-list result {
441                 type string;
442             }
443         }
444     }
445
446     rpc list-output {
447         input {
448             uses rpcx:rpc-context-ref {
449                 refine context-instance {
450                     rpcx:rpc-context-instance complex-output-rpc;
451                 }
452             }
453         }
454
455         output {
456             list ret-val-list {
457                 leaf v2 {
458                     type uint32;
459                 }
460
461                 leaf v1 {
462                     type boolean;
463                 }
464             }
465         }
466     }
467
468     rpc noArgInner {
469         input {
470             uses rpcx:rpc-context-ref {
471                 refine context-instance {
472                     rpcx:rpc-context-instance inner-test-rpc;
473                 }
474             }
475         }
476     }
477
478     rpc noArgInnerInner {
479         input {
480             uses rpcx:rpc-context-ref {
481                 refine context-instance {
482                     rpcx:rpc-context-instance inner-inner-test-rpc;
483                 }
484             }
485
486             leaf arg1 {
487                 type uint16;
488             }
489
490             leaf arg2 {
491                 type boolean;
492             }
493         }
494          output {
495             leaf result {
496                 type boolean;
497             }
498         }
499     }
500 }