387f04271f3f070bcf40e4ecb37949283f74eefc
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / main / yang / nicira-action.yang
1 module nicira-action {
2     yang-version 1;
3
4     namespace "urn:opendaylight:openflowjava:nx:action";
5     prefix "nicira-action";
6
7     import openflow-action {prefix ofaction; revision-date "2015-02-03";}
8     import openflow-types {prefix oft;}
9     import yang-ext {prefix ext; revision-date "2013-07-09";}
10
11     description
12         "Nicira openflow extensions of action.";
13
14     revision "2014-04-21" {
15         description "Initial revision";
16     }
17
18     identity nxm-nx-reg-load {
19         base ofaction:experimenter-action-sub-type;
20     }
21     identity nxm-nx-reg-move {
22         base ofaction:experimenter-action-sub-type;
23     }
24     identity nxm-nx-output-reg {
25         base ofaction:experimenter-action-sub-type;
26     }
27     identity nxm-nx-resubmit {
28         base ofaction:experimenter-action-sub-type;
29     }
30     identity nxm-nx-multipath {
31         base ofaction:experimenter-action-sub-type;
32     }
33     identity nxm-nx-push-nsh {
34         base ofaction:experimenter-action-sub-type;
35     }
36     identity nxm-nx-pop-nsh {
37         base ofaction:experimenter-action-sub-type;
38     }
39     identity nxm-nx-conntrack {
40         base ofaction:experimenter-action-sub-type;
41     }
42     identity nxm-nx-learn {
43         base ofaction:experimenter-action-sub-type;
44     }
45
46     grouping ofj-nx-action-reg-load-grouping {
47         container nx-action-reg-load {
48             leaf ofs_nbits {
49                 type uint16;
50             }
51             leaf dst {
52                 type uint32;
53             }
54             leaf value {
55                 type uint64;
56             }
57             leaf experimenter-id {
58                 type oft:experimenter-id;
59             }
60         }
61     }
62     grouping ofj-nx-action-reg-move-grouping {
63         container nx-action-reg-move {
64                 leaf n_bits {
65                     type uint16;
66                 }
67                 leaf src_ofs {
68                     type uint16;
69                 }
70                 leaf dst_ofs {
71                     type uint16;
72                 }
73                 leaf src {
74                     type uint32;
75                 }
76                 leaf dst {
77                     type uint32;
78                 }
79                 leaf experimenter-id {
80                     type oft:experimenter-id;
81                 }
82         }
83     }
84     grouping ofj-nx-action-output-reg-grouping {
85         container nx-action-output-reg {
86             leaf n_bits {
87                 type uint16;
88             }
89             leaf src {
90                 type uint32;
91             }
92             leaf max_len {
93                 type uint16;
94             }
95             leaf experimenter-id {
96                 type oft:experimenter-id;
97             }
98         }
99     }
100
101     grouping ofj-nx-action-resubmit-grouping {
102         container nx-action-resubmit {
103             leaf in-port {
104                 type uint16;
105                 default 0xfff8; // OFPP_INPORT
106             }
107             leaf table {
108                 type uint8 {
109                     range "0 .. 255";
110                 }
111                 default 255; // Current Table
112             }
113             leaf experimenter-id {
114                 type oft:experimenter-id;
115             }
116         }
117     }
118
119     typedef ofj-nx-hash-fields {
120         type enumeration {
121             enum NX_HASH_FIELDS_ETH_SRC {
122                 value 0;
123                 description "eth src address only";
124             }
125             enum NX_HASH_FIELDS_SYMMETRIC_L4 {
126                 value 1;
127                 description "L2 through L4 fields";
128             }
129         }
130     }
131
132     typedef ofj-nx-mp-algorithm {
133         type enumeration {
134             enum NX_MP_ALG_MODULO_N {
135                 value 0;
136             }
137             enum NX_MP_ALG_HASH_THRESHOLD {
138                 value 1;
139             }
140             enum NX_MP_ALG_HRW {
141                 value 2;
142             }
143             enum NX_MP_ALG_ITER_HASH {
144                 value 3;
145             }
146         }
147     }
148
149     grouping ofj-nx-action-multipath-grouping {
150         container nx-action-multipath {
151             leaf fields {
152                 type ofj-nx-hash-fields;
153             }
154             leaf basis {
155                 type uint16;
156                 default 0x400;
157             }
158             leaf algorithm {
159                 type ofj-nx-mp-algorithm;
160             }
161             leaf max-link {
162                 type uint16;
163             }
164             leaf arg {
165                 type uint32;
166             }
167             leaf ofs-nbits {
168                 type uint16;
169             }
170             leaf dst {
171                 type uint32;
172             }
173             leaf experimenter-id {
174                 type oft:experimenter-id;
175             }
176         }
177     }
178
179     grouping ofj-nx-action-push-nsh-grouping {
180         container nx-action-push-nsh {
181             leaf experimenter-id {
182                 type oft:experimenter-id;
183             }
184         }
185     }
186     grouping ofj-nx-action-pop-nsh-grouping {
187         container nx-action-pop-nsh {
188             leaf experimenter-id {
189                 type oft:experimenter-id;
190             }
191         }
192     }
193
194     grouping ofj-nx-action-conntrack-grouping {
195         container nx-action-conntrack {
196             leaf flags {
197                 type uint16;
198             }
199             leaf zone-src {
200                 type uint32;
201             }
202             leaf conntrack-zone {
203                 type uint16;
204             }
205             leaf recirc-table {
206                 type uint8;
207             }
208             leaf experimenter-id {
209                 type oft:experimenter-id;
210             }
211         }
212     }
213
214     grouping flow-mod-spec {
215         description
216            "flow mod spec indicates the actions that should be performed to create a new flow which was learned from learn action.";
217         choice flow-mod-spec{
218             case flow-mod-add-match-from-field-case{
219                 container flow-mod-add-match-from-field{
220                         leaf flow-mod-num-bits{
221                         type uint16;
222                     }
223
224                     leaf src-field{
225                         type uint32;
226                     }
227
228                     leaf src-ofs{
229                         type uint16;
230                     }
231
232                     leaf dst-field{
233                         type uint32;
234                     }
235
236                     leaf dst-ofs{
237                         type uint16;
238                     }
239                 }
240             }
241             case flow-mod-add-match-from-field-case{
242                 container flow-mod-add-match-from-field{
243                         leaf flow-mod-num-bits{
244                         type uint16;
245                     }
246
247                     leaf src-field{
248                         type uint32;
249                     }
250
251                     leaf src-ofs{
252                         type uint16;
253                     }
254
255                     leaf dst-field{
256                         type uint32;
257                     }
258
259                     leaf dst-ofs{
260                         type uint16;
261                     }
262                 }
263             }
264             case flow-mod-add-match-from-value-case{
265                 container flow-mod-add-match-from-value{
266                         leaf flow-mod-num-bits{
267                         type uint16;
268                     }
269
270                     leaf value{
271                         type uint16;
272                     }
273
274                     leaf src-field{
275                         type uint32;
276                     }
277
278                     leaf src-ofs{
279                         type uint16;
280                     }
281                 }
282             }
283             case flow-mod-copy-field-into-field-case{
284                 container flow-mod-copy-field-into-field{
285                         leaf flow-mod-num-bits{
286                         type uint16;
287                     }
288
289                     leaf src-field{
290                         type uint32;
291                     }
292
293                     leaf src-ofs{
294                         type uint16;
295                     }
296
297                     leaf dst-field{
298                         type uint32;
299                     }
300
301                     leaf dst-ofs{
302                         type uint16;
303                     }
304                 }
305             }
306             case flow-mod-copy-value-into-field-case{
307                 container flow-mod-copy-value-into-field{
308                         leaf flow-mod-num-bits{
309                         type uint16;
310                     }
311
312                     leaf value{
313                         type uint16;
314                     }
315
316                     leaf dst-field{
317                         type uint32;
318                     }
319
320                     leaf dst-ofs{
321                         type uint16;
322                     }
323                 }
324             }
325             case flow-mod-output-to-port-case{
326                 container flow-mod-output-to-port{
327                         leaf flow-mod-num-bits{
328                         type uint16;
329                     }
330
331                     leaf src-field{
332                         type uint32;
333                     }
334
335                     leaf src-ofs{
336                         type uint16;
337                     }
338                 }
339             }
340         }
341     }
342
343     grouping ofj-nx-action-learn-grouping {
344         container nx-action-learn {
345             leaf idle-timeout {
346                 type uint16;
347             }
348             leaf hard-timeout {
349                 type uint16;
350             }
351             leaf priority {
352                 type uint16;
353             }
354             leaf cookie {
355                 type uint64;
356             }
357             leaf flags {
358                 type uint16;
359             }
360             leaf table-id {
361                 type uint8;
362             }
363             leaf fin-idle-timeout {
364                 type uint16;
365             }
366             leaf fin-hard-timeout {
367                 type uint16;
368             }
369
370             list flow-mods{
371                 uses flow-mod-spec;
372             }
373         }
374     }
375
376     augment "/ofaction:action-container/ofaction:action-choice" {
377         ext:augment-identifier "ofj-aug-nx-action";
378         case action-reg-load {
379             uses ofj-nx-action-reg-load-grouping;
380         }
381         case action-reg-move {
382             uses ofj-nx-action-reg-move-grouping;
383         }
384         case action-output-reg {
385             uses ofj-nx-action-output-reg-grouping;
386         }
387         case action-resubmit {
388             uses ofj-nx-action-resubmit-grouping;
389         }
390         case action-multipath {
391             uses ofj-nx-action-multipath-grouping;
392         }
393         case action-push-nsh {
394             uses ofj-nx-action-push-nsh-grouping;
395         }
396         case action-pop-nsh {
397             uses ofj-nx-action-pop-nsh-grouping;
398         }
399         case action-conntrack {
400             uses ofj-nx-action-conntrack-grouping;
401         }
402         case action-learn {
403             uses ofj-nx-action-learn-grouping;
404         }
405     }
406 }