Merge "Bug 1073: Introduced Transaction Chain to DOMStore APIs."
[controller.git] / opendaylight / config / yang-jmx-generator / src / test / resources / test-config-threads-java.yang
1 module config-threads-java {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:controller:config:threads:java";
4     prefix "th-java";
5
6     import config-threads { prefix th2; revision-date 2013-04-09; }
7     import config { prefix config; revision-date 2013-04-05; }
8     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
9
10     description
11         "This module contains the base YANG definitions for NS-OS
12          thread services pure Java implementation.";
13
14     revision "2013-04-05" {
15         description
16             "Updated to work with new anchors.";
17     }
18
19     revision "2013-04-03" {
20         description
21             "Initial revision";
22     }
23
24    identity thread-rpc-context;
25
26     identity eventbus {
27         base config:module-type;
28         config:provided-service "th2:eventbus";
29         config:java-name-prefix EventBus;
30     }
31
32     identity async-eventbus {
33         base config:module-type;
34         config:provided-service "th2:eventbus";
35         config:java-name-prefix AsyncEventBus;
36     }
37
38     identity threadfactory-naming {
39         base config:module-type;
40         config:provided-service "th2:threadfactory";
41         config:java-name-prefix NamingThreadFactory;
42     }
43
44     identity threadpool-dynamic {
45         base config:module-type;
46         description "threadpool-dynamic description";
47         config:provided-service "th2:threadpool";
48         config:provided-service "th2:scheduled-threadpool";
49         config:java-name-prefix DynamicThreadPool;
50     }
51
52     augment "/config:modules/config:module/config:configuration" {
53         case eventbus {
54             when "/config:modules/config:module/config:type = 'eventbus'";
55             // No real configuration
56         }
57     }
58
59     augment "/config:modules/config:module/config:configuration" {
60         case async-eventbus {
61             when "/config:modules/config:module/config:type = 'async-eventbus'";
62             container threadpool {
63                 uses config:service-ref {
64                     refine type {
65                         config:required-identity th2:threadpool;
66                     }
67                 }
68             }
69         }
70     }
71     augment "/config:modules/config:module/config:state" {
72         case async-eventbus {
73             when "/config:modules/config:module/config:type = 'async-eventbus'";
74             // simulate not having root runtime bean
75             list event {
76                 config:inner-state-bean;
77                 key "name";
78                 leaf name {
79                     type string;
80                 }
81             }
82         }
83     }
84
85     typedef thread-state {
86         type enumeration {
87             enum "STARTED";
88             enum "STOPPED";
89         }
90         description "Enum type holding state in which a thread can be.";
91     }
92
93     augment "/config:modules/config:module/config:configuration" {
94         case threadfactory-naming {
95             when "/config:modules/config:module/config:type = 'threadfactory-naming'";
96             leaf name-prefix {
97                 description "String that will be prefixed to each created thread. Suffix will be constructed from
98                     underscore (_) and auto-incremented index number.";
99                 type string;
100             }
101         }
102     }
103
104     augment "/config:modules/config:module/config:state" {
105         case threadfactory-naming {
106             when "/config:modules/config:module/config:type = 'threadfactory-naming'";
107             list thread {
108                 config:inner-state-bean;
109                 key "name";
110                 leaf name {
111                     type string;
112                 }
113                 // add rpc context
114                 rpcx:rpc-context-instance "thread-rpc-context";
115
116                 list stream {
117                     config:inner-state-bean;
118                     config:java-name-prefix ThreadStream;
119                     // no key – key will be generated by incrementing a counter
120                     leaf timestamp {
121                         type string;
122                     }
123                     leaf state {
124                         type thread-state;
125                     }
126
127                     container peer {
128                         leaf port {
129                             type uint32;
130                             default 179;
131                         }
132                         leaf core-size {
133                             type uint32;
134                         }
135                     }
136
137                     list inner-stream-list {
138                         leaf timestamp {
139                             type string;
140                         }
141                     }
142
143                 }
144             }
145
146             list stream {
147                 config:inner-state-bean;
148
149                 leaf timestamp {
150                     type string;
151                 }
152             }
153
154             // root runtime bean
155             leaf created-sessions {
156                 type uint32;
157             }
158         }
159     }
160
161
162     rpc dump-stack {
163         config:java-name-prefix dumpStack;
164         input {
165             uses rpcx:rpc-context-ref {
166                 refine context-instance {
167                     rpcx:rpc-context-instance thread-rpc-context;
168                 }
169             }
170         }
171     }
172
173     rpc sleep {
174         input {
175             uses rpcx:rpc-context-ref {
176                 refine context-instance {
177                     rpcx:rpc-context-instance thread-rpc-context;
178                 }
179             }
180             leaf millis {
181                 type uint32;
182             }
183         }
184         output {
185             leaf result {
186                 type thread-state;
187             }
188         }
189     }
190
191
192     augment "/config:modules/config:module/config:configuration" {
193         case threadpool-dynamic {
194             when "/config:modules/config:module/config:type = 'threadpool-dynamic'";
195             container threadpool-dynamic {
196                 leaf core-size {
197                     type uint32;
198                 }
199
200                 leaf keep-alive {
201                     type uint32;
202                     units seconds;
203                     default 10;
204                 }
205
206                 leaf maximum-size {
207                     type uint32;
208                     description "maximum-size description";
209                 }
210
211                 leaf binary {
212                     type binary;
213                 }
214
215                 container threadfactory {
216                     description "threadfactory description";
217                     uses config:service-ref {
218                         refine type {
219                             mandatory true;
220                             config:required-identity th2:threadfactory;
221                         }
222                     }
223                 }
224
225                 leaf-list users  {
226                     type string;
227                 }
228
229                  leaf-list users-numbers {
230                     type uint32;
231                     description "numbers of users description";
232                 }
233             }
234         }
235     }
236
237     augment "/config:modules/config:module/config:state" {
238         case threadpool-dynamic {
239             when "/config:modules/config:module/config:type = 'threadpool-dynamic'";
240             container threadpool-dynamic {
241                 // root runtime bean
242                 leaf created-sessions {
243                     type uint32;
244                 }
245             }
246         }
247     }
248
249     identity threadpool-registry-impl {
250         base config:module-type;
251         config:java-name-prefix ThreadPoolRegistryImpl;
252     }
253
254     augment "/config:modules/config:module/config:configuration" {
255         case threadpool-registry-impl {
256             when "/config:modules/config:module/config:type = 'threadpool-registry-impl'";
257
258             // list of dependencies:
259             list threadpools {
260                 uses config:service-ref {
261                     refine type {
262                         mandatory true;
263                         config:required-identity th2:threadpool;
264                     }
265                 }
266             }
267         }
268     }
269 }