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

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.