Merge "Remove unnecessary declaration of <prerequisites> in features"
[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     import test-groups { prefix tg; revision-date 2014-12-08; }
12
13     description
14         "Testing IMPL";
15
16     revision "2013-04-03" {
17         description
18             "Initial revision";
19     }
20
21     identity impl {
22         base config:module-type;
23         config:provided-service test:testing;
24         config:java-name-prefix TestImpl;
25     }
26
27     identity impl-dep {
28         base config:module-type;
29         config:provided-service test:testing;
30         config:java-name-prefix DepTestImpl;
31     }
32
33     identity impl-netconf {
34         base config:module-type;
35         config:provided-service test:testing;
36         config:java-name-prefix NetconfTestImpl;
37     }
38
39     identity impl-identity-test {
40         base config:module-type;
41         config:provided-service test:testing;
42         config:java-name-prefix IdentityTest;
43     }
44
45     identity multiple-dependencies {
46         base config:module-type;
47         config:provided-service test:testing;
48         config:java-name-prefix MultipleDependencies;
49     }
50
51     augment "/config:modules/config:module/config:configuration" {
52             case impl-identity-test {
53                 when "/config:modules/config:module/config:type = 'impl-identity-test'";
54
55                 leaf afi {
56                     type identityref {
57                         base tt:test-identity1;
58                     }
59                 }
60
61                 container identities-container {
62                     leaf afi {
63                         type identityref {
64                             base tt:test-identity1;
65                         }
66                     }
67                 }
68
69                 list identities {
70                     leaf afi {
71                         type identityref {
72                             base tt:test-identity1;
73                         }
74                     }
75                     leaf safi {
76                         type identityref {
77                             base tt:test-identity1;
78                         }
79                     }
80
81                     container identities-inner {
82                         leaf afi {
83                             type identityref {
84                                 base tt:test-identity1;
85                             }
86                         }
87                     }
88                 }
89
90             }
91         }
92
93         augment "/config:modules/config:module/config:state" {
94             case impl-identity-test {
95                 when "/config:modules/config:module/config:type = 'impl-identity-test'";
96
97             }
98         }
99
100
101     augment "/config:modules/config:module/config:configuration" {
102         case impl {
103             when "/config:modules/config:module/config:type = 'impl'";
104
105            leaf-list allow-user  {
106                 type string;
107                 description "A list of user name patterns to allow";
108            }
109
110            container dto-a {
111                 leaf simple-arg {
112                     type uint32;
113                     default 1;
114                 }
115
116                 leaf port {
117                     type inet:port-number;
118                     default 8080;
119                 }
120
121                 leaf ip4 {
122                     type inet:ipv4-address;
123                     default 127.0.0.1;
124                 }
125
126             }
127
128             leaf as-number {
129                 type inet:as-number;
130                 default 44;
131             }
132
133
134             leaf simpleInt {
135                 type uint32;
136                 default 99;
137             }
138
139             container dto_b {
140                 leaf simple-int1 {
141                     type uint32;
142                     default 32;
143                 }
144
145                 leaf simple-int2 {
146                     type uint32;
147                 }
148             }
149
150         }
151     }
152
153     augment "/config:modules/config:module/config:state" {
154         case impl {
155             when "/config:modules/config:module/config:type = 'impl'";
156             // root runtime bean
157             leaf created-sessions {
158                 type uint32;
159             }
160         }
161     }
162
163     augment "/config:modules/config:module/config:configuration" {
164         case impl-dep {
165             when "/config:modules/config:module/config:type = 'impl-dep'";
166         }
167     }
168
169     augment "/config:modules/config:module/config:configuration" {
170         case impl-netconf {
171             when "/config:modules/config:module/config:type = 'impl-netconf'";
172             container impl-netconf {
173                 leaf binaryLeaf {
174                     type binary;
175                     default ZGVmYXVsdEJpbg==;
176                 }
177
178                 leaf type {
179                     type string;
180                     default "default-string";
181                 }
182
183                 leaf extended {
184                     type tt:extend-once;
185                     default 1;
186                 }
187
188                 leaf extended-twice {
189                     type tt:extend-twice;
190                     default 2;
191                 }
192
193                 leaf extended-enum {
194                     type tt:extend-enum;
195                     default ONE;
196                 }
197
198                 leaf ip {
199                     type inet:ip-address;
200                     default 0:0:0:0:0:0:0:1;
201                 }
202
203                 leaf union-test-attr {
204                     type tt:unionTest;
205                     default 456;
206                 }
207
208                 leaf sleep-factor {
209                     type decimal64 {
210                         fraction-digits 2;
211                     }
212                     default 2.00;
213                 }
214
215                container dto-c {
216                     leaf simple-arg {
217                         type uint32;
218                     }
219
220                     container dto-a-inner {
221                         leaf simple-arg {
222                             type uint32;
223                         }
224
225                         container dto-a-inner-inner {
226                             leaf simple-arg {
227                                 type uint32;
228                             }
229                         }
230                     }
231                 }
232
233                 leaf simpleInt {
234                     type uint32;
235                 }
236
237                 leaf simpleBoolean {
238                     type boolean;
239                     default false;
240                 }
241
242                 leaf simple-long {
243                     type int64;
244                     default -45;
245                 }
246
247                 leaf simple-long-2 {
248                     type uint32;
249                     default 445;
250                 }
251
252                 leaf simple-BigInteger {
253                     type uint64;
254                     default 545454;
255                 }
256
257                 leaf simple-byte {
258                     type int8;
259                     default -4;
260                 }
261
262                 leaf simple-short {
263                     type uint8;
264                     default 45;
265                 }
266
267                 leaf simple-test {
268                     type uint16;
269                     default 99;
270                 }
271
272                 leaf-list simple-list {
273                     type uint16;
274                 }
275
276                 container dto_d {
277                     leaf simple-int1 {
278                         type uint32;
279                     }
280
281                     leaf simple-int2 {
282                         type uint32;
283                     }
284
285                     leaf simple-int3 {
286                         type uint16;
287                     }
288
289                     leaf-list simple-list {
290                         type uint16;
291                     }
292
293                     list complex-dto-bInner {
294                         leaf-list simple-list {
295                             type uint16;
296                         }
297                         leaf simple-int3 {
298                             type uint16;
299                         }
300
301                         container deep {
302                             leaf simple-int3 {
303                                 type uint16;
304                                 default 0;
305                             }
306                         }
307                     }
308                 }
309
310                 list complex-list {
311                     list simple-list {
312                         leaf simple-int3 {
313                             type uint16;
314                         }
315                     }
316                 }
317
318                 list peers {
319                         leaf port {
320                             type string;
321                         }
322                         leaf core-size {
323                             type uint32;
324                         }
325                         leaf simple-int3 {
326                             type uint16;
327                         }
328                 }
329
330                 container testing-dep {
331                     uses config:service-ref {
332                         refine type {
333                             mandatory true;
334                             config:required-identity test:testing;
335                         }
336                     }
337                 }
338
339                 list testing-deps {
340                     uses config:service-ref {
341                         refine type {
342                             mandatory true;
343                             config:required-identity test:testing;
344                         }
345                     }
346                 }
347             }
348         }
349     }
350
351     grouping netconf-impl-rpc {
352        rpcx:rpc-context-instance netconf-impl-rpc-ctx;
353     }
354
355     identity netconf-impl-rpc-ctx;
356
357     rpc netconf-impl-rpc-from-grouping {
358         input {
359             uses rpcx:rpc-context-ref {
360                 refine context-instance {
361                     rpcx:rpc-context-instance "netconf-impl-rpc-ctx";
362                 }
363             }
364         }
365     }
366
367     augment "/config:modules/config:module/config:state" {
368         case impl-netconf {
369             when "/config:modules/config:module/config:type = 'impl-netconf'";
370             container impl-netconf {
371                 // rpc
372                 rpcx:rpc-context-instance "test-rpc";
373
374                 // add some stats + rpc from groupings outside this module
375                 uses tt:common-operational;
376                 uses tg:common-operational-rpc;
377                 uses netconf-impl-rpc;
378
379                 // root runtime bean
380                 leaf created-sessions {
381                     type uint32;
382                 }
383
384                 container asdf {
385                     leaf simpleInt {
386                         type uint16;
387                     }
388
389                     leaf simpleString {
390                         type string;
391                     }
392                 }
393
394
395                 list inner-running-data-additional {
396                     config:inner-state-bean;
397
398                     // rpc
399                     rpcx:rpc-context-instance "inner-test-rpc";
400
401                     key "simpleString";
402
403                     leaf simple-int3 {
404                             type uint16;
405                     }
406
407                     leaf simpleString {
408                         type string;
409                     }
410
411                     container deep4 {
412                         leaf boool {
413                             type boolean;
414                         }
415                     }
416                 }
417
418                  list inner-running-data {
419                     config:inner-state-bean;
420
421                     key "simple-int3";
422
423                     leaf simple-int3 {
424                             type uint16;
425                         }
426
427                         container deep2 {
428                         leaf boool {
429                             type boolean;
430                         }
431                      }
432
433                     list inner-inner-running-data {
434                         config:inner-state-bean;
435
436                         rpcx:rpc-context-instance "inner-inner-test-rpc";
437                         rpcx:rpc-context-instance "complex-output-rpc";
438
439                         key "simple-int3";
440
441                         leaf simple-int3 {
442                             type uint16;
443                         }
444
445                         leaf-list list-of-strings {
446                             type string;
447                         }
448
449                         list not-state-bean {
450                             leaf element {
451                                 type string;
452                             }
453
454                             list not-state-bean-internal {
455                                 // This should be ignored
456                                 config:inner-state-bean;
457
458                                 leaf element2 {
459                                     type string;
460                                 }
461                             }
462                         }
463
464                         container deep3 {
465                             leaf boool {
466                                 type boolean;
467                             }
468                         }
469                     }
470                 }
471
472             }
473
474         }
475     }
476
477
478     augment "/config:modules/config:module/config:configuration" {
479         case multiple-dependencies {
480             when "/config:modules/config:module/config:type = 'multiple-dependencies'";
481             container multiple-dependencies {
482                 list testing-deps {
483                     uses config:service-ref {
484                         refine type {
485                             mandatory true;
486                             config:required-identity test:testing;
487                         }
488                     }
489                 }
490                 container single {
491                         uses config:service-ref {
492                             refine type {
493                                 mandatory false;
494                                 config:required-identity test:testing;
495                             }
496                         }
497                 }
498
499                 leaf simple {
500                     type boolean;
501                     default false;
502                 }
503             }
504         }
505     }
506
507
508     identity test-rpc;
509     identity inner-test-rpc;
510     identity inner-inner-test-rpc;
511
512     identity complex-output-rpc;
513
514     rpc no-arg {
515         input {
516             uses rpcx:rpc-context-ref {
517                 refine context-instance {
518                     rpcx:rpc-context-instance test-rpc;
519                 }
520             }
521             leaf arg1 {
522                 type string;
523             }
524         }
525
526         output {
527             leaf result {
528                 type string;
529             }
530         }
531     }
532
533     rpc container-output {
534         input {
535             uses rpcx:rpc-context-ref {
536                 refine context-instance {
537                     rpcx:rpc-context-instance complex-output-rpc;
538                 }
539             }
540         }
541
542         output {
543             container retValContainer {
544                 leaf v1 {
545                     type string;
546                     default "from rpc";
547                 }
548
549                 leaf v2 {
550                     type uint32;
551                 }
552             }
553         }
554     }
555
556     rpc leaf-list-output {
557         input {
558             uses rpcx:rpc-context-ref {
559                 refine context-instance {
560                     rpcx:rpc-context-instance complex-output-rpc;
561                 }
562             }
563         }
564
565         output {
566             leaf-list result {
567                 type string;
568             }
569         }
570     }
571
572     rpc list-output {
573         input {
574             uses rpcx:rpc-context-ref {
575                 refine context-instance {
576                     rpcx:rpc-context-instance complex-output-rpc;
577                 }
578             }
579         }
580
581         output {
582             list ret-val-list {
583                 leaf v2 {
584                     type uint32;
585                 }
586
587                 leaf v1 {
588                     type boolean;
589                 }
590             }
591         }
592     }
593
594     rpc noArgInner {
595         input {
596             uses rpcx:rpc-context-ref {
597                 refine context-instance {
598                     rpcx:rpc-context-instance inner-test-rpc;
599                 }
600             }
601         }
602     }
603
604     rpc noArgInnerInner {
605         input {
606             uses rpcx:rpc-context-ref {
607                 refine context-instance {
608                     rpcx:rpc-context-instance inner-inner-test-rpc;
609                 }
610             }
611
612             leaf arg1 {
613                 type uint16;
614             }
615
616             leaf arg2 {
617                 type boolean;
618             }
619         }
620          output {
621             leaf result {
622                 type boolean;
623             }
624         }
625     }
626 }