Removed unused groupings in YANG files
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-types.yang
1 module openflow-types {
2     namespace "urn:opendaylight:openflow:common:types";
3     prefix "oft";
4
5     revision "2013-07-31" {
6         //description "OpenFlow 1.3 - common types model";
7     }
8
9     typedef port-number {
10         type uint32 {
11                 range "0..4294967040"; // 0xffffff00 See for actual value
12         }
13     }
14
15     typedef special-port-number {
16         type enumeration {
17             enum in-port { 
18                 //value "4294967288";
19                 //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
20             }
21             enum table { 
22                 //value "4294967289"; // 0xfffffff9;
23                 //description "Perform actions in flow table. NB: This can only be the destination port for packet-out messages."
24             }
25             enum normal { 
26                 //value "4294967290"; // 0xfffffffa;
27                 //description "Process with normal L2/L3 switching."
28             }
29             enum flood { 
30                 //value "4294967291"; // 0xfffffffb;
31                 //description "All physical ports except input port and those disabled by STP."
32             }
33             enum all { 
34                 //value "4294967292"; // 0xfffffffc;
35                 //description "All physical ports except input port."
36             }
37             enum controller { 
38                 //value "4294967293";  // 0xfffffffd;
39                 //description "Send to controller."
40             }
41             enum local { 
42                 //value "4294967294"; // 0xfffffffe;
43                 //description "Local openflow port."
44             }
45             enum none { 
46                 //value "4294967295"; // 0xffffffff;
47                 //description "not associated with a physical port."
48             }
49         }
50     }
51
52     typedef any-port-number {
53         type union {
54             type port-number;
55             type special-port-number;
56         }
57     }
58
59     typedef port-features {
60         ////description "Features of ports available in datapath.";
61         //reference "ofp_port_features";
62         type bits {
63             bit 10mb_hd { 
64                 position 0;
65                 //description "10 Mb half-duplex rate support.";
66             }
67             bit 10mb-fd { 
68                 position 1;
69                 //description "10 Mb full-duplex rate support.";
70             }
71             bit 100mb-hd { 
72                 position 2;
73                 //description "100 Mb half-duplex rate support.";
74             }
75             bit 100mb-fd { 
76                 position 3;
77                 //description "100 Mb full-duplex rate support.";
78             }
79             bit 1gb-hd { 
80                 position 4;
81                 //description "1 Gb half-duplex rate support.";
82             }
83             bit 1gb-fd { 
84                 position 5;
85                 //description "1 Gb full-duplex rate support.";
86             }
87             bit 10gb-fd { 
88                 position 6;
89                 //description "10 Gb full-duplex rate support.";
90             }
91             bit 40gb-fd { 
92                 position 7;
93                 //description "40 Gb full-duplex rate support.";
94             }
95             bit 100gb-fd { 
96                 position 8;
97                 //description "100 Gb full-duplex rate support.";
98             }
99             bit 1tb-fd { 
100                 position 9;
101                 //description "1 Tb full-duplex rate support.";
102             }
103             bit other { 
104                 position 10;
105                 //description "Other rate, not in the list.";
106             }
107             bit copper { 
108                 position 11;
109                 //description "Copper medium.";
110             }
111             bit fiber { 
112                 position 12;
113                 //description "Fiber medium.";
114             }
115             bit autoneg { 
116                 position 13;
117                 //description "Auto-negotiation.";
118             }
119             bit pause { 
120                 position 14;
121                 //description "Pause.";
122             }
123             bit pause-asym { 
124                 position 15;
125                 //description "Asymmetric pause.";
126             }
127         }
128     }
129
130     typedef port-config {
131         description 
132            "Flags to indicate behavior of the physical port. These flags are
133             describe the current configuration and used port_mod message 
134             to configure the port's behavior.";
135         type bits {
136             bit port-down { 
137                 //description " Port is administratively down.";
138                 position 0;
139             }
140             bit no-recv { 
141                 //description " Drop all packets received by port.";
142                 position 2;
143             }
144             bit no-fwd { 
145                 //description " Drop packets forwarded to port.";
146                 position 5;
147             }
148             bit no-packet-in { 
149                 //description "Do not send packet-in msgs for port.";
150                 position 6;
151             }
152         }
153     }
154
155     typedef port-state {
156         description 
157             "Current state of the physical port. These are not configurable from
158             the controller.";
159         type bits {
160             bit link_down {
161                 //description "No physical link present.";
162                 position 0;
163             }
164             bit blocked {
165                 //description "Port is blocked";
166                 position 1;
167             }
168             bit live {
169                 //description "Live for Fast Failover Group.";
170                 position 2;
171             }
172         }
173     }
174
175     identity match-type-base {
176         description 
177            "The match type indicates the match structure (set of fields that compose the
178             match) in use. The match type is placed in the type field at the beginning
179             of all match structures.Extensions that define match types may be 
180             published on the ONF wiki. Support for extensions is optional.";
181     }
182
183     identity standard-match-type {
184         deprecated true;
185         base oft:match-type-base;
186     }
187
188     typedef match-type {
189         //type identityref {
190         //    base oft:match-type-base;
191         //}
192         
193         //TODO: use identityref, when generating available
194         type string;
195     }
196
197     identity instruction {
198     }
199
200     identity action {
201     }
202
203
204     typedef metadata {
205         type binary;
206     }
207
208     typedef table-id {
209         type uint32;
210     }
211     typedef meter-id {
212         type uint32;
213     }
214     typedef queue-id {
215         type uint32;
216     }
217     typedef group-id {
218         type uint32;
219     }
220
221     typedef ether-type {
222         type uint16;
223     }
224
225     typedef error-type {
226         type enumeration {
227             enum HELLO_FAILED {
228                 value 0; 
229                 description "Hello Protocol failed.";
230             }
231             enum BAD_REQUEST {
232                 value 1; 
233                 description "Request was not understood.";
234             }
235             enum BAD_ACTION {
236                 value 2; 
237                 description "Error in action description.";
238             }
239             enum BAD_INSTRUCTION {
240                 value 3; 
241                 description "Error in instruction list.";
242             }
243             enum BAD_MATCH {
244                 value 4; 
245                 description "Error in match.";
246             }
247             enum FLOW_MOD_FAILED {
248                 value 5; 
249                 description "Problem modifying flow entry.";
250             }
251             enum GROUP_MOD_FAILED {
252                 value 6; 
253                 description "Problem modifying group entry.";
254             }
255             enum PORT_MOD_FAILED {
256                 value 7; 
257                 description "Port mod request failed.";
258             }
259             enum TABLE_MOD_FAILED {
260                 value 8; 
261                 description "Table mod request failed.";
262             }
263             enum QUEUE_OP_FAILED {
264                 value 9; 
265                 description "Queue operation failed.";
266             }
267             enum SWITCH_CONFIG_FAILED {
268                 value 10; 
269                 description "Switch config request failed.";
270             }
271             enum ROLE_REQUEST_FAILED {
272                 value 11; 
273                 description "Controller Role request failed.";
274             }
275             enum METER_MOD_FAILED {
276                 value 12; 
277                 description "Error in meter.";
278             }
279             enum TABLE_FEATURES_FAILED {
280                 value 13; 
281                 description "Setting table features failed.";
282             }
283             enum EXPERIMENTER {
284                 value 65535; //0xffff 
285                 description "Experimenter error messages.";
286             }
287         }
288     }
289
290     typedef hello-element-type {
291         type enumeration {
292             enum VERSIONBITMAP {
293                 value 1; 
294                 description "Bitmap of version supported.";
295             }
296         }
297     }
298
299     typedef switch-config-flag {
300         /* Handling of IP fragments. */
301         type enumeration {
302             enum FRAG_NORMAL {
303                 value 0; 
304                 description "No special handling for fragments.";
305             }
306             enum OFPC_FRAG_DROP {
307                 value 1; 
308                 description "Drop fragments.";
309             }
310             enum OFPC_FRAG_REASM {
311                 value 2; 
312                 description "Reassemble (only if OFPC_IP_REASM set).";
313             }
314             enum OFPC_FRAG_MASK {
315                 value 3; 
316             }
317         }
318     }
319
320     typedef flow-removed-reason {
321         /* flow removed */
322         type enumeration {
323             enum OFPRR_IDLE_TIMEOUT {
324                 value 0;
325                 description "Flow idle time exceeded idle_timeout.";
326             }
327             enum OFPRR_HARD_TIMEOUT {
328                 value 1;
329                 description "Time exceeded hard_timeout.";
330             }
331             enum OFPRR_DELETE {
332                 value 2;
333                 description "Evicted by a DELETE flow mod.";
334             }
335             enum OFPRR_GROUP_DELETE {
336                 value 3;
337                 description "Group was removed.";
338             }
339         }
340     }
341
342     typedef port-reason {
343         /* port status */
344         type enumeration {
345             enum OFPPR_ADD {
346                 value 0;
347                 description "The port was added.";
348             }
349             enum OFPPR_DELETE {
350                 value 1;
351                 description "he port was removed.";
352             }
353             enum OFPPR_MODIFY {
354                 value 2;
355                 description "Some attribute of the port has changed.";
356             }
357         }
358     }
359
360     typedef flow-mod-command {
361         /* ofp_flow_mod_command */
362         type enumeration {
363             enum OFPFC_ADD {      
364                 value 0;      
365                 description "New flow.";    
366             }
367             enum OFPFC_MODIFY {
368                 value 1;
369                 description "Modify all matching flows.";
370             }
371             enum OFPFC_MODIFY_STRICT {
372                 value 2;
373                 description "Modify entry strictly matching wildcards and priority.";
374             }
375             enum OFPFC_DELETE {
376                 value 3;
377                 description "Delete all matching flows.";
378             }
379             enum OFPFC_DELETE_STRICT {
380                 value 4;
381                 description "Delete entry strictly matching wildcards and priority.";
382             }
383         }
384     }
385
386     typedef flow-mod-flags {
387         /* ofp_flow_mod_flags */
388         type bits {
389             bit OFPFF_SEND_FLOW_REM {
390                 position 0;
391                 /* Send flow removed message when flow expires or is deleted. */
392             }
393             bit OFPFF_CHECK_OVERLAP {
394                 position 1;
395                 /* Check for overlapping entries first. */
396             }
397             bit OFPFF_RESET_COUNTS {
398                 position 2;
399                 /* Reset flow packet and byte counts. */
400             }
401             bit OFPFF_NO_PKT_COUNTS {
402                 position 3;
403                 /* Don't keep track of packet count. */
404             }
405             bit OFPFF_NO_BYT_COUNTS {
406                 position 4;
407                 /* Don't keep track of byte count. */
408             }
409         }
410     }
411
412     typedef group-mod-command {
413         /* ofp_group_mod_command */
414         type enumeration {
415             enum OFPGC_ADD {            
416               value 0;            
417               description "New group.";            
418             }
419             enum OFPGC_MODIFY {
420               value 1;
421               description "Modify all matching groups.";
422             }
423             enum OFPGC_DELETE {
424               value 2;
425               description "Delete all matching groups.";
426             }
427             
428         }
429     }
430
431     typedef group-type {
432         /* ofp_group_type */
433         type enumeration {
434             enum OFPGT_ALL {            
435               value 0;            
436               description "All (multicast/broadcast) group.";            
437             }
438             enum OFPGT_SELECT {
439               value 1;
440               description "Select group.";
441             }
442             enum OFPGT_INDIRECT {
443               value 2;
444               description "Indirect group.";
445             }
446             enum OFPGT_FF {
447               value 3;
448               description "Fast failover group.";
449             }
450         }
451     }
452
453     typedef multipart-request-flags {
454         description
455             "enum ofp_multipart_request_flags ";
456         type bits {
457             bit OFPMPF_REQ_MORE {
458                 //description "More requests to follow.";
459                 position 0;
460             }
461         }
462     }
463
464     typedef multipart-type {
465         /* ofp_multipart_type */
466         type enumeration {
467             enum OFPMP_DESC {
468               value 0;
469               description "Description of this OpenFlow switch.
470                  The request body is empty.
471                  The reply body is struct ofp_desc.";
472             }
473             enum OFPMP_FLOW {
474               value 1;
475               description "Individual flow statistics.
476                  The request body is struct ofp_flow_stats_request.
477                  The reply body is an array of struct ofp_flow_stats.";
478             }
479             enum OFPMP_AGGREGATE {
480               value 2;
481               description "Aggregate flow statistics.
482                  The request body is struct ofp_aggregate_stats_request.
483                  The reply body is struct ofp_aggregate_stats_reply.";
484             }
485             enum OFPMP_TABLE {
486               value 3;
487               description "Flow table statistics.
488                  The request body is empty.
489                  The reply body is an array of struct ofp_table_stats.";
490             }
491             enum OFPMP_PORT_STATS {
492               value 4;
493               description "Port statistics.
494                  The request body is struct ofp_port_stats_request.
495                  The reply body is an array of struct ofp_port_stats.";
496             }
497             enum OFPMP_QUEUE {
498               value 5;
499               description "Queue statistics for a port
500                  The request body is struct ofp_queue_stats_request.
501                  The reply body is an array of struct ofp_queue_stats";
502             }
503             enum OFPMP_GROUP {
504               value 6;
505               description "Group counter statistics.
506                  The request body is struct ofp_group_stats_request.
507                  The reply is an array of struct ofp_group_stats.";
508             }
509             enum OFPMP_GROUP_DESC {
510               value 7;
511               description "Group description.
512                  The request body is empty.
513                  The reply body is an array of struct ofp_group_desc.";
514             }
515             enum OFPMP_GROUP_FEATURES {
516               value 8;
517               description "Group features.
518                  The request body is empty.
519                  The reply body is struct ofp_group_features.";
520             }
521             enum OFPMP_METER {
522               value 9;
523               description "Meter statistics.
524                  The request body is struct ofp_meter_multipart_requests.
525                  The reply body is an array of struct ofp_meter_stats.";
526             }
527             enum OFPMP_METER_CONFIG {
528               value 10;
529               description "Meter configuration.
530                  The request body is struct ofp_meter_multipart_requests.
531                  The reply body is an array of struct ofp_meter_config.";
532             }
533             enum OFPMP_METER_FEATURES {
534               value 11;
535               description "Meter features.
536                  The request body is empty.
537                  The reply body is struct ofp_meter_features.";
538             }
539             enum OFPMP_TABLE_FEATURES {
540               value 12;
541               description "Table features.
542                  The request body is either empty or contains an array of
543                  struct ofp_table_features containing the controller’s
544                  desired view of the switch. If the switch is unable to
545                  set the specified view an error is returned.
546                  The reply body is an array of struct ofp_table_features.";
547             }
548             enum OFPMP_PORT_DESC {
549               value 13;
550               description "Port description.
551                  The request body is empty.
552                  The reply body is an array of struct ofp_port.";
553             }
554             enum OFPMP_EXPERIMENTER {
555               value 65535; //0xffff
556               description "Experimenter extension.
557                  The request and reply bodies begin with
558                  struct ofp_experimenter_multipart_header.
559                  The request and reply bodies are otherwise experimenter-defined.";
560             }
561         }
562     }
563
564     typedef queue-property {
565         /* ofp_queue_properties */
566         type enumeration {
567             enum OFPGT_ALL {
568               value 0;
569               description "All (multicast/broadcast) group.";
570             }
571             enum OFPQT_MIN_RATE {
572                 value 1;
573                 description "Minimum datarate guaranteed.";
574             }
575             enum OFPQT_MAX_RATE {
576                 value 2;
577                 description "Maximum datarate.";
578             }
579             enum OFPQT_EXPERIMENTER {
580                 value 65535; // 0xffff 
581                 description "Experimenter defined property.";
582             }
583         }
584     }
585
586     typedef controller-role {
587         /* ofp_controller_role */
588         type enumeration {
589             enum OFPCR_ROLE_NOCHANGE {
590               value 0;
591               description "Don’t change current role.";
592             }
593             enum OFPCR_ROLE_EQUAL {
594               value 1;
595               description "Default role, full access.";
596             }
597             enum OFPCR_ROLE_MASTER {
598               value 2;
599               description "Full access, at most one master.";
600             }
601             enum OFPCR_ROLE_SLAVE {
602               value 3;
603               description "Read-only access.";
604             }
605         }
606     }
607
608     typedef packet-in-reason {
609         /* ofp_packet_in_reason */
610         type enumeration {
611             enum OFPR_NO_MATCH {
612               value 0;
613               description "No matching flow (table-miss flow entry). ";
614             }
615             enum OFPR_ACTION {
616               value 1;
617               description "Action explicitly output to controller. ";
618             }
619             enum OFPR_INVALID_TTL {
620               value 2;
621               description "Packet has invalid TTL ";
622             }
623         }
624     }
625
626     typedef meter-mod-command {
627         /* ofp_meter_mod_command */
628         type enumeration {
629             enum OFPMC_ADD {
630               description "New meter. ";
631             }
632             enum OFPMC_MODIFY {
633               description "Modify specified meter. ";
634             }
635             enum OFPMC_DELETE {
636               description "Delete specified meter. ";
637             }
638         }
639     }
640
641     typedef meter-flags {
642         /* ofp_meter_flags */
643         type bits {
644             bit OFPMF_KBPS {
645                 position 0;
646                 /* Rate value in kb/s (kilo-bit per second). */
647             }
648             bit OFPMF_PKTPS {
649                 position 1;
650                 /* Rate value in packet/sec. */
651             }
652             bit OFPMF_BURST {
653                 position 2;
654                 /* Do burst size. */
655             }
656             bit OFPMF_STATS {
657                 position 3;
658                 /* Collect statistics. */
659             }
660         }
661     }
662
663     typedef meter-band-type {
664         /* ofp_meter_band_type */
665         type enumeration {
666             enum OFPMBT_DROP {
667               value 1;
668               description "Drop packet. ";
669             }
670             enum OFPMBT_DSCP_REMARK {
671               value 2;
672               description "Remark DSCP in the IP header. ";
673             }
674             enum OFPMBT_EXPERIMENTER {
675               value 65535; //0xFFFF
676               description "Experimenter meter band. ";
677             }
678         }
679     }
680
681     typedef table-config {
682         /* ofp_table_config */
683         type bits {
684             bit OFPTC_DEPRECATED_MASK {
685                 /* Deprecated bits */
686                 position 3;
687             }
688         }
689     }
690
691     typedef table-features-prop-type {
692         type enumeration {
693             enum OFPTFPT_INSTRUCTIONS {
694                 value 0; 
695                 description "Instructions property.";
696             }
697             enum OFPTFPT_INSTRUCTIONS_MISS {
698                 value 1; 
699                 description "Instructions for table-miss.";
700             }
701             enum OFPTFPT_NEXT_TABLES {
702                 value 2; 
703                 description "Next Table property.";
704             }
705             enum OFPTFPT_NEXT_TABLES_MISS {
706                 value 3; 
707                 description "Next Table for table-miss.";
708             }
709             enum OFPTFPT_WRITE_ACTIONS {
710                 value 4; 
711                 description "Write Actions property.";
712             }
713             enum OFPTFPT_WRITE_ACTIONS_MISS {
714                 value 5; 
715                 description "Write Actions for table-miss.";
716             }
717             enum OFPTFPT_APPLY_ACTIONS {
718                 value 6; 
719                 description "Apply Actions property.";
720             }
721             enum OFPTFPT_APPLY_ACTIONS_MISS {
722                 value 7; 
723                 description "Apply Actions for table-miss.";
724             }
725             enum OFPTFPT_MATCH {
726                 value 8; 
727                 description "Match property.";
728             }
729             enum OFPTFPT_WILDCARDS {
730                 value 10; 
731                 description "Wildcards property.";
732             }
733             enum OFPTFPT_WRITE_SETFIELD {
734                 value 12; 
735                 description "Write Set-Field property.";
736             }
737             enum OFPTFPT_WRITE_SETFIELD_MISS {
738                 value 13; 
739                 description "Write Set-Field for table-miss.";
740             }
741             enum OFPTFPT_APPLY_SETFIELD {
742                 value 14; 
743                 description "Apply Set-Field property.";
744             }
745             enum OFPTFPT_APPLY_SETFIELD_MISS {
746                 value 15; 
747                 description "Apply Set-Field for table-miss.";
748             }
749             enum OFPTFPT_EXPERIMENTER {
750                 value 65534; 
751                 description "Experimenter property.";
752             }
753             enum OFPTFPT_EXPERIMENTER_MISS {
754                 value 65535; //0xffff 
755                 description "Experimenter for table-miss.";
756             }
757         }
758     }
759
760     typedef group-types {
761         /* ofp_group_type */
762         type bits {
763             bit OFPGT_ALL {
764                 /* All (multicast/broadcast) group. */
765                 position 0;
766             }
767             bit OFPGT_SELECT {
768                 /* Select group. */
769                 position 1;
770             }
771             bit OFPGT_INDIRECT {
772                 /* Indirect group. */
773                 position 2;
774             }
775             bit OFPGT_FF {
776                 /* Fast failover group. */
777                 position 3;
778             }
779         }
780     }
781
782     typedef group-capabilities {
783         /* ofp_group_capabilities */
784         type bits {
785             bit OFPGFC_SELECT_WEIGHT {
786                 /* Support weight for select groups */
787                 position 0;
788             }
789             bit OFPGFC_SELECT_LIVENESS {
790                 /* Support liveness for select groups */
791                 position 1;
792             }
793             bit OFPGFC_CHAINING {
794                 /* Support chaining groups */
795                 position 2;
796             }
797             bit OFPGFC_CHAINING_CHECKS {
798                 /* Check chaining for loops and delete */
799                 position 3;
800             }
801         }
802     }
803
804 }