BUG-2453 Enable nested enums in configuration
[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
173             container impl-netconf {
174
175                 uses tg:config-grouping;
176
177                 leaf binaryLeaf {
178                     type binary;
179                     default ZGVmYXVsdEJpbg==;
180                 }
181
182                 leaf type {
183                     type string;
184                     default "default-string";
185                 }
186
187                 leaf extended {
188                     type tt:extend-once;
189                     default 1;
190                 }
191
192                 leaf extended-twice {
193                     type tt:extend-twice;
194                     default 2;
195                 }
196
197                 leaf extended-enum {
198                     type tt:extend-enum;
199                     default one;
200                 }
201
202                 leaf ip {
203                     type inet:ip-address;
204                     default 0:0:0:0:0:0:0:1;
205                 }
206
207                 leaf union-test-attr {
208                     type tt:unionTest;
209                     default 456;
210                 }
211
212                 leaf sleep-factor {
213                     type decimal64 {
214                         fraction-digits 2;
215                     }
216                     default 2.00;
217                 }
218
219                container dto-c {
220                     leaf simple-arg {
221                         type uint32;
222                     }
223
224                     container dto-a-inner {
225                         leaf simple-arg {
226                             type uint32;
227                         }
228
229                         container dto-a-inner-inner {
230                             leaf simple-arg {
231                                 type uint32;
232                             }
233                         }
234                     }
235                 }
236
237                 leaf simpleInt {
238                     type uint32;
239                 }
240
241                 leaf simpleBoolean {
242                     type boolean;
243                     default false;
244                 }
245
246                 leaf simple-long {
247                     type int64;
248                     default -45;
249                 }
250
251                 leaf simple-long-2 {
252                     type uint32;
253                     default 445;
254                 }
255
256                 leaf simple-BigInteger {
257                     type uint64;
258                     default 545454;
259                 }
260
261                 leaf simple-byte {
262                     type int8;
263                     default -4;
264                 }
265
266                 leaf simple-short {
267                     type uint8;
268                     default 45;
269                 }
270
271                 leaf simple-test {
272                     type uint16;
273                     default 99;
274                 }
275
276                 leaf-list simple-list {
277                     type uint16;
278                 }
279
280                 container dto_d {
281                     leaf simple-int1 {
282                         type uint32;
283                     }
284
285                     leaf simple-int2 {
286                         type uint32;
287                     }
288
289                     leaf simple-int3 {
290                         type uint16;
291                     }
292
293                     leaf-list simple-list {
294                         type uint16;
295                     }
296
297                     list complex-dto-bInner {
298                         leaf-list simple-list {
299                             type uint16;
300                         }
301                         leaf simple-int3 {
302                             type uint16;
303                         }
304
305                         container deep {
306                             leaf simple-int3 {
307                                 type uint16;
308                                 default 0;
309                             }
310                         }
311                     }
312                 }
313
314                 list complex-list {
315                     list simple-list {
316                         leaf simple-int3 {
317                             type uint16;
318                         }
319                     }
320                 }
321
322                 list peers {
323                         leaf port {
324                             type string;
325                         }
326                         leaf core-size {
327                             type uint32;
328                         }
329                         leaf simple-int3 {
330                             type uint16;
331                         }
332                 }
333
334                 container testing-dep {
335                     uses config:service-ref {
336                         refine type {
337                             mandatory true;
338                             config:required-identity test:testing;
339                         }
340                     }
341                 }
342
343                 list testing-deps {
344                     uses config:service-ref {
345                         refine type {
346                             mandatory true;
347                             config:required-identity test:testing;
348                         }
349                     }
350                 }
351             }
352         }
353     }
354
355     grouping netconf-impl-rpc {
356        rpcx:rpc-context-instance netconf-impl-rpc-ctx;
357     }
358
359     identity netconf-impl-rpc-ctx;
360
361     rpc netconf-impl-rpc-from-grouping {
362         input {
363             uses rpcx:rpc-context-ref {
364                 refine context-instance {
365                     rpcx:rpc-context-instance "netconf-impl-rpc-ctx";
366                 }
367             }
368         }
369     }
370
371     augment "/config:modules/config:module/config:state" {
372         case impl-netconf {
373             when "/config:modules/config:module/config:type = 'impl-netconf'";
374             container impl-netconf {
375                 // rpc
376                 rpcx:rpc-context-instance "test-rpc";
377
378                 // add some stats + rpc from groupings outside this module
379                 uses tt:common-operational;
380                 uses tg:common-operational-rpc;
381                 uses netconf-impl-rpc;
382
383                 // root runtime bean
384                 leaf created-sessions {
385                     type uint32;
386                 }
387
388                 container asdf {
389                     leaf simpleInt {
390                         type uint16;
391                     }
392
393                     leaf simpleString {
394                         type string;
395                     }
396                 }
397
398
399                 list inner-running-data-additional {
400                     config:inner-state-bean;
401
402                     // rpc
403                     rpcx:rpc-context-instance "inner-test-rpc";
404
405                     key "simpleString";
406
407                     leaf simple-int3 {
408                             type uint16;
409                     }
410
411                     leaf simpleString {
412                         type string;
413                     }
414
415                     container deep4 {
416                         leaf boool {
417                             type boolean;
418                         }
419                     }
420                 }
421
422                  list inner-running-data {
423                     config:inner-state-bean;
424
425                     key "simple-int3";
426
427                     leaf simple-int3 {
428                             type uint16;
429                         }
430
431                         container deep2 {
432                         leaf boool {
433                             type boolean;
434                         }
435                      }
436
437                     list inner-inner-running-data {
438                         config:inner-state-bean;
439
440                         rpcx:rpc-context-instance "inner-inner-test-rpc";
441                         rpcx:rpc-context-instance "complex-output-rpc";
442
443                         key "simple-int3";
444
445                         leaf simple-int3 {
446                             type uint16;
447                         }
448
449                         leaf-list list-of-strings {
450                             type string;
451                         }
452
453                         list not-state-bean {
454                             leaf element {
455                                 type string;
456                             }
457
458                             list not-state-bean-internal {
459                                 // This should be ignored
460                                 config:inner-state-bean;
461
462                                 leaf element2 {
463                                     type string;
464                                 }
465                             }
466                         }
467
468                         container deep3 {
469                             leaf boool {
470                                 type boolean;
471                             }
472                         }
473                     }
474                 }
475
476             }
477
478         }
479     }
480
481
482     augment "/config:modules/config:module/config:configuration" {
483         case multiple-dependencies {
484             when "/config:modules/config:module/config:type = 'multiple-dependencies'";
485             container multiple-dependencies {
486                 list testing-deps {
487                     uses config:service-ref {
488                         refine type {
489                             mandatory true;
490                             config:required-identity test:testing;
491                         }
492                     }
493                 }
494                 container single {
495                         uses config:service-ref {
496                             refine type {
497                                 mandatory false;
498                                 config:required-identity test:testing;
499                             }
500                         }
501                 }
502
503                 leaf simple {
504                     type boolean;
505                     default false;
506                 }
507             }
508         }
509     }
510
511
512     identity test-rpc;
513     identity inner-test-rpc;
514     identity inner-inner-test-rpc;
515
516     identity complex-output-rpc;
517
518     rpc no-arg {
519         input {
520             uses rpcx:rpc-context-ref {
521                 refine context-instance {
522                     rpcx:rpc-context-instance test-rpc;
523                 }
524             }
525             leaf arg1 {
526                 type string;
527             }
528         }
529
530         output {
531             leaf result {
532                 type string;
533             }
534         }
535     }
536
537     rpc container-output {
538         input {
539             uses rpcx:rpc-context-ref {
540                 refine context-instance {
541                     rpcx:rpc-context-instance complex-output-rpc;
542                 }
543             }
544         }
545
546         output {
547             container retValContainer {
548                 leaf v1 {
549                     type string;
550                     default "from rpc";
551                 }
552
553                 leaf v2 {
554                     type uint32;
555                 }
556             }
557         }
558     }
559
560     rpc leaf-list-output {
561         input {
562             uses rpcx:rpc-context-ref {
563                 refine context-instance {
564                     rpcx:rpc-context-instance complex-output-rpc;
565                 }
566             }
567         }
568
569         output {
570             leaf-list result {
571                 type string;
572             }
573         }
574     }
575
576     rpc list-output {
577         input {
578             uses rpcx:rpc-context-ref {
579                 refine context-instance {
580                     rpcx:rpc-context-instance complex-output-rpc;
581                 }
582             }
583         }
584
585         output {
586             list ret-val-list {
587                 leaf v2 {
588                     type uint32;
589                 }
590
591                 leaf v1 {
592                     type boolean;
593                 }
594             }
595         }
596     }
597
598     rpc noArgInner {
599         input {
600             uses rpcx:rpc-context-ref {
601                 refine context-instance {
602                     rpcx:rpc-context-instance inner-test-rpc;
603                 }
604             }
605         }
606     }
607
608     rpc noArgInnerInner {
609         input {
610             uses rpcx:rpc-context-ref {
611                 refine context-instance {
612                     rpcx:rpc-context-instance inner-inner-test-rpc;
613                 }
614             }
615
616             leaf arg1 {
617                 type uint16;
618             }
619
620             leaf arg2 {
621                 type boolean;
622             }
623         }
624          output {
625             leaf result {
626                 type boolean;
627             }
628         }
629     }
630 }