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