Merge "Changed maximumEntries to correct int rather than long"
[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             leaf core-size {
196                 type uint32;
197             }
198
199             leaf keep-alive {
200                 type uint32;
201                 units seconds;
202                 default 10;
203             }
204
205             leaf maximum-size {
206                 type uint32;
207                 description "maximum-size description";
208             }
209
210             leaf binary {
211                 type binary;
212             }
213
214             container threadfactory {
215                 description "threadfactory description";
216                 uses config:service-ref {
217                     refine type {
218                         mandatory true;
219                         config:required-identity th2:threadfactory;
220                     }
221                 }
222             }
223
224             leaf-list users  {
225                 type string;
226             }
227
228              leaf-list users-numbers {
229                 type uint32;
230                 description "numbers of users description";
231             }
232         }
233     }
234
235     augment "/config:modules/config:module/config:state" {
236         case threadpool-dynamic {
237             when "/config:modules/config:module/config:type = 'threadpool-dynamic'";
238             // root runtime bean
239             leaf created-sessions {
240                 type uint32;
241             }
242         }
243     }
244
245     identity threadpool-registry-impl {
246         base config:module-type;
247         config:java-name-prefix ThreadPoolRegistryImpl;
248     }
249
250     augment "/config:modules/config:module/config:configuration" {
251         case threadpool-registry-impl {
252             when "/config:modules/config:module/config:type = 'threadpool-registry-impl'";
253
254             // list of dependencies:
255             list threadpools {
256                 uses config:service-ref {
257                     refine type {
258                         mandatory true;
259                         config:required-identity th2:threadpool;
260                     }
261                 }
262             }
263         }
264     }
265 }