Add support for encap/decap nicira actions
[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     import ietf-inet-types { prefix "inet"; revision-date "2013-07-15"; }
11
12     description
13         "Nicira openflow extensions of action.";
14
15     revision "2014-04-21" {
16         description "Initial revision";
17     }
18
19     identity nxm-nx-reg-load {
20         base ofaction:experimenter-action-sub-type;
21     }
22     identity nxm-nx-reg-move {
23         base ofaction:experimenter-action-sub-type;
24     }
25     identity nxm-nx-output-reg {
26         base ofaction:experimenter-action-sub-type;
27     }
28     identity nxm-nx-resubmit {
29         base ofaction:experimenter-action-sub-type;
30     }
31     identity nxm-nx-fin-timeout {
32         base ofaction:experimenter-action-sub-type;
33     }
34     identity nxm-nx-multipath {
35         base ofaction:experimenter-action-sub-type;
36     }
37     identity nxm-nx-push-nsh {
38         base ofaction:experimenter-action-sub-type;
39     }
40     identity nxm-nx-pop-nsh {
41         base ofaction:experimenter-action-sub-type;
42     }
43     identity nxm-nx-conntrack {
44         base ofaction:experimenter-action-sub-type;
45     }
46     identity nxm-nx-ct-clear {
47         base ofaction:experimenter-action-sub-type;
48     }
49     identity nxm-nx-learn {
50         base ofaction:experimenter-action-sub-type;
51     }
52     identity nxm-nx-encap {
53         base ofaction:experimenter-action-sub-type;
54     }
55     identity nxm-nx-decap {
56         base ofaction:experimenter-action-sub-type;
57     }
58
59     grouping ofj-nx-action-reg-load-grouping {
60         container nx-action-reg-load {
61             leaf ofs_nbits {
62                 type uint16;
63             }
64             leaf dst {
65                 type uint32;
66             }
67             leaf value {
68                 type uint64;
69             }
70             leaf experimenter-id {
71                 type oft:experimenter-id;
72             }
73         }
74     }
75     grouping ofj-nx-action-reg-move-grouping {
76         container nx-action-reg-move {
77                 leaf n_bits {
78                     type uint16;
79                 }
80                 leaf src_ofs {
81                     type uint16;
82                 }
83                 leaf dst_ofs {
84                     type uint16;
85                 }
86                 leaf src {
87                     type uint32;
88                 }
89                 leaf dst {
90                     type uint32;
91                 }
92                 leaf experimenter-id {
93                     type oft:experimenter-id;
94                 }
95         }
96     }
97     grouping ofj-nx-action-output-reg-grouping {
98         container nx-action-output-reg {
99             leaf n_bits {
100                 type uint16;
101             }
102             leaf src {
103                 type uint32;
104             }
105             leaf max_len {
106                 type uint16;
107             }
108             leaf experimenter-id {
109                 type oft:experimenter-id;
110             }
111         }
112     }
113
114     grouping ofj-nx-action-resubmit-grouping {
115         container nx-action-resubmit {
116             leaf in-port {
117                 type uint16;
118                 default 0xfff8; // OFPP_INPORT
119             }
120             leaf table {
121                 type uint8 {
122                     range "0 .. 255";
123                 }
124                 default 255; // Current Table
125             }
126             leaf experimenter-id {
127                 type oft:experimenter-id;
128             }
129         }
130     }
131
132     grouping ofj-nx-action-fin-timeout-grouping {
133         container nx-action-fin-timeout {
134             leaf fin-idle-timeout {
135                 type uint16;
136             }
137             leaf fin-hard-timeout  {
138                 type uint16;
139             }
140             leaf experimenter-id {
141                 type oft:experimenter-id;
142             }
143         }
144     }
145
146     typedef ofj-nx-hash-fields {
147         type enumeration {
148             enum NX_HASH_FIELDS_ETH_SRC {
149                 value 0;
150                 description "eth src address only";
151             }
152             enum NX_HASH_FIELDS_SYMMETRIC_L4 {
153                 value 1;
154                 description "L2 through L4 fields";
155             }
156         }
157     }
158
159     typedef ofj-nx-mp-algorithm {
160         type enumeration {
161             enum NX_MP_ALG_MODULO_N {
162                 value 0;
163             }
164             enum NX_MP_ALG_HASH_THRESHOLD {
165                 value 1;
166             }
167             enum NX_MP_ALG_HRW {
168                 value 2;
169             }
170             enum NX_MP_ALG_ITER_HASH {
171                 value 3;
172             }
173         }
174     }
175
176     typedef nx-action-nat-range-present {
177         type enumeration {
178             enum NX_NAT_RANGE_IPV4_MIN {
179                 value 1;
180                 description "IPV4 minimum value is present";
181             }
182             enum NX_NAT_RANGE_IPV4_MAX {
183                 value 2;
184                 description "IPV4 maximum value is present";
185             }
186             enum NX_NAT_RANGE_IPV6_MIN {
187                 value 4;
188                 description "IPV6 minimum value is present in range";
189             }
190             enum NX_NAT_RANGE_IPV6_MAX {
191                 value 8;
192                 description "IPV6 maximum value is present in range";
193             }
194             enum NX_NAT_RANGE_PROTO_MIN {
195                 value 16;
196                 description "Port minimum value is present in range";
197             }
198             enum NX_NAT_RANGE_PROTO_MAX {
199                 value 32;
200                 description "Port maximum value is present in range";
201             }
202         }
203     }
204
205     typedef nx-action-nat-flags {
206         type enumeration {
207             enum NX_NAT_F_SRC {
208                 value 1;
209                 description "Source nat is selected ,Mutually exclusive with NX_NAT_F_DST";
210             }
211             enum NX_NAT_F_DST {
212                 value 2;
213                 description "Destination nat is selected";
214             }
215             enum NX_NAT_F_PERSISTENT {
216                 value 4;
217                 description "Persistant flag is selected";
218             }
219             enum NX_NAT_F_PROTO_HASH {
220                 value 8;
221                 description "Hash mode is selected for port mapping, Mutually exclusive with PROTO_RANDOM ";
222             }
223             enum NX_NAT_F_PROTO_RANDOM {
224                 value 16;
225                 description "Port mapping will be randomized";
226             }
227         }
228     }
229
230     grouping ofj-nx-action-multipath-grouping {
231         container nx-action-multipath {
232             leaf fields {
233                 type ofj-nx-hash-fields;
234             }
235             leaf basis {
236                 type uint16;
237                 default 0x400;
238             }
239             leaf algorithm {
240                 type ofj-nx-mp-algorithm;
241             }
242             leaf max-link {
243                 type uint16;
244             }
245             leaf arg {
246                 type uint32;
247             }
248             leaf ofs-nbits {
249                 type uint16;
250             }
251             leaf dst {
252                 type uint32;
253             }
254             leaf experimenter-id {
255                 type oft:experimenter-id;
256             }
257         }
258     }
259
260     grouping ofj-nx-action-push-nsh-grouping {
261         container nx-action-push-nsh {
262             leaf experimenter-id {
263                 type oft:experimenter-id;
264             }
265         }
266     }
267     grouping ofj-nx-action-pop-nsh-grouping {
268         container nx-action-pop-nsh {
269             leaf experimenter-id {
270                 type oft:experimenter-id;
271             }
272         }
273     }
274
275     grouping ofj-nx-action-conntrack-grouping {
276         container nx-action-conntrack {
277             leaf flags {
278                 type uint16;
279             }
280             leaf zone-src {
281                 type uint32;
282             }
283             leaf conntrack-zone {
284                 type uint16;
285             }
286             leaf recirc-table {
287                 type uint8;
288             }
289             leaf experimenter-id {
290                 type oft:experimenter-id;
291             }
292             list ct-actions{
293                 uses ofpact-actions;
294             }
295         }
296     }
297
298     grouping ofj-nx-action-ct-clear-grouping {
299         container nx-action-ct-clear {
300             leaf experimenter-id {
301                 type oft:experimenter-id;
302             }
303         }
304     }
305
306     grouping ofpact-actions {
307         description
308            "Actions to be performed with conntrack.";
309         choice ofpact-actions {
310             case nx-action-nat-case {
311                 container nx-action-nat {
312                     leaf flags {
313                         type uint16;
314                     }
315                     leaf range_present {
316                         type uint16;
317                     }
318                     leaf ip-address-min {
319                         type inet:ip-address;
320                     }
321                     leaf ip-address-max {
322                         type inet:ip-address;
323                     }
324                     leaf port-min {
325                         type uint16;
326                     }
327                     leaf port-max {
328                         type uint16;
329                     }
330                 }
331             }
332             case nx-action-ct-mark-case {
333                 container nx-action-ct-mark {
334                     leaf ct-mark {
335                         type uint32;
336                     }
337                     // TODO: ct_mark mask is not supported yet
338                 }
339             }
340         }
341     }
342
343     grouping flow-mod-spec {
344         description
345            "flow mod spec indicates the actions that should be performed to create a new flow which was learned from learn action.";
346         choice flow-mod-spec{
347             case flow-mod-add-match-from-field-case{
348                 container flow-mod-add-match-from-field{
349                         leaf flow-mod-num-bits{
350                         type uint16;
351                     }
352
353                     leaf src-field{
354                         type uint32;
355                     }
356
357                     leaf src-ofs{
358                         type uint16;
359                     }
360
361                     leaf dst-field{
362                         type uint32;
363                     }
364
365                     leaf dst-ofs{
366                         type uint16;
367                     }
368                 }
369             }
370             case flow-mod-add-match-from-value-case{
371                 container flow-mod-add-match-from-value{
372                         leaf flow-mod-num-bits{
373                         type uint16;
374                     }
375
376                     leaf value{
377                         type uint16;
378                     }
379
380                     leaf src-field{
381                         type uint32;
382                     }
383
384                     leaf src-ofs{
385                         type uint16;
386                     }
387                 }
388             }
389             case flow-mod-copy-field-into-field-case{
390                 container flow-mod-copy-field-into-field{
391                         leaf flow-mod-num-bits{
392                         type uint16;
393                     }
394
395                     leaf src-field{
396                         type uint32;
397                     }
398
399                     leaf src-ofs{
400                         type uint16;
401                     }
402
403                     leaf dst-field{
404                         type uint32;
405                     }
406
407                     leaf dst-ofs{
408                         type uint16;
409                     }
410                 }
411             }
412             case flow-mod-copy-value-into-field-case{
413                 container flow-mod-copy-value-into-field{
414                         leaf flow-mod-num-bits{
415                         type uint16;
416                     }
417
418                     leaf value{
419                         type uint16;
420                     }
421
422                     leaf dst-field{
423                         type uint32;
424                     }
425
426                     leaf dst-ofs{
427                         type uint16;
428                     }
429                 }
430             }
431             case flow-mod-output-to-port-case{
432                 container flow-mod-output-to-port{
433                         leaf flow-mod-num-bits{
434                         type uint16;
435                     }
436
437                     leaf src-field{
438                         type uint32;
439                     }
440
441                     leaf src-ofs{
442                         type uint16;
443                     }
444                 }
445             }
446         }
447     }
448
449     grouping ofj-nx-action-learn-grouping {
450         container nx-action-learn {
451             leaf idle-timeout {
452                 type uint16;
453             }
454             leaf hard-timeout {
455                 type uint16;
456             }
457             leaf priority {
458                 type uint16;
459             }
460             leaf cookie {
461                 type uint64;
462             }
463             leaf flags {
464                 type uint16;
465             }
466             leaf table-id {
467                 type uint8;
468             }
469             leaf fin-idle-timeout {
470                 type uint16;
471             }
472             leaf fin-hard-timeout {
473                 type uint16;
474             }
475
476             list flow-mods{
477                 uses flow-mod-spec;
478             }
479         }
480     }
481
482     grouping ofj-nx-action-encap-grouping {
483         container nx-action-encap {
484             leaf packet-type {
485                 type uint32;
486             }
487             leaf experimenter-id {
488                 type oft:experimenter-id;
489             }
490         }
491     }
492
493     grouping ofj-nx-action-decap-grouping {
494         container nx-action-decap {
495             leaf packet-type {
496                 type uint32;
497             }
498             leaf experimenter-id {
499                 type oft:experimenter-id;
500             }
501         }
502     }
503
504     augment "/ofaction:action-container/ofaction:action-choice" {
505         ext:augment-identifier "ofj-aug-nx-action";
506         case action-reg-load {
507             uses ofj-nx-action-reg-load-grouping;
508         }
509         case action-reg-move {
510             uses ofj-nx-action-reg-move-grouping;
511         }
512         case action-output-reg {
513             uses ofj-nx-action-output-reg-grouping;
514         }
515         case action-resubmit {
516             uses ofj-nx-action-resubmit-grouping;
517         }
518         case action-fin-timeout {
519             uses ofj-nx-action-fin-timeout-grouping;
520         }
521         case action-multipath {
522             uses ofj-nx-action-multipath-grouping;
523         }
524         case action-push-nsh {
525             uses ofj-nx-action-push-nsh-grouping;
526         }
527         case action-pop-nsh {
528             uses ofj-nx-action-pop-nsh-grouping;
529         }
530         case action-conntrack {
531             uses ofj-nx-action-conntrack-grouping;
532         }
533         case action-ct-clear {
534             uses ofj-nx-action-ct-clear-grouping;
535         }
536         case action-learn {
537             uses ofj-nx-action-learn-grouping;
538         }
539         case action-encap {
540             uses ofj-nx-action-encap-grouping;
541         }
542         case action-decap {
543             uses ofj-nx-action-decap-grouping;
544         }
545     }
546 }