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