Added yang models for ofp_group and ofp_meter enums
[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 group {
439                 /* ofp_group - Group numbering. Groups can use any number up to OFPG_MAX.*/
440                 type enumeration {
441                         enum OFPG_MAX {
442                                 value -256; //0xffffff00
443                                 description "Last usable group number";
444                         }
445                         
446                         /* Fake groups. */
447                         enum OFPG_ALL {
448                                 value -4; //0xfffffffc
449                                 description "Represents all groups for group delete commands";
450                         }
451                         enum OFPG_ANY {
452                                 value -1; //0xffffffff
453                                 description "Wildcard group used only for flow stats requests. 
454                                                                 Selects all flows regardless of group (including flows with no group)";
455                                 
456                         }
457                 }
458                 
459         }
460         
461     typedef multipart-request-flags {
462         description
463             "enum ofp_multipart_request_flags ";
464         type bits {
465             bit OFPMPF_REQ_MORE {
466                 //description "More requests to follow.";
467                 position 0;
468             }
469         }
470     }
471
472     typedef multipart-type {
473         /* ofp_multipart_type */
474         type enumeration {
475             enum OFPMP_DESC {
476               value 0;
477               description "Description of this OpenFlow switch.
478                  The request body is empty.
479                  The reply body is struct ofp_desc.";
480             }
481             enum OFPMP_FLOW {
482               value 1;
483               description "Individual flow statistics.
484                  The request body is struct ofp_flow_stats_request.
485                  The reply body is an array of struct ofp_flow_stats.";
486             }
487             enum OFPMP_AGGREGATE {
488               value 2;
489               description "Aggregate flow statistics.
490                  The request body is struct ofp_aggregate_stats_request.
491                  The reply body is struct ofp_aggregate_stats_reply.";
492             }
493             enum OFPMP_TABLE {
494               value 3;
495               description "Flow table statistics.
496                  The request body is empty.
497                  The reply body is an array of struct ofp_table_stats.";
498             }
499             enum OFPMP_PORT_STATS {
500               value 4;
501               description "Port statistics.
502                  The request body is struct ofp_port_stats_request.
503                  The reply body is an array of struct ofp_port_stats.";
504             }
505             enum OFPMP_QUEUE {
506               value 5;
507               description "Queue statistics for a port
508                  The request body is struct ofp_queue_stats_request.
509                  The reply body is an array of struct ofp_queue_stats";
510             }
511             enum OFPMP_GROUP {
512               value 6;
513               description "Group counter statistics.
514                  The request body is struct ofp_group_stats_request.
515                  The reply is an array of struct ofp_group_stats.";
516             }
517             enum OFPMP_GROUP_DESC {
518               value 7;
519               description "Group description.
520                  The request body is empty.
521                  The reply body is an array of struct ofp_group_desc.";
522             }
523             enum OFPMP_GROUP_FEATURES {
524               value 8;
525               description "Group features.
526                  The request body is empty.
527                  The reply body is struct ofp_group_features.";
528             }
529             enum OFPMP_METER {
530               value 9;
531               description "Meter statistics.
532                  The request body is struct ofp_meter_multipart_requests.
533                  The reply body is an array of struct ofp_meter_stats.";
534             }
535             enum OFPMP_METER_CONFIG {
536               value 10;
537               description "Meter configuration.
538                  The request body is struct ofp_meter_multipart_requests.
539                  The reply body is an array of struct ofp_meter_config.";
540             }
541             enum OFPMP_METER_FEATURES {
542               value 11;
543               description "Meter features.
544                  The request body is empty.
545                  The reply body is struct ofp_meter_features.";
546             }
547             enum OFPMP_TABLE_FEATURES {
548               value 12;
549               description "Table features.
550                  The request body is either empty or contains an array of
551                  struct ofp_table_features containing the controller’s
552                  desired view of the switch. If the switch is unable to
553                  set the specified view an error is returned.
554                  The reply body is an array of struct ofp_table_features.";
555             }
556             enum OFPMP_PORT_DESC {
557               value 13;
558               description "Port description.
559                  The request body is empty.
560                  The reply body is an array of struct ofp_port.";
561             }
562             enum OFPMP_EXPERIMENTER {
563               value 65535; //0xffff
564               description "Experimenter extension.
565                  The request and reply bodies begin with
566                  struct ofp_experimenter_multipart_header.
567                  The request and reply bodies are otherwise experimenter-defined.";
568             }
569         }
570     }
571
572     typedef queue-properties {
573         /* ofp_queue_properties */
574         type enumeration {
575             enum OFPQT_NONE {
576               value 0;
577               description "No property defined for queue (default).";
578             }
579             enum OFPQT_MIN_RATE {
580                 value 1;
581                 description "Minimum datarate guaranteed.";
582             }
583             enum OFPQT_MAX_RATE {
584                 value 2;
585                 description "Maximum datarate.";
586             }
587             enum OFPQT_EXPERIMENTER {
588                 value 65535; // 0xffff 
589                 description "Experimenter defined property.";
590             }
591         }
592     }
593
594     typedef controller-role {
595         /* ofp_controller_role */
596         type enumeration {
597             enum OFPCR_ROLE_NOCHANGE {
598               value 0;
599               description "Don’t change current role.";
600             }
601             enum OFPCR_ROLE_EQUAL {
602               value 1;
603               description "Default role, full access.";
604             }
605             enum OFPCR_ROLE_MASTER {
606               value 2;
607               description "Full access, at most one master.";
608             }
609             enum OFPCR_ROLE_SLAVE {
610               value 3;
611               description "Read-only access.";
612             }
613         }
614     }
615
616     typedef packet-in-reason {
617         /* ofp_packet_in_reason */
618         type enumeration {
619             enum OFPR_NO_MATCH {
620               value 0;
621               description "No matching flow (table-miss flow entry). ";
622             }
623             enum OFPR_ACTION {
624               value 1;
625               description "Action explicitly output to controller. ";
626             }
627             enum OFPR_INVALID_TTL {
628               value 2;
629               description "Packet has invalid TTL ";
630             }
631         }
632     }
633     
634     typedef action-type {
635         /* ofp_action_type */
636         type bits {
637             bit OFPAT_OUTPUT {
638                 position 0;
639                 /* Output to switch port. */
640             }
641             bit OFPAT_COPY_TTL_OUT {
642                 position 1;
643                 /* Copy TTL "outwards" -- from next-to-outermost to outermost */
644             }
645             bit OFPAT_COPY_TTL_IN {
646                 position 2;
647                 /* Copy TTL "inwards" -- from outermost to next-to-outermost */
648             }
649             bit OFPAT_SET_MPLS_TTL {
650                 position 3;
651                 /* MPLS TTL */
652             }
653             bit OFPAT_DEC_MPLS_TTL {
654                 position 4;
655                 /* Decrement MPLS TTL */
656             }
657             bit OFPAT_PUSH_VLAN {
658                 position 5;
659                 /* Push a new VLAN tag */
660             }
661             bit OFPAT_POP_VLAN {
662                 position 6;
663                 /* Pop the outer VLAN tag */
664             }
665             bit OFPAT_PUSH_MPLS {
666                 position 7;
667                 /* Push a new MPLS tag */
668             }
669             bit OFPAT_POP_MPLS {
670                 position 8;
671                 /* Pop the outer MPLS tag */
672             }
673             bit OFPAT_SET_QUEUE {
674                 position 9;
675                 /* Set queue id when outputting to a port */
676             }
677             bit OFPAT_GROUP {
678                 position 10;
679                 /* Apply group. */
680             }
681             bit OFPAT_SET_NW_TTL {
682                 position 11;
683                 /* IP TTL. */
684             }
685             bit OFPAT_DEC_NW_TTL {
686                 position 12;
687                 /* Decrement IP TTL. */
688             }
689             bit OFPAT_SET_FIELD {
690                 position 13;
691                 /* Set a header field using OXM TLV format. */
692             }
693             bit OFPAT_PUSH_PBB {
694                 position 14;
695                 /* Push a new PBB service tag (I-TAG) */
696             }
697             bit OFPAT_POP_PBB {
698                 position 15;
699                 /* Pop the outer PBB service tag (I-TAG) */
700             }
701             bit OFPAT_EXPERIMENTER {
702                 position 16;
703             }
704         }
705     }
706
707     typedef meter-mod-command {
708         /* ofp_meter_mod_command */
709         type enumeration {
710             enum OFPMC_ADD {
711               description "New meter. ";
712             }
713             enum OFPMC_MODIFY {
714               description "Modify specified meter. ";
715             }
716             enum OFPMC_DELETE {
717               description "Delete specified meter. ";
718             }
719         }
720     }
721
722     typedef meter-flags {
723         /* ofp_meter_flags */
724         type bits {
725             bit OFPMF_KBPS {
726                 position 0;
727                 /* Rate value in kb/s (kilo-bit per second). */
728             }
729             bit OFPMF_PKTPS {
730                 position 1;
731                 /* Rate value in packet/sec. */
732             }
733             bit OFPMF_BURST {
734                 position 2;
735                 /* Do burst size. */
736             }
737             bit OFPMF_STATS {
738                 position 3;
739                 /* Collect statistics. */
740             }
741         }
742     }
743
744     typedef meter-band-type {
745         /* ofp_meter_band_type */
746         type enumeration {
747             enum OFPMBT_DROP {
748               value 1;
749               description "Drop packet. ";
750             }
751             enum OFPMBT_DSCP_REMARK {
752               value 2;
753               description "Remark DSCP in the IP header. ";
754             }
755             enum OFPMBT_EXPERIMENTER {
756               value 65535; //0xFFFF
757               description "Experimenter meter band. ";
758             }
759         }
760     }
761
762         typedef meter {
763                 /* ofp_meter - Meter numbering. Flow meters can use any number up to OFPM_MAX*/
764                 type enumeration {
765                         enum OFPM_MAX {
766                                 value -65536; //0xffff0000
767                                 description "Last usable meter number";
768                         }
769                         
770                         /* Virtual meters. */
771                         enum OFPM_SLOWPATH {
772                                 value -3; //0xfffffffd
773                                 description "Meter for slow datapath";
774                         }
775                         enum OFPM_CONTROLLER {
776                                 value -2; //0xfffffffe
777                                 description "Meter for controller connection";
778                         }
779                         enum OFPM_ALL {
780                                 value -1; //0xffffffff
781                                 description "Represents all meters for stat requests commands";
782                         }
783                 }
784                 
785         }
786
787     typedef table-config {
788         /* ofp_table_config */
789         type bits {
790             bit OFPTC_DEPRECATED_MASK {
791                 /* Deprecated bits */
792                 position 3;
793             }
794         }
795     }
796
797     typedef table-features-prop-type {
798         type enumeration {
799             enum OFPTFPT_INSTRUCTIONS {
800                 value 0; 
801                 description "Instructions property.";
802             }
803             enum OFPTFPT_INSTRUCTIONS_MISS {
804                 value 1; 
805                 description "Instructions for table-miss.";
806             }
807             enum OFPTFPT_NEXT_TABLES {
808                 value 2; 
809                 description "Next Table property.";
810             }
811             enum OFPTFPT_NEXT_TABLES_MISS {
812                 value 3; 
813                 description "Next Table for table-miss.";
814             }
815             enum OFPTFPT_WRITE_ACTIONS {
816                 value 4; 
817                 description "Write Actions property.";
818             }
819             enum OFPTFPT_WRITE_ACTIONS_MISS {
820                 value 5; 
821                 description "Write Actions for table-miss.";
822             }
823             enum OFPTFPT_APPLY_ACTIONS {
824                 value 6; 
825                 description "Apply Actions property.";
826             }
827             enum OFPTFPT_APPLY_ACTIONS_MISS {
828                 value 7; 
829                 description "Apply Actions for table-miss.";
830             }
831             enum OFPTFPT_MATCH {
832                 value 8; 
833                 description "Match property.";
834             }
835             enum OFPTFPT_WILDCARDS {
836                 value 10; 
837                 description "Wildcards property.";
838             }
839             enum OFPTFPT_WRITE_SETFIELD {
840                 value 12; 
841                 description "Write Set-Field property.";
842             }
843             enum OFPTFPT_WRITE_SETFIELD_MISS {
844                 value 13; 
845                 description "Write Set-Field for table-miss.";
846             }
847             enum OFPTFPT_APPLY_SETFIELD {
848                 value 14; 
849                 description "Apply Set-Field property.";
850             }
851             enum OFPTFPT_APPLY_SETFIELD_MISS {
852                 value 15; 
853                 description "Apply Set-Field for table-miss.";
854             }
855             enum OFPTFPT_EXPERIMENTER {
856                 value 65534; 
857                 description "Experimenter property.";
858             }
859             enum OFPTFPT_EXPERIMENTER_MISS {
860                 value 65535; //0xffff 
861                 description "Experimenter for table-miss.";
862             }
863         }
864     }
865
866     typedef group-types {
867         /* ofp_group_type */
868         type bits {
869             bit OFPGT_ALL {
870                 /* All (multicast/broadcast) group. */
871                 position 0;
872             }
873             bit OFPGT_SELECT {
874                 /* Select group. */
875                 position 1;
876             }
877             bit OFPGT_INDIRECT {
878                 /* Indirect group. */
879                 position 2;
880             }
881             bit OFPGT_FF {
882                 /* Fast failover group. */
883                 position 3;
884             }
885         }
886     }
887
888     typedef group-capabilities {
889         /* ofp_group_capabilities */
890         type bits {
891             bit OFPGFC_SELECT_WEIGHT {
892                 /* Support weight for select groups */
893                 position 0;
894             }
895             bit OFPGFC_SELECT_LIVENESS {
896                 /* Support liveness for select groups */
897                 position 1;
898             }
899             bit OFPGFC_CHAINING {
900                 /* Support chaining groups */
901                 position 2;
902             }
903             bit OFPGFC_CHAINING_CHECKS {
904                 /* Check chaining for loops and delete */
905                 position 3;
906             }
907         }
908     }
909     
910 // OPENFLOW v1.0 STRUCTURES
911     // Structures under this line are needed to support OpenFlow version 1.0 
912     // wire protocol 0x01; 
913     
914     typedef port-config-v10 {
915         description 
916            "Flags to indicate behavior of the physical port. These flags are
917             describe the current configuration and used port_mod message 
918             to configure the port's behavior.";
919         type bits {
920             bit port-down { 
921                 //description " Port is administratively down.";
922                 position 0;
923             }
924             bit no-stp {
925                 //description" Disable 802.1D spanning tree on port.";
926                 position 1;
927             }
928             bit no-recv { 
929                 //description " Drop all packets received by port.";
930                 position 2;
931             }
932             bit no-recv-stp { 
933                 //description " Drop received 802.1D STP packets.";
934                 position 3;
935             }
936             bit no-flood { 
937                 //description " Do not include this port when flooding.";
938                 position 4;
939             }
940             bit no-fwd { 
941                 //description " Drop packets forwarded to port.";
942                 position 5;
943             }
944             bit no-packet-in { 
945                 //description "Do not send packet-in msgs for port.";
946                 position 6;
947             }
948         }
949     }
950     
951     typedef port-state-v10 {
952         description 
953             "Current state of the physical port. These are not configurable from
954             the controller.";
955         type bits {
956             bit link_down {
957                 //description "No physical link present.";
958                 position 0;
959             }
960             bit blocked {
961                 //description "Port is blocked";
962                 position 1;
963             }
964             bit live {
965                 //description "Live for Fast Failover Group.";
966                 position 2;
967             }
968             bit stp_listen {
969                 //description "Live for Fast Failover Group.";
970                 position 8;
971             }
972             bit stp_learn {
973                 //description "Live for Fast Failover Group.";
974                 position 8;
975             }
976             bit stp_forward {
977                 //description "Live for Fast Failover Group.";
978                 position 8;
979             }
980             bit stp_block {
981                 //description "Live for Fast Failover Group.";
982                 position 8;
983             }
984             bit stp_mask {
985                 //description "Live for Fast Failover Group.";
986                 position 8;
987             }
988         }
989     }
990     
991     typedef port-features-v10 {
992         ////description "Features of ports available in datapath.";
993         //reference "ofp_port_features";
994         type bits {
995             bit 10mb-hd { 
996                 position 0;
997                 //description "10 Mb half-duplex rate support.";
998             }
999             bit 10mb-fd { 
1000                 position 1;
1001                 //description "10 Mb full-duplex rate support.";
1002             }
1003             bit 100mb-hd { 
1004                 position 2;
1005                 //description "100 Mb half-duplex rate support.";
1006             }
1007             bit 100mb-fd { 
1008                 position 3;
1009                 //description "100 Mb full-duplex rate support.";
1010             }
1011             bit 1gb-hd { 
1012                 position 4;
1013                 //description "1 Gb half-duplex rate support.";
1014             }
1015             bit 1gb-fd { 
1016                 position 5;
1017                 //description "1 Gb full-duplex rate support.";
1018             }
1019             bit 10gb-fd { 
1020                 position 6;
1021                 //description "10 Gb full-duplex rate support.";
1022             }
1023             bit copper { 
1024                 position 7;
1025                 //description "Copper medium.";
1026             }
1027             bit fiber { 
1028                 position 8;
1029                 //description "Fiber medium.";
1030             }
1031             bit autoneg { 
1032                 position 9;
1033                 //description "Auto-negotiation.";
1034             }
1035             bit pause { 
1036                 position 10;
1037                 //description "Pause.";
1038             }
1039             bit pause-asym { 
1040                 position 11;
1041                 //description "Asymmetric pause.";
1042             }
1043         }
1044     }
1045     
1046     typedef capabilities-v10 {
1047         type bits {
1048             bit OFPC_FLOW_STATS {
1049                 position 0;
1050                 /* Flow statistics. */
1051             } 
1052             bit OFPC_TABLE_STATS {
1053                 position 1;
1054                 /* Table statistics. */
1055             }
1056             bit OFPC_PORT_STATS {
1057                 position 2;
1058                 /* Port statistics. */
1059             }
1060             bit OFPC_STP {
1061                 position 3;
1062                 /* 802.1d spanning tree. */
1063             }
1064             bit OFPC_RESERVED {
1065                 position 4;
1066                 /* Reserved, must be zero. */
1067             }
1068             bit OFPC_IP_REASM {
1069                 position 5;
1070                 /* Can reassemble IP fragments. */
1071             }
1072             bit OFPC_QUEUE_STATS {
1073                 position 6;
1074                 /* Queue statistics. */
1075             }
1076             bit OFPC_ARP_MATCH_IP {
1077                 position 8;
1078                 /* Match IP addresses in ARP pkts. */
1079             }
1080         }
1081     }
1082     
1083     typedef flow-mod-flags-v10 {
1084         /* ofp_flow_mod_flags */
1085         type bits {
1086             bit OFPFF_SEND_FLOW_REM {
1087                 position 0;
1088                 /* Send flow removed message when flow expires or is deleted. */
1089             }
1090             bit OFPFF_CHECK_OVERLAP {
1091                 position 1;
1092                 /* Check for overlapping entries first. */
1093             }
1094             bit OFPFF_EMERG {
1095                 position 2;
1096                 /* Reset flow packet and byte counts. */
1097             }
1098         }
1099     }
1100     
1101     typedef action-type-v10 {
1102         /* ofp_action_type */
1103         type bits {
1104             bit OFPAT_OUTPUT {
1105                 position 0;
1106                 /* Output to switch port. */
1107             }
1108             bit OFPAT_SET_VLAN_VID {
1109                 position 1;
1110                 /* Set the 802.1q VLAN id. */
1111             }
1112             bit OFPAT_SET_VLAN_PCP {
1113                 position 2;
1114                 /* Set the 802.1q priority. */
1115             }
1116             bit OFPAT_STRIP_VLAN {
1117                 position 3;
1118                 /* Strip the 802.1q header. */
1119             }
1120             bit OFPAT_SET_DL_SRC {
1121                 position 4;
1122                 /* Ethernet source address. */
1123             }
1124             bit OFPAT_SET_DL_DST {
1125                 position 5;
1126                 /* Ethernet destination address. */
1127             }
1128             bit OFPAT_SET_NW_SRC {
1129                 position 6;
1130                 /* IP source address. */
1131             }
1132             bit OFPAT_SET_NW_DST {
1133                 position 7;
1134                 /* IP destination address. */
1135             }
1136             bit OFPAT_SET_NW_TOS {
1137                 position 8;
1138                 /* IP ToS (DSCP field, 6 bits). */
1139             }
1140             bit OFPAT_SET_TP_SRC {
1141                 position 9;
1142                 /* TCP/UDP source port. */
1143             }
1144             bit OFPAT_SET_TP_DST {
1145                 position 10;
1146                 /* TCP/UDP destination port. */
1147             }
1148             bit OFPAT_ENQUEUE {
1149                 position 11;
1150                 /* Output to queue. */
1151             }
1152             bit OFPAT_VENDOR {
1153                 position 12;
1154                 /* Experimenter in later versions */
1155             }
1156         }
1157     }
1158     
1159     typedef error-type-v10 {
1160         type enumeration {
1161             enum HELLO_FAILED {
1162                 value 0; 
1163                 description "Hello Protocol failed.";
1164             }
1165             enum BAD_REQUEST {
1166                 value 1; 
1167                 description "Request was not understood.";
1168             }
1169             enum BAD_ACTION {
1170                 value 2; 
1171                 description "Error in action description.";
1172             }
1173             enum FLOW_MOD_FAILED {
1174                 value 3; 
1175                 description "Problem modifying flow entry.";
1176             }
1177             enum PORT_MOD_FAILED {
1178                 value 4; 
1179                 description "Port mod request failed.";
1180             }
1181             enum QUEUE_OP_FAILED {
1182                 value 5; 
1183                 description "Queue operation failed.";
1184             }
1185         }
1186     }
1187 }