Added support for OF 1.0
[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 port-features {
16         ////description "Features of ports available in datapath.";
17         //reference "ofp_port_features";
18         type bits {
19             bit 10mb_hd { 
20                 position 0;
21                 //description "10 Mb half-duplex rate support.";
22             }
23             bit 10mb-fd { 
24                 position 1;
25                 //description "10 Mb full-duplex rate support.";
26             }
27             bit 100mb-hd { 
28                 position 2;
29                 //description "100 Mb half-duplex rate support.";
30             }
31             bit 100mb-fd { 
32                 position 3;
33                 //description "100 Mb full-duplex rate support.";
34             }
35             bit 1gb-hd { 
36                 position 4;
37                 //description "1 Gb half-duplex rate support.";
38             }
39             bit 1gb-fd { 
40                 position 5;
41                 //description "1 Gb full-duplex rate support.";
42             }
43             bit 10gb-fd { 
44                 position 6;
45                 //description "10 Gb full-duplex rate support.";
46             }
47             bit 40gb-fd { 
48                 position 7;
49                 //description "40 Gb full-duplex rate support.";
50             }
51             bit 100gb-fd { 
52                 position 8;
53                 //description "100 Gb full-duplex rate support.";
54             }
55             bit 1tb-fd { 
56                 position 9;
57                 //description "1 Tb full-duplex rate support.";
58             }
59             bit other { 
60                 position 10;
61                 //description "Other rate, not in the list.";
62             }
63             bit copper { 
64                 position 11;
65                 //description "Copper medium.";
66             }
67             bit fiber { 
68                 position 12;
69                 //description "Fiber medium.";
70             }
71             bit autoneg { 
72                 position 13;
73                 //description "Auto-negotiation.";
74             }
75             bit pause { 
76                 position 14;
77                 //description "Pause.";
78             }
79             bit pause-asym { 
80                 position 15;
81                 //description "Asymmetric pause.";
82             }
83         }
84     }
85
86     typedef port-config {
87         description 
88            "Flags to indicate behavior of the physical port. These flags are
89             describe the current configuration and used port_mod message 
90             to configure the port's behavior.";
91         type bits {
92             bit port-down { 
93                 //description " Port is administratively down.";
94                 position 0;
95             }
96             bit no-recv { 
97                 //description " Drop all packets received by port.";
98                 position 2;
99             }
100             bit no-fwd { 
101                 //description " Drop packets forwarded to port.";
102                 position 5;
103             }
104             bit no-packet-in { 
105                 //description "Do not send packet-in msgs for port.";
106                 position 6;
107             }
108         }
109     }
110
111     typedef port-state {
112         description 
113             "Current state of the physical port. These are not configurable from
114             the controller.";
115         type bits {
116             bit link_down {
117                 //description "No physical link present.";
118                 position 0;
119             }
120             bit blocked {
121                 //description "Port is blocked";
122                 position 1;
123             }
124             bit live {
125                 //description "Live for Fast Failover Group.";
126                 position 2;
127             }
128         }
129     }
130
131     identity match-type-base {
132         description 
133            "The match type indicates the match structure (set of fields that compose the
134             match) in use. The match type is placed in the type field at the beginning
135             of all match structures.Extensions that define match types may be 
136             published on the ONF wiki. Support for extensions is optional.";
137     }
138
139     identity standard-match-type {
140         deprecated true;
141         base oft:match-type-base;
142     }
143
144     typedef oxm-match-type {
145         type identityref {
146             base oft:match-type-base;
147         }
148     }
149
150     identity instruction {
151     }
152
153     identity action {
154     }
155
156     typedef metadata {
157         type binary;
158     }
159
160     typedef table-id {
161         type uint32;
162     }
163     typedef meter-id {
164         type uint32;
165     }
166     typedef queue-id {
167         type uint32;
168     }
169     typedef group-id {
170         type uint32;
171     }
172
173     typedef ether-type {
174         type uint16;
175     }
176
177     typedef error-type {
178         type enumeration {
179             enum HELLO_FAILED {
180                 value 0; 
181                 description "Hello Protocol failed.";
182             }
183             enum BAD_REQUEST {
184                 value 1; 
185                 description "Request was not understood.";
186             }
187             enum BAD_ACTION {
188                 value 2; 
189                 description "Error in action description.";
190             }
191             enum BAD_INSTRUCTION {
192                 value 3; 
193                 description "Error in instruction list.";
194             }
195             enum BAD_MATCH {
196                 value 4; 
197                 description "Error in match.";
198             }
199             enum FLOW_MOD_FAILED {
200                 value 5; 
201                 description "Problem modifying flow entry.";
202             }
203             enum GROUP_MOD_FAILED {
204                 value 6; 
205                 description "Problem modifying group entry.";
206             }
207             enum PORT_MOD_FAILED {
208                 value 7; 
209                 description "Port mod request failed.";
210             }
211             enum TABLE_MOD_FAILED {
212                 value 8; 
213                 description "Table mod request failed.";
214             }
215             enum QUEUE_OP_FAILED {
216                 value 9; 
217                 description "Queue operation failed.";
218             }
219             enum SWITCH_CONFIG_FAILED {
220                 value 10; 
221                 description "Switch config request failed.";
222             }
223             enum ROLE_REQUEST_FAILED {
224                 value 11; 
225                 description "Controller Role request failed.";
226             }
227             enum METER_MOD_FAILED {
228                 value 12; 
229                 description "Error in meter.";
230             }
231             enum TABLE_FEATURES_FAILED {
232                 value 13; 
233                 description "Setting table features failed.";
234             }
235             enum EXPERIMENTER {
236                 value 65535; //0xffff 
237                 description "Experimenter error messages.";
238             }
239         }
240     }
241
242     typedef hello-element-type {
243         type enumeration {
244             enum VERSIONBITMAP {
245                 value 1; 
246                 description "Bitmap of version supported.";
247             }
248         }
249     }
250     
251     typedef capabilities {
252         type bits {
253             bit OFPC_FLOW_STATS {
254                 position 0;
255                 /* Flow statistics. */
256             } 
257             bit OFPC_TABLE_STATS {
258                 position 1;
259                 /* Table statistics. */
260             }
261             bit OFPC_PORT_STATS {
262                 position 2;
263                 /* Port statistics. */
264             }
265             bit OFPC_GROUP_STATS {
266                 position 3;
267                 /* Group statistics. */
268             }
269             bit OFPC_IP_REASM {
270                 position 5;
271                 /* Can reassemble IP fragments. */
272             }
273             bit OFPC_QUEUE_STATS {
274                 position 6;
275                 /* Queue statistics. */
276             }
277             bit OFPC_PORT_BLOCKED {
278                 position 8;
279                 /* Switch will block looping ports. */
280             }
281         }
282     }
283
284     typedef switch-config-flag {
285         /* Handling of IP fragments. */
286         type enumeration {
287             enum FRAG_NORMAL {
288                 value 0; 
289                 description "No special handling for fragments.";
290             }
291             enum OFPC_FRAG_DROP {
292                 value 1; 
293                 description "Drop fragments.";
294             }
295             enum OFPC_FRAG_REASM {
296                 value 2; 
297                 description "Reassemble (only if OFPC_IP_REASM set).";
298             }
299             enum OFPC_FRAG_MASK {
300                 value 3; 
301             }
302         }
303     }
304
305     typedef flow-removed-reason {
306         /* flow removed */
307         type enumeration {
308             enum OFPRR_IDLE_TIMEOUT {
309                 value 0;
310                 description "Flow idle time exceeded idle_timeout.";
311             }
312             enum OFPRR_HARD_TIMEOUT {
313                 value 1;
314                 description "Time exceeded hard_timeout.";
315             }
316             enum OFPRR_DELETE {
317                 value 2;
318                 description "Evicted by a DELETE flow mod.";
319             }
320             enum OFPRR_GROUP_DELETE {
321                 value 3;
322                 description "Group was removed.";
323             }
324         }
325     }
326
327     typedef port-reason {
328         /* port status */
329         type enumeration {
330             enum OFPPR_ADD {
331                 value 0;
332                 description "The port was added.";
333             }
334             enum OFPPR_DELETE {
335                 value 1;
336                 description "he port was removed.";
337             }
338             enum OFPPR_MODIFY {
339                 value 2;
340                 description "Some attribute of the port has changed.";
341             }
342         }
343     }
344
345     typedef flow-mod-command {
346         /* ofp_flow_mod_command */
347         type enumeration {
348             enum OFPFC_ADD {      
349                 value 0;      
350                 description "New flow.";    
351             }
352             enum OFPFC_MODIFY {
353                 value 1;
354                 description "Modify all matching flows.";
355             }
356             enum OFPFC_MODIFY_STRICT {
357                 value 2;
358                 description "Modify entry strictly matching wildcards and priority.";
359             }
360             enum OFPFC_DELETE {
361                 value 3;
362                 description "Delete all matching flows.";
363             }
364             enum OFPFC_DELETE_STRICT {
365                 value 4;
366                 description "Delete entry strictly matching wildcards and priority.";
367             }
368         }
369     }
370
371     typedef flow-mod-flags {
372         /* ofp_flow_mod_flags */
373         type bits {
374             bit OFPFF_SEND_FLOW_REM {
375                 position 0;
376                 /* Send flow removed message when flow expires or is deleted. */
377             }
378             bit OFPFF_CHECK_OVERLAP {
379                 position 1;
380                 /* Check for overlapping entries first. */
381             }
382             bit OFPFF_RESET_COUNTS {
383                 position 2;
384                 /* Reset flow packet and byte counts. */
385             }
386             bit OFPFF_NO_PKT_COUNTS {
387                 position 3;
388                 /* Don't keep track of packet count. */
389             }
390             bit OFPFF_NO_BYT_COUNTS {
391                 position 4;
392                 /* Don't keep track of byte count. */
393             }
394         }
395     }
396
397     typedef group-mod-command {
398         /* ofp_group_mod_command */
399         type enumeration {
400             enum OFPGC_ADD {            
401               value 0;            
402               description "New group.";            
403             }
404             enum OFPGC_MODIFY {
405               value 1;
406               description "Modify all matching groups.";
407             }
408             enum OFPGC_DELETE {
409               value 2;
410               description "Delete all matching groups.";
411             }
412             
413         }
414     }
415
416     typedef group-type {
417         /* ofp_group_type */
418         type enumeration {
419             enum OFPGT_ALL {            
420               value 0;            
421               description "All (multicast/broadcast) group.";            
422             }
423             enum OFPGT_SELECT {
424               value 1;
425               description "Select group.";
426             }
427             enum OFPGT_INDIRECT {
428               value 2;
429               description "Indirect group.";
430             }
431             enum OFPGT_FF {
432               value 3;
433               description "Fast failover group.";
434             }
435         }
436     }
437
438     typedef multipart-request-flags {
439         description
440             "enum ofp_multipart_request_flags ";
441         type bits {
442             bit OFPMPF_REQ_MORE {
443                 //description "More requests to follow.";
444                 position 0;
445             }
446         }
447     }
448
449     typedef multipart-type {
450         /* ofp_multipart_type */
451         type enumeration {
452             enum OFPMP_DESC {
453               value 0;
454               description "Description of this OpenFlow switch.
455                  The request body is empty.
456                  The reply body is struct ofp_desc.";
457             }
458             enum OFPMP_FLOW {
459               value 1;
460               description "Individual flow statistics.
461                  The request body is struct ofp_flow_stats_request.
462                  The reply body is an array of struct ofp_flow_stats.";
463             }
464             enum OFPMP_AGGREGATE {
465               value 2;
466               description "Aggregate flow statistics.
467                  The request body is struct ofp_aggregate_stats_request.
468                  The reply body is struct ofp_aggregate_stats_reply.";
469             }
470             enum OFPMP_TABLE {
471               value 3;
472               description "Flow table statistics.
473                  The request body is empty.
474                  The reply body is an array of struct ofp_table_stats.";
475             }
476             enum OFPMP_PORT_STATS {
477               value 4;
478               description "Port statistics.
479                  The request body is struct ofp_port_stats_request.
480                  The reply body is an array of struct ofp_port_stats.";
481             }
482             enum OFPMP_QUEUE {
483               value 5;
484               description "Queue statistics for a port
485                  The request body is struct ofp_queue_stats_request.
486                  The reply body is an array of struct ofp_queue_stats";
487             }
488             enum OFPMP_GROUP {
489               value 6;
490               description "Group counter statistics.
491                  The request body is struct ofp_group_stats_request.
492                  The reply is an array of struct ofp_group_stats.";
493             }
494             enum OFPMP_GROUP_DESC {
495               value 7;
496               description "Group description.
497                  The request body is empty.
498                  The reply body is an array of struct ofp_group_desc.";
499             }
500             enum OFPMP_GROUP_FEATURES {
501               value 8;
502               description "Group features.
503                  The request body is empty.
504                  The reply body is struct ofp_group_features.";
505             }
506             enum OFPMP_METER {
507               value 9;
508               description "Meter statistics.
509                  The request body is struct ofp_meter_multipart_requests.
510                  The reply body is an array of struct ofp_meter_stats.";
511             }
512             enum OFPMP_METER_CONFIG {
513               value 10;
514               description "Meter configuration.
515                  The request body is struct ofp_meter_multipart_requests.
516                  The reply body is an array of struct ofp_meter_config.";
517             }
518             enum OFPMP_METER_FEATURES {
519               value 11;
520               description "Meter features.
521                  The request body is empty.
522                  The reply body is struct ofp_meter_features.";
523             }
524             enum OFPMP_TABLE_FEATURES {
525               value 12;
526               description "Table features.
527                  The request body is either empty or contains an array of
528                  struct ofp_table_features containing the controller’s
529                  desired view of the switch. If the switch is unable to
530                  set the specified view an error is returned.
531                  The reply body is an array of struct ofp_table_features.";
532             }
533             enum OFPMP_PORT_DESC {
534               value 13;
535               description "Port description.
536                  The request body is empty.
537                  The reply body is an array of struct ofp_port.";
538             }
539             enum OFPMP_EXPERIMENTER {
540               value 65535; //0xffff
541               description "Experimenter extension.
542                  The request and reply bodies begin with
543                  struct ofp_experimenter_multipart_header.
544                  The request and reply bodies are otherwise experimenter-defined.";
545             }
546         }
547     }
548
549     typedef queue-properties {
550         /* ofp_queue_properties */
551         type enumeration {
552             enum OFPQT_NONE {
553               value 0;
554               description "No property defined for queue (default).";
555             }
556             enum OFPQT_MIN_RATE {
557                 value 1;
558                 description "Minimum datarate guaranteed.";
559             }
560             enum OFPQT_MAX_RATE {
561                 value 2;
562                 description "Maximum datarate.";
563             }
564             enum OFPQT_EXPERIMENTER {
565                 value 65535; // 0xffff 
566                 description "Experimenter defined property.";
567             }
568         }
569     }
570
571     typedef controller-role {
572         /* ofp_controller_role */
573         type enumeration {
574             enum OFPCR_ROLE_NOCHANGE {
575               value 0;
576               description "Don’t change current role.";
577             }
578             enum OFPCR_ROLE_EQUAL {
579               value 1;
580               description "Default role, full access.";
581             }
582             enum OFPCR_ROLE_MASTER {
583               value 2;
584               description "Full access, at most one master.";
585             }
586             enum OFPCR_ROLE_SLAVE {
587               value 3;
588               description "Read-only access.";
589             }
590         }
591     }
592
593     typedef packet-in-reason {
594         /* ofp_packet_in_reason */
595         type enumeration {
596             enum OFPR_NO_MATCH {
597               value 0;
598               description "No matching flow (table-miss flow entry). ";
599             }
600             enum OFPR_ACTION {
601               value 1;
602               description "Action explicitly output to controller. ";
603             }
604             enum OFPR_INVALID_TTL {
605               value 2;
606               description "Packet has invalid TTL ";
607             }
608         }
609     }
610     
611     typedef action-type {
612         /* ofp_action_type */
613         type bits {
614             bit OFPAT_OUTPUT {
615                 position 0;
616                 /* Output to switch port. */
617             }
618             bit OFPAT_COPY_TTL_OUT {
619                 position 1;
620                 /* Copy TTL "outwards" -- from next-to-outermost to outermost */
621             }
622             bit OFPAT_COPY_TTL_IN {
623                 position 2;
624                 /* Copy TTL "inwards" -- from outermost to next-to-outermost */
625             }
626             bit OFPAT_SET_MPLS_TTL {
627                 position 3;
628                 /* MPLS TTL */
629             }
630             bit OFPAT_DEC_MPLS_TTL {
631                 position 4;
632                 /* Decrement MPLS TTL */
633             }
634             bit OFPAT_PUSH_VLAN {
635                 position 5;
636                 /* Push a new VLAN tag */
637             }
638             bit OFPAT_POP_VLAN {
639                 position 6;
640                 /* Pop the outer VLAN tag */
641             }
642             bit OFPAT_PUSH_MPLS {
643                 position 7;
644                 /* Push a new MPLS tag */
645             }
646             bit OFPAT_POP_MPLS {
647                 position 8;
648                 /* Pop the outer MPLS tag */
649             }
650             bit OFPAT_SET_QUEUE {
651                 position 9;
652                 /* Set queue id when outputting to a port */
653             }
654             bit OFPAT_GROUP {
655                 position 10;
656                 /* Apply group. */
657             }
658             bit OFPAT_SET_NW_TTL {
659                 position 11;
660                 /* IP TTL. */
661             }
662             bit OFPAT_DEC_NW_TTL {
663                 position 12;
664                 /* Decrement IP TTL. */
665             }
666             bit OFPAT_SET_FIELD {
667                 position 13;
668                 /* Set a header field using OXM TLV format. */
669             }
670             bit OFPAT_PUSH_PBB {
671                 position 14;
672                 /* Push a new PBB service tag (I-TAG) */
673             }
674             bit OFPAT_POP_PBB {
675                 position 15;
676                 /* Pop the outer PBB service tag (I-TAG) */
677             }
678             bit OFPAT_EXPERIMENTER {
679                 position 16;
680             }
681         }
682     }
683
684     typedef meter-mod-command {
685         /* ofp_meter_mod_command */
686         type enumeration {
687             enum OFPMC_ADD {
688               description "New meter. ";
689             }
690             enum OFPMC_MODIFY {
691               description "Modify specified meter. ";
692             }
693             enum OFPMC_DELETE {
694               description "Delete specified meter. ";
695             }
696         }
697     }
698
699     typedef meter-flags {
700         /* ofp_meter_flags */
701         type bits {
702             bit OFPMF_KBPS {
703                 position 0;
704                 /* Rate value in kb/s (kilo-bit per second). */
705             }
706             bit OFPMF_PKTPS {
707                 position 1;
708                 /* Rate value in packet/sec. */
709             }
710             bit OFPMF_BURST {
711                 position 2;
712                 /* Do burst size. */
713             }
714             bit OFPMF_STATS {
715                 position 3;
716                 /* Collect statistics. */
717             }
718         }
719     }
720
721     typedef meter-band-type {
722         /* ofp_meter_band_type */
723         type enumeration {
724             enum OFPMBT_DROP {
725               value 1;
726               description "Drop packet. ";
727             }
728             enum OFPMBT_DSCP_REMARK {
729               value 2;
730               description "Remark DSCP in the IP header. ";
731             }
732             enum OFPMBT_EXPERIMENTER {
733               value 65535; //0xFFFF
734               description "Experimenter meter band. ";
735             }
736         }
737     }
738
739     typedef table-config {
740         /* ofp_table_config */
741         type bits {
742             bit OFPTC_DEPRECATED_MASK {
743                 /* Deprecated bits */
744                 position 3;
745             }
746         }
747     }
748
749     typedef table-features-prop-type {
750         type enumeration {
751             enum OFPTFPT_INSTRUCTIONS {
752                 value 0; 
753                 description "Instructions property.";
754             }
755             enum OFPTFPT_INSTRUCTIONS_MISS {
756                 value 1; 
757                 description "Instructions for table-miss.";
758             }
759             enum OFPTFPT_NEXT_TABLES {
760                 value 2; 
761                 description "Next Table property.";
762             }
763             enum OFPTFPT_NEXT_TABLES_MISS {
764                 value 3; 
765                 description "Next Table for table-miss.";
766             }
767             enum OFPTFPT_WRITE_ACTIONS {
768                 value 4; 
769                 description "Write Actions property.";
770             }
771             enum OFPTFPT_WRITE_ACTIONS_MISS {
772                 value 5; 
773                 description "Write Actions for table-miss.";
774             }
775             enum OFPTFPT_APPLY_ACTIONS {
776                 value 6; 
777                 description "Apply Actions property.";
778             }
779             enum OFPTFPT_APPLY_ACTIONS_MISS {
780                 value 7; 
781                 description "Apply Actions for table-miss.";
782             }
783             enum OFPTFPT_MATCH {
784                 value 8; 
785                 description "Match property.";
786             }
787             enum OFPTFPT_WILDCARDS {
788                 value 10; 
789                 description "Wildcards property.";
790             }
791             enum OFPTFPT_WRITE_SETFIELD {
792                 value 12; 
793                 description "Write Set-Field property.";
794             }
795             enum OFPTFPT_WRITE_SETFIELD_MISS {
796                 value 13; 
797                 description "Write Set-Field for table-miss.";
798             }
799             enum OFPTFPT_APPLY_SETFIELD {
800                 value 14; 
801                 description "Apply Set-Field property.";
802             }
803             enum OFPTFPT_APPLY_SETFIELD_MISS {
804                 value 15; 
805                 description "Apply Set-Field for table-miss.";
806             }
807             enum OFPTFPT_EXPERIMENTER {
808                 value 65534; 
809                 description "Experimenter property.";
810             }
811             enum OFPTFPT_EXPERIMENTER_MISS {
812                 value 65535; //0xffff 
813                 description "Experimenter for table-miss.";
814             }
815         }
816     }
817
818     typedef group-types {
819         /* ofp_group_type */
820         type bits {
821             bit OFPGT_ALL {
822                 /* All (multicast/broadcast) group. */
823                 position 0;
824             }
825             bit OFPGT_SELECT {
826                 /* Select group. */
827                 position 1;
828             }
829             bit OFPGT_INDIRECT {
830                 /* Indirect group. */
831                 position 2;
832             }
833             bit OFPGT_FF {
834                 /* Fast failover group. */
835                 position 3;
836             }
837         }
838     }
839
840     typedef group-capabilities {
841         /* ofp_group_capabilities */
842         type bits {
843             bit OFPGFC_SELECT_WEIGHT {
844                 /* Support weight for select groups */
845                 position 0;
846             }
847             bit OFPGFC_SELECT_LIVENESS {
848                 /* Support liveness for select groups */
849                 position 1;
850             }
851             bit OFPGFC_CHAINING {
852                 /* Support chaining groups */
853                 position 2;
854             }
855             bit OFPGFC_CHAINING_CHECKS {
856                 /* Check chaining for loops and delete */
857                 position 3;
858             }
859         }
860     }
861     
862 // OPENFLOW v1.0 STRUCTURES
863     // Structures under this line are needed to support OpenFlow version 1.0 
864     // wire protocol 0x01; 
865     
866     typedef port-config-v10 {
867         description 
868            "Flags to indicate behavior of the physical port. These flags are
869             describe the current configuration and used port_mod message 
870             to configure the port's behavior.";
871         type bits {
872             bit port-down { 
873                 //description " Port is administratively down.";
874                 position 0;
875             }
876             bit no-stp {
877                 //description" Disable 802.1D spanning tree on port.";
878                 position 1;
879             }
880             bit no-recv { 
881                 //description " Drop all packets received by port.";
882                 position 2;
883             }
884             bit no-recv-stp { 
885                 //description " Drop received 802.1D STP packets.";
886                 position 3;
887             }
888             bit no-flood { 
889                 //description " Do not include this port when flooding.";
890                 position 4;
891             }
892             bit no-fwd { 
893                 //description " Drop packets forwarded to port.";
894                 position 5;
895             }
896             bit no-packet-in { 
897                 //description "Do not send packet-in msgs for port.";
898                 position 6;
899             }
900         }
901     }
902     
903     typedef port-state-v10 {
904         description 
905             "Current state of the physical port. These are not configurable from
906             the controller.";
907         type bits {
908             bit link_down {
909                 //description "No physical link present.";
910                 position 0;
911             }
912             bit blocked {
913                 //description "Port is blocked";
914                 position 1;
915             }
916             bit live {
917                 //description "Live for Fast Failover Group.";
918                 position 2;
919             }
920             bit stp_listen {
921                 //description "Live for Fast Failover Group.";
922                 position 8;
923             }
924             bit stp_learn {
925                 //description "Live for Fast Failover Group.";
926                 position 8;
927             }
928             bit stp_forward {
929                 //description "Live for Fast Failover Group.";
930                 position 8;
931             }
932             bit stp_block {
933                 //description "Live for Fast Failover Group.";
934                 position 8;
935             }
936             bit stp_mask {
937                 //description "Live for Fast Failover Group.";
938                 position 8;
939             }
940         }
941     }
942     
943     typedef port-features-v10 {
944         ////description "Features of ports available in datapath.";
945         //reference "ofp_port_features";
946         type bits {
947             bit 10mb-hd { 
948                 position 0;
949                 //description "10 Mb half-duplex rate support.";
950             }
951             bit 10mb-fd { 
952                 position 1;
953                 //description "10 Mb full-duplex rate support.";
954             }
955             bit 100mb-hd { 
956                 position 2;
957                 //description "100 Mb half-duplex rate support.";
958             }
959             bit 100mb-fd { 
960                 position 3;
961                 //description "100 Mb full-duplex rate support.";
962             }
963             bit 1gb-hd { 
964                 position 4;
965                 //description "1 Gb half-duplex rate support.";
966             }
967             bit 1gb-fd { 
968                 position 5;
969                 //description "1 Gb full-duplex rate support.";
970             }
971             bit 10gb-fd { 
972                 position 6;
973                 //description "10 Gb full-duplex rate support.";
974             }
975             bit copper { 
976                 position 7;
977                 //description "Copper medium.";
978             }
979             bit fiber { 
980                 position 8;
981                 //description "Fiber medium.";
982             }
983             bit autoneg { 
984                 position 9;
985                 //description "Auto-negotiation.";
986             }
987             bit pause { 
988                 position 10;
989                 //description "Pause.";
990             }
991             bit pause-asym { 
992                 position 11;
993                 //description "Asymmetric pause.";
994             }
995         }
996     }
997     
998     typedef capabilities-v10 {
999         type bits {
1000             bit OFPC_FLOW_STATS {
1001                 position 0;
1002                 /* Flow statistics. */
1003             } 
1004             bit OFPC_TABLE_STATS {
1005                 position 1;
1006                 /* Table statistics. */
1007             }
1008             bit OFPC_PORT_STATS {
1009                 position 2;
1010                 /* Port statistics. */
1011             }
1012             bit OFPC_STP {
1013                 position 3;
1014                 /* 802.1d spanning tree. */
1015             }
1016             bit OFPC_RESERVED {
1017                 position 4;
1018                 /* Reserved, must be zero. */
1019             }
1020             bit OFPC_IP_REASM {
1021                 position 5;
1022                 /* Can reassemble IP fragments. */
1023             }
1024             bit OFPC_QUEUE_STATS {
1025                 position 6;
1026                 /* Queue statistics. */
1027             }
1028             bit OFPC_ARP_MATCH_IP {
1029                 position 8;
1030                 /* Match IP addresses in ARP pkts. */
1031             }
1032         }
1033     }
1034     
1035     typedef flow-mod-flags-v10 {
1036         /* ofp_flow_mod_flags */
1037         type bits {
1038             bit OFPFF_SEND_FLOW_REM {
1039                 position 0;
1040                 /* Send flow removed message when flow expires or is deleted. */
1041             }
1042             bit OFPFF_CHECK_OVERLAP {
1043                 position 1;
1044                 /* Check for overlapping entries first. */
1045             }
1046             bit OFPFF_EMERG {
1047                 position 2;
1048                 /* Reset flow packet and byte counts. */
1049             }
1050         }
1051     }
1052     
1053     typedef action-type-v10 {
1054         /* ofp_action_type */
1055         type bits {
1056             bit OFPAT_OUTPUT {
1057                 position 0;
1058                 /* Output to switch port. */
1059             }
1060             bit OFPAT_SET_VLAN_VID {
1061                 position 1;
1062                 /* Set the 802.1q VLAN id. */
1063             }
1064             bit OFPAT_SET_VLAN_PCP {
1065                 position 2;
1066                 /* Set the 802.1q priority. */
1067             }
1068             bit OFPAT_STRIP_VLAN {
1069                 position 3;
1070                 /* Strip the 802.1q header. */
1071             }
1072             bit OFPAT_SET_DL_SRC {
1073                 position 4;
1074                 /* Ethernet source address. */
1075             }
1076             bit OFPAT_SET_DL_DST {
1077                 position 5;
1078                 /* Ethernet destination address. */
1079             }
1080             bit OFPAT_SET_NW_SRC {
1081                 position 6;
1082                 /* IP source address. */
1083             }
1084             bit OFPAT_SET_NW_DST {
1085                 position 7;
1086                 /* IP destination address. */
1087             }
1088             bit OFPAT_SET_NW_TOS {
1089                 position 8;
1090                 /* IP ToS (DSCP field, 6 bits). */
1091             }
1092             bit OFPAT_SET_TP_SRC {
1093                 position 9;
1094                 /* TCP/UDP source port. */
1095             }
1096             bit OFPAT_SET_TP_DST {
1097                 position 10;
1098                 /* TCP/UDP destination port. */
1099             }
1100             bit OFPAT_ENQUEUE {
1101                 position 11;
1102                 /* Output to queue. */
1103             }
1104             bit OFPAT_VENDOR {
1105                 position 12;
1106                 /* Experimenter in later versions */
1107             }
1108         }
1109     }
1110     
1111     typedef error-type-v10 {
1112         type enumeration {
1113             enum HELLO_FAILED {
1114                 value 0; 
1115                 description "Hello Protocol failed.";
1116             }
1117             enum BAD_REQUEST {
1118                 value 1; 
1119                 description "Request was not understood.";
1120             }
1121             enum BAD_ACTION {
1122                 value 2; 
1123                 description "Error in action description.";
1124             }
1125             enum FLOW_MOD_FAILED {
1126                 value 3; 
1127                 description "Problem modifying flow entry.";
1128             }
1129             enum PORT_MOD_FAILED {
1130                 value 4; 
1131                 description "Port mod request failed.";
1132             }
1133             enum QUEUE_OP_FAILED {
1134                 value 5; 
1135                 description "Queue operation failed.";
1136             }
1137         }
1138     }
1139 }