30500fdbb71c0858d500ad98c68bb36118907d70
[nemo.git] / nemo-api / src / main / yang / nemo-object.yang
1 /*\r
2  * Copyright (c) 2015  Huawei Technologies Co., Ltd. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 module nemo-object{\r
10         yang-version 1;         \r
11         namespace "urn:opendaylight:params:xml:ns:yang:nemo:object";    \r
12         prefix "nemo-object";\r
13         \r
14         import nemo-common {prefix nemo-common;}\r
15         \r
16         revision "2015-06-29" {\r
17         description\r
18             "Initial revision.";\r
19     }\r
20                 \r
21         grouping property-definition {  \r
22                 list property {\r
23             description "";\r
24             key "name";\r
25             leaf name {\r
26                 description "A user-visible name for the property";\r
27                 type nemo-common:property-name;\r
28                 mandatory true;\r
29             }\r
30             leaf value-type {\r
31                 description "The type of the property";\r
32                 default string;\r
33                 type enumeration {\r
34                     enum string {\r
35                         description "A string-valued property";\r
36                     }\r
37                     enum int {\r
38                         description "An integer-valued property";\r
39                     }\r
40                     enum range {\r
41                         description "An integer-range property";\r
42                     }\r
43                 }\r
44             }\r
45             leaf is-required {\r
46                 description "Specify whether the property is\r
47                              required for object.";\r
48                 default optional;\r
49                 type enumeration {\r
50                     enum required {\r
51                         description "The property is required";\r
52                     }\r
53                     enum optional {\r
54                         description "The property is optional";\r
55                     }\r
56                 }\r
57             }\r
58         }                               \r
59         }                               \r
60         container node-definitions{\r
61                 list node-definition{\r
62                         description "";\r
63                         key "id";\r
64                         leaf id {\r
65                                 description "A unique ID for a kind of node definition";\r
66                             type nemo-common:node-definition-id;\r
67                                 mandatory true;\r
68                     } \r
69                         leaf node-type{\r
70                                 description "A user-readable description";\r
71                                 type nemo-common:node-definition-type;\r
72                                 mandatory true;                                         \r
73                         }\r
74                         uses property-definition;                               \r
75                 }               \r
76         }               \r
77         container connection-definitions{\r
78                 list connection-definition{\r
79                         key "id";\r
80                         leaf id {\r
81                                 description "A unique ID for a kind of connection definition";\r
82                             type nemo-common:connection-definition-id;\r
83                                 mandatory true;\r
84                     } \r
85                         leaf connection-type{\r
86                                 description "A user-readable description";\r
87                                 type nemo-common:connection-definition-type;\r
88                                 mandatory true;                                         \r
89                         }\r
90                         uses property-definition;                       \r
91                 }       \r
92         }\r
93         \r
94         \r
95         grouping match-item-definition{\r
96         \r
97                 list match-item {\r
98             description "";\r
99             key "name";\r
100             leaf name {\r
101                 description "A user-visible name for the match-item";\r
102                 type nemo-common:match-item-name;\r
103                 mandatory true;\r
104             }\r
105             leaf value-type {\r
106                 description "The type of the match item";\r
107                 default string;\r
108                 type enumeration {\r
109                     enum string {\r
110                         description "A string-valued match item";\r
111                     }\r
112                     enum int {\r
113                         description "An integer-valued match item";\r
114                     }\r
115                     enum range {\r
116                         description "An integer-range match item";\r
117                     }\r
118                 }\r
119             }\r
120             leaf is-required {\r
121                 description "Specify whether the match item is required \r
122                                              for the flow.";\r
123                 default optional;\r
124                 type enumeration {\r
125                     enum required {\r
126                         description "The  match item is required";\r
127                     }\r
128                     enum optional {\r
129                         description "The  match item is optional";\r
130                     }\r
131                 }\r
132             }\r
133         }                               \r
134         }       \r
135     container flow-definitions{\r
136                 list flow-definition{\r
137                         key "id";\r
138                         leaf id {\r
139                                 description "A unique ID for a kind of flow definition";\r
140                             type nemo-common:flow-definition-id;\r
141                                 mandatory true;\r
142                     } \r
143                         leaf flow-type{\r
144                                 description "A user-readable description";\r
145                                 type nemo-common:flow-definition-type;\r
146                                 mandatory true;                                         \r
147                         }\r
148                         uses match-item-definition;                             \r
149                 }       \r
150         }\r
151         \r
152         grouping node-property-instance{\r
153                 list property {\r
154             key "name";\r
155             leaf name {\r
156                                 type nemo-common:node-property-name;\r
157                 mandatory true;\r
158             }\r
159             leaf string-value {\r
160                 type string;\r
161             }\r
162             leaf int-value {\r
163                 type int64;\r
164             }\r
165             container range-value {\r
166                 leaf min {\r
167                     type int64;\r
168                     mandatory true;\r
169                 }\r
170                 leaf max {\r
171                     type int64;\r
172                     mandatory true;\r
173                 }\r
174             }\r
175         }       \r
176         }                       \r
177         grouping node-instance{\r
178                 description "";\r
179                 leaf node-id {\r
180                         description "A unique ID for the node instance";\r
181                         type nemo-common:node-instance-id;\r
182                         mandatory true;\r
183                 }\r
184                 leaf node-name {\r
185                         description\r
186                                 "A user-visible name for the node definition";\r
187                         type nemo-common:node-instance-name;\r
188                 }\r
189                 leaf node-type {\r
190                         type nemo-common:node-instance-type;\r
191                         mandatory true;                 \r
192                 }\r
193                 container subnodes{                             \r
194                         leaf-list  subnode-id{\r
195                                 type nemo-common:node-instance-id;                              \r
196                         }                       \r
197                 }\r
198                 container property{\r
199                         uses node-property-instance;                    \r
200                 }               \r
201         }\r
202         \r
203         grouping connection-property-instance{\r
204                 list property {\r
205             key "name";\r
206             leaf name {\r
207                                 type nemo-common:connection-property-name;\r
208                 mandatory true;\r
209             }\r
210             leaf string-value {\r
211                 type string;\r
212             }\r
213             leaf int-value {\r
214                 type int64;\r
215             }\r
216             container range-value {\r
217                 leaf min {\r
218                     type int64;\r
219                     mandatory true;\r
220                 }\r
221                 leaf max {\r
222                     type int64;\r
223                     mandatory true;\r
224                 }\r
225             }\r
226         }       \r
227         }                       \r
228         grouping connection-instance {\r
229                 description "";\r
230                 leaf connection-id {\r
231                         description "A unique ID for the connection instance";\r
232                         type nemo-common:connection-instance-id;\r
233                         mandatory true;\r
234                 }\r
235                 leaf connection-name {\r
236                         description  "A user-visible name for the connection instance";\r
237                         type nemo-common:connection-instance-name;\r
238                         mandatory false;\r
239                 }\r
240                 leaf connection-type {\r
241                         type nemo-common:connection-instance-type;\r
242                         mandatory true;                 \r
243                 }\r
244                 container endnodes{\r
245                         list one-end{\r
246                                 key "node-id";\r
247                                 leaf node-id{\r
248                                         type nemo-common:node-instance-id;                                              \r
249                                 }\r
250                                 min-elements 1;\r
251                         }                       \r
252                         list the-other-end{\r
253                                 key "node-id";\r
254                                 leaf node-id{\r
255                                         type nemo-common:node-instance-id;\r
256                                 }\r
257                                 min-elements 1;                         \r
258                         }                       \r
259                 }\r
260                 container property{\r
261                         uses connection-property-instance;                      \r
262                 }                                       \r
263         }\r
264                 \r
265         grouping match-item-instance{\r
266                 list match-item {\r
267             key "name";\r
268             leaf name {\r
269                                 type string;\r
270                 mandatory true;\r
271             }\r
272             leaf string-value {\r
273                 type string;\r
274             }\r
275             leaf int-value {\r
276                 type int64;\r
277             }\r
278             container range-value {\r
279                 leaf min {\r
280                     type int64;\r
281                     mandatory true;\r
282                 }\r
283                 leaf max {\r
284                     type int64;\r
285                     mandatory true;\r
286                 }\r
287             }\r
288         }       \r
289         }\r
290         grouping has-direction {\r
291         description "Object that have a directionality.";       \r
292         leaf direction {\r
293             default bidirectional;\r
294             type enumeration {\r
295                 enum in {\r
296                     description\r
297                         "Applies to flow into provider node";\r
298                 }\r
299                 enum out {\r
300                     description\r
301                         "Applies to flow out of provider node";\r
302                 }\r
303                 enum bidirectional {\r
304                     description\r
305                         "Applies to flow in both directions";\r
306                 }\r
307             }\r
308         }\r
309     }   \r
310         grouping flow-instance{\r
311                 leaf flow-id {\r
312                         description "A unique ID for the flow instance";\r
313                         type nemo-common:flow-instance-id;\r
314                         mandatory true;\r
315                 }\r
316                 leaf flow-name {\r
317                         description "A user-visible name for the flow instance";\r
318                         type nemo-common:flow-instance-name;\r
319                         mandatory false;\r
320                 }\r
321                 leaf flow-type {\r
322                         type nemo-common:flow-instance-type;\r
323                         mandatory true;                 \r
324                 }\r
325                 container match {\r
326                         uses has-direction;\r
327                         uses match-item-instance;\r
328                 }\r
329         }       \r
330         \r
331 }\r