Merge "Removed enumeration ALL from FlowWildCardsV10"
[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             }
18             enum IN_PORT {
19                 value -8; // 0xfffffff8
20             }
21             enum TABLE {
22                 value -7; // 0xfffffff9 
23             }
24             enum NORMAL {
25                 value -6; // 0xfffffffa 
26             }
27             enum FLOOD {
28                 value -5; // 0xfffffffb 
29             }
30             enum ALL {
31                 value -4; // 0xfffffffc 
32             }
33             enum CONTROLLER {
34                 value -3; // 0xfffffffd
35             }
36             enum LOCAL {
37                 value -2; // 0xfffffffe
38             }
39             enum ANY {
40                 value -1; // 0xffffffff
41             }
42         }
43     }
44
45     typedef port-features {
46         ////description "Features of ports available in datapath.";
47         //reference "ofp_port_features";
48         type bits {
49             bit _10mb_hd { 
50                 position 0;
51                 //description "10 Mb half-duplex rate support.";
52             }
53             bit _10mb-fd { 
54                 position 1;
55                 //description "10 Mb full-duplex rate support.";
56             }
57             bit _100mb-hd { 
58                 position 2;
59                 //description "100 Mb half-duplex rate support.";
60             }
61             bit _100mb-fd { 
62                 position 3;
63                 //description "100 Mb full-duplex rate support.";
64             }
65             bit _1gb-hd { 
66                 position 4;
67                 //description "1 Gb half-duplex rate support.";
68             }
69             bit _1gb-fd { 
70                 position 5;
71                 //description "1 Gb full-duplex rate support.";
72             }
73             bit _10gb-fd { 
74                 position 6;
75                 //description "10 Gb full-duplex rate support.";
76             }
77             bit _40gb-fd { 
78                 position 7;
79                 //description "40 Gb full-duplex rate support.";
80             }
81             bit _100gb-fd { 
82                 position 8;
83                 //description "100 Gb full-duplex rate support.";
84             }
85             bit _1tb-fd { 
86                 position 9;
87                 //description "1 Tb full-duplex rate support.";
88             }
89             bit other { 
90                 position 10;
91                 //description "Other rate, not in the list.";
92             }
93             bit copper { 
94                 position 11;
95                 //description "Copper medium.";
96             }
97             bit fiber { 
98                 position 12;
99                 //description "Fiber medium.";
100             }
101             bit autoneg { 
102                 position 13;
103                 //description "Auto-negotiation.";
104             }
105             bit pause { 
106                 position 14;
107                 //description "Pause.";
108             }
109             bit pause-asym { 
110                 position 15;
111                 //description "Asymmetric pause.";
112             }
113         }
114     }
115
116     typedef port-config {
117         description 
118            "Flags to indicate behavior of the physical port. These flags are
119             describe the current configuration and used port_mod message 
120             to configure the port's behavior.";
121         type bits {
122             bit port-down { 
123                 //description " Port is administratively down.";
124                 position 0;
125             }
126             bit no-recv { 
127                 //description " Drop all packets received by port.";
128                 position 2;
129             }
130             bit no-fwd { 
131                 //description " Drop packets forwarded to port.";
132                 position 5;
133             }
134             bit no-packet-in { 
135                 //description "Do not send packet-in msgs for port.";
136                 position 6;
137             }
138         }
139     }
140
141     typedef port-state {
142         description 
143             "Current state of the physical port. These are not configurable from
144             the controller.";
145         type bits {
146             bit link_down {
147                 //description "No physical link present.";
148                 position 0;
149             }
150             bit blocked {
151                 //description "Port is blocked";
152                 position 1;
153             }
154             bit live {
155                 //description "Live for Fast Failover Group.";
156                 position 2;
157             }
158         }
159     }
160
161     identity match-type-base {
162         description 
163            "The match type indicates the match structure (set of fields that compose the
164             match) in use. The match type is placed in the type field at the beginning
165             of all match structures.Extensions that define match types may be 
166             published on the ONF wiki. Support for extensions is optional.";
167     }
168
169     identity standard-match-type {
170         base oft:match-type-base;
171     }
172
173     identity instruction {
174     }
175
176     identity action {
177     }
178
179     typedef metadata {
180         type binary;
181     }
182
183     typedef table-id {
184         type uint32;
185     }
186     typedef meter-id {
187         type uint32;
188     }
189     typedef queue-id {
190         type uint32;
191     }
192     typedef group-id {
193         type uint32;
194     }
195
196     typedef ether-type {
197         type uint16;
198     }
199
200     typedef error-type {
201         type enumeration {
202             enum HELLO_FAILED {
203                 value 0; 
204                 description "Hello Protocol failed.";
205             }
206             enum BAD_REQUEST {
207                 value 1; 
208                 description "Request was not understood.";
209             }
210             enum BAD_ACTION {
211                 value 2; 
212                 description "Error in action description.";
213             }
214             enum BAD_INSTRUCTION {
215                 value 3; 
216                 description "Error in instruction list.";
217             }
218             enum BAD_MATCH {
219                 value 4; 
220                 description "Error in match.";
221             }
222             enum FLOW_MOD_FAILED {
223                 value 5; 
224                 description "Problem modifying flow entry.";
225             }
226             enum GROUP_MOD_FAILED {
227                 value 6; 
228                 description "Problem modifying group entry.";
229             }
230             enum PORT_MOD_FAILED {
231                 value 7; 
232                 description "Port mod request failed.";
233             }
234             enum TABLE_MOD_FAILED {
235                 value 8; 
236                 description "Table mod request failed.";
237             }
238             enum QUEUE_OP_FAILED {
239                 value 9; 
240                 description "Queue operation failed.";
241             }
242             enum SWITCH_CONFIG_FAILED {
243                 value 10; 
244                 description "Switch config request failed.";
245             }
246             enum ROLE_REQUEST_FAILED {
247                 value 11; 
248                 description "Controller Role request failed.";
249             }
250             enum METER_MOD_FAILED {
251                 value 12; 
252                 description "Error in meter.";
253             }
254             enum TABLE_FEATURES_FAILED {
255                 value 13; 
256                 description "Setting table features failed.";
257             }
258             enum EXPERIMENTER {
259                 value 65535; //0xffff 
260                 description "Experimenter error messages.";
261             }
262         }
263     }
264     
265     typedef hello-failed-code {
266         type enumeration {
267             enum INCOMPATIBLE {
268                 value 0; 
269                 description "Hello Protocol failed.";
270             }
271             enum EPERM {
272                 value 1; 
273                 description "Request was not understood.";
274             }
275         }
276     }
277     
278     typedef bad-request-code {
279         type enumeration {
280             enum BAD_VERSION {
281                 value 0; 
282             }
283             enum BAD_TYPE {
284                 value 1; 
285             }
286             enum BAD_MULTIPART {
287                 value 2; 
288             }
289             enum BAD_EXPERIMENTER {
290                 value 3; 
291             }
292             enum BAD_EXP_TYPE {
293                 value 4; 
294             }
295             enum EPERM {
296                 value 5; 
297             }
298             enum BAD_LEN {
299                 value 6; 
300             }
301             enum BUFFER_EMPTY {
302                 value 7; 
303             }
304             enum BUFFER_UNKNOWN {
305                 value 8; 
306             }
307             enum BAD_TABLE_ID {
308                 value 9; 
309             }
310             enum IS_SLAVE {
311                 value 10; 
312             }
313             enum BAD_PORT {
314                 value 11; 
315             }
316             enum BAD_PACKET {
317                 value 12; 
318             }
319             enum MULTIPART_BUFFER_OVERFLOW {
320                 value 13; 
321             }
322         }
323     }
324     
325     typedef bad-action-code {
326         type enumeration {
327             enum BAD_TYPE {
328                 value 0; 
329             }
330             enum BAD_LEN {
331                 value 1; 
332             }
333             enum BAD_EXPERIMENTER {
334                 value 2; 
335             }
336             enum BAD_EXP_TYPE {
337                 value 3; 
338             }
339             enum BAD_OUT_PORT {
340                 value 4; 
341             }
342             enum BAD_ARGUMENT {
343                 value 5; 
344             }
345             enum EPERM {
346                 value 6; 
347             }
348             enum TOO_MANY {
349                 value 7; 
350             }
351             enum BAD_QUEUE {
352                 value 8; 
353             }
354             enum BAD_OUT_GROUP {
355                 value 9; 
356             }
357             enum MATCH_INCONSISTENT {
358                 value 10; 
359             }
360             enum UNSUPPORTED_ORDER {
361                 value 11; 
362             }
363             enum BAD_TAG {
364                 value 12; 
365             }
366             enum BAD_SET_TYPE {
367                 value 13; 
368             }
369             enum BAD_SET_LEN {
370                 value 14; 
371             }
372             enum BAD_SET_ARGUMENT {
373                 value 15; 
374             }
375         }
376     }
377     
378     typedef bad-instruction-code {
379         type enumeration {
380             enum UNKNOWN_INST {
381                 value 0; 
382             }
383             enum UNSUP_INST {
384                 value 1; 
385             }
386             enum BAD_TABLE_ID {
387                 value 2; 
388             }
389             enum UNSUP_METADATA {
390                 value 3; 
391             }
392             enum UNSUP_METADATA_MASK {
393                 value 4; 
394             }
395             enum BAD_EXPERIMENTER {
396                 value 5; 
397             }
398             enum BAD_EXP_TYPE {
399                 value 6; 
400             }
401             enum BAD_LEN {
402                 value 7; 
403             }
404             enum EPERM {
405                 value 8; 
406             }
407         }
408     }
409     
410     typedef bad-match-code {
411         type enumeration {
412             enum BAD_TYPE {
413                 value 0; 
414             }
415             enum BAD_LEN {
416                 value 1; 
417             }
418             enum BAD_TAG {
419                 value 2; 
420             }
421             enum BAD_DL_ADDR_MASK {
422                 value 3; 
423             }
424             enum BAD_NW_ADDR_MASK {
425                 value 4; 
426             }
427             enum BAD_WILDCARDS {
428                 value 5; 
429             }
430             enum BAD_FIELD {
431                 value 6; 
432             }
433             enum BAD_VALUE {
434                 value 7; 
435             }
436             enum BAD_MASK {
437                 value 8; 
438             }
439             enum BAD_PREREQ {
440                 value 9; 
441             }
442             enum DUP_FIELD {
443                 value 10; 
444             }
445             enum EPERM {
446                 value 11; 
447             }
448         }
449     }
450     
451     typedef flow-mod-failed-code {
452         type enumeration {
453             enum UNKNOWN {
454                 value 0; 
455             }
456             enum TABLE_FULL {
457                 value 1; 
458             }
459             enum BAD_TABLE_ID {
460                 value 2; 
461             }
462             enum OVERLAP {
463                 value 3; 
464             }
465             enum EPERM {
466                 value 4; 
467             }
468             enum BAD_TIMEOUT {
469                 value 5; 
470             }
471             enum BAD_COMMAND {
472                 value 6; 
473             }
474             enum BAD_FLAGS {
475                 value 7; 
476             }
477         }
478     }
479     
480     typedef group-mod-failed-code {
481         type enumeration {
482             enum GROUP_EXISTS {
483                 value 0; 
484             }
485             enum INVALID_GROUP {
486                 value 1; 
487             }
488             enum WEIGHT_UNSUPPORTED {
489                 value 2; 
490             }
491             enum OUT_OF_GROUPS {
492                 value 3; 
493             }
494             enum OUT_OF_BUCKETS {
495                 value 4; 
496             }
497             enum CHAINING_UNSUPPORTED {
498                 value 5; 
499             }
500             enum WATCH_UNSUPPORTED {
501                 value 6; 
502             }
503             enum LOOP {
504                 value 7; 
505             }
506             enum UNKNOWN_GROUP {
507                 value 8; 
508             }
509             enum CHAINED_GROUP {
510                 value 9; 
511             }
512             enum BAD_TYPE {
513                 value 10; 
514             }
515             enum BAD_COMMAND {
516                 value 11; 
517             }
518             enum BAD_BUCKET {
519                 value 12; 
520             }
521             enum BAD_WATCH {
522                 value 13; 
523             }
524             enum EPERM {
525                 value 14; 
526             }
527         }
528     }
529     
530     typedef port-mod-failed-code {
531         type enumeration {
532             enum BAD_PORT {
533                 value 0; 
534             }
535             enum BAD_HW_ADDR {
536                 value 1; 
537             }
538             enum BAD_CONFIG {
539                 value 2; 
540             }
541             enum BAD_ADVERTISE {
542                 value 3; 
543             }
544             enum EPERM {
545                 value 4; 
546             }
547         }
548     }
549     
550     typedef table-mod-failed-code {
551         type enumeration {
552             enum BAD_TABLE {
553                 value 0; 
554             }
555             enum BAD_CONFIG {
556                 value 1; 
557             }
558             enum EPERM {
559                 value 2; 
560             }
561         }
562     }
563
564     typedef queue-op-failed-code {
565         type enumeration {
566             enum BAD_PORT {
567                 value 0; 
568             }
569             enum BAD_QUEUE {
570                 value 1; 
571             }
572             enum EPERM {
573                 value 2; 
574             }
575         }
576     }
577     
578     typedef switch-config-failed-code {
579         type enumeration {
580             enum BAD_FLAGS {
581                 value 0; 
582             }
583             enum BAD_LEN {
584                 value 1; 
585             }
586             enum EPERM {
587                 value 2; 
588             }
589         }
590     }
591     
592     typedef role-request-failed-code {
593         type enumeration {
594             enum STALE {
595                 value 0; 
596             }
597             enum UNSUP {
598                 value 1; 
599             }
600             enum BAD_ROLE {
601                 value 2; 
602             }
603         }
604     }
605     
606     typedef meter-mod-failed-code {
607         type enumeration {
608             enum UNKNOWN {
609                 value 0; 
610             }
611             enum METER_EXISTS {
612                 value 1; 
613             }
614             enum INVALID_METER {
615                 value 2; 
616             }
617             enum UNKNOWN_METER {
618                 value 3; 
619             }
620             enum BAD_COMMAND {
621                 value 4; 
622             }
623             enum BAD_FLAGS {
624                 value 5; 
625             }
626             enum BAD_RATE {
627                 value 6; 
628             }
629             enum BAD_BURST {
630                 value 7; 
631             }
632             enum BAD_BAND {
633                 value 8; 
634             }
635             enum BAD_BAND_VALUE {
636                 value 9; 
637             }
638             enum OUT_OF_METERS {
639                 value 10; 
640             }
641             enum OUT_OF_BANDS {
642                 value 11; 
643             }
644         }
645     }
646     
647     typedef table-features-failed-code {
648         type enumeration {
649             enum BAD_TABLE {
650                 value 0; 
651             }
652             enum BAD_METADATA {
653                 value 1; 
654             }
655             enum BAD_TYPE {
656                 value 2; 
657             }
658             enum BAD_LEN {
659                 value 3; 
660             }
661             enum BAD_ARGUMENT {
662                 value 4; 
663             }
664             enum EPERM {
665                 value 5; 
666             }
667         }
668     }
669     
670     typedef hello-element-type {
671         type enumeration {
672             enum VERSIONBITMAP {
673                 value 1; 
674                 description "Bitmap of version supported.";
675             }
676         }
677     }
678     
679     typedef capabilities {
680         type bits {
681             bit OFPC_FLOW_STATS {
682                 position 0;
683                 /* Flow statistics. */
684             } 
685             bit OFPC_TABLE_STATS {
686                 position 1;
687                 /* Table statistics. */
688             }
689             bit OFPC_PORT_STATS {
690                 position 2;
691                 /* Port statistics. */
692             }
693             bit OFPC_GROUP_STATS {
694                 position 3;
695                 /* Group statistics. */
696             }
697             bit OFPC_IP_REASM {
698                 position 5;
699                 /* Can reassemble IP fragments. */
700             }
701             bit OFPC_QUEUE_STATS {
702                 position 6;
703                 /* Queue statistics. */
704             }
705             bit OFPC_PORT_BLOCKED {
706                 position 8;
707                 /* Switch will block looping ports. */
708             }
709         }
710     }
711
712     typedef switch-config-flag {
713         /* Handling of IP fragments. */
714         type enumeration {
715             enum FRAG_NORMAL {
716                 value 0; 
717                 description "No special handling for fragments.";
718             }
719             enum OFPC_FRAG_DROP {
720                 value 1; 
721                 description "Drop fragments.";
722             }
723             enum OFPC_FRAG_REASM {
724                 value 2; 
725                 description "Reassemble (only if OFPC_IP_REASM set).";
726             }
727             enum OFPC_FRAG_MASK {
728                 value 3; 
729             }
730         }
731     }
732
733     typedef flow-removed-reason {
734         /* flow removed */
735         type enumeration {
736             enum OFPRR_IDLE_TIMEOUT {
737                 value 0;
738                 description "Flow idle time exceeded idle_timeout.";
739             }
740             enum OFPRR_HARD_TIMEOUT {
741                 value 1;
742                 description "Time exceeded hard_timeout.";
743             }
744             enum OFPRR_DELETE {
745                 value 2;
746                 description "Evicted by a DELETE flow mod.";
747             }
748             enum OFPRR_GROUP_DELETE {
749                 value 3;
750                 description "Group was removed.";
751             }
752         }
753     }
754
755     typedef port-reason {
756         /* port status */
757         type enumeration {
758             enum OFPPR_ADD {
759                 value 0;
760                 description "The port was added.";
761             }
762             enum OFPPR_DELETE {
763                 value 1;
764                 description "he port was removed.";
765             }
766             enum OFPPR_MODIFY {
767                 value 2;
768                 description "Some attribute of the port has changed.";
769             }
770         }
771     }
772
773     typedef flow-mod-command {
774         /* ofp_flow_mod_command */
775         type enumeration {
776             enum OFPFC_ADD {      
777                 value 0;      
778                 description "New flow.";    
779             }
780             enum OFPFC_MODIFY {
781                 value 1;
782                 description "Modify all matching flows.";
783             }
784             enum OFPFC_MODIFY_STRICT {
785                 value 2;
786                 description "Modify entry strictly matching wildcards and priority.";
787             }
788             enum OFPFC_DELETE {
789                 value 3;
790                 description "Delete all matching flows.";
791             }
792             enum OFPFC_DELETE_STRICT {
793                 value 4;
794                 description "Delete entry strictly matching wildcards and priority.";
795             }
796         }
797     }
798
799     typedef flow-mod-flags {
800         /* ofp_flow_mod_flags */
801         type bits {
802             bit OFPFF_SEND_FLOW_REM {
803                 position 0;
804                 /* Send flow removed message when flow expires or is deleted. */
805             }
806             bit OFPFF_CHECK_OVERLAP {
807                 position 1;
808                 /* Check for overlapping entries first. */
809             }
810             bit OFPFF_RESET_COUNTS {
811                 position 2;
812                 /* Reset flow packet and byte counts. */
813             }
814             bit OFPFF_NO_PKT_COUNTS {
815                 position 3;
816                 /* Don't keep track of packet count. */
817             }
818             bit OFPFF_NO_BYT_COUNTS {
819                 position 4;
820                 /* Don't keep track of byte count. */
821             }
822         }
823     }
824
825     typedef group-mod-command {
826         /* ofp_group_mod_command */
827         type enumeration {
828             enum OFPGC_ADD {            
829               value 0;            
830               description "New group.";            
831             }
832             enum OFPGC_MODIFY {
833               value 1;
834               description "Modify all matching groups.";
835             }
836             enum OFPGC_DELETE {
837               value 2;
838               description "Delete all matching groups.";
839             }
840             
841         }
842     }
843
844     typedef group-type {
845         /* ofp_group_type */
846         type enumeration {
847             enum OFPGT_ALL {            
848               value 0;            
849               description "All (multicast/broadcast) group.";            
850             }
851             enum OFPGT_SELECT {
852               value 1;
853               description "Select group.";
854             }
855             enum OFPGT_INDIRECT {
856               value 2;
857               description "Indirect group.";
858             }
859             enum OFPGT_FF {
860               value 3;
861               description "Fast failover group.";
862             }
863         }
864     }
865     
866     typedef table-values {
867         /* ofp_table */
868         type enumeration {
869             enum OFPTT_MAX {            
870               value 254; // 0xfe             
871               description "Last usable table number.";            
872             }
873             enum OFPTT_ALL {
874               value 255; // 0xff
875               description "Wildcard table used for table config, 
876                            flow stats and flow deletes.";
877             }
878         }
879     }
880
881         typedef group {
882                 /* ofp_group - Group numbering. Groups can use any number up to OFPG_MAX.*/
883                 type enumeration {
884                         enum OFPG_MAX {
885                                 value -256; //0xffffff00
886                                 description "Last usable group number";
887                         }
888                         
889                         /* Fake groups. */
890                         enum OFPG_ALL {
891                                 value -4; //0xfffffffc
892                                 description "Represents all groups for group delete commands";
893                         }
894                         enum OFPG_ANY {
895                                 value -1; //0xffffffff
896                                 description "Wildcard group used only for flow stats requests. 
897                                                                 Selects all flows regardless of group (including flows with no group)";
898                                 
899                         }
900                 }
901                 
902         }
903         
904     typedef multipart-request-flags {
905         description
906             "enum ofp_multipart_request_flags ";
907         type bits {
908             bit OFPMPF_REQ_MORE {
909                 //description "More requests to follow.";
910                 position 0;
911             }
912         }
913     }
914
915     typedef multipart-type {
916         /* ofp_multipart_type */
917         type enumeration {
918             enum OFPMP_DESC {
919               value 0;
920               description "Description of this OpenFlow switch.
921                  The request body is empty.
922                  The reply body is struct ofp_desc.";
923             }
924             enum OFPMP_FLOW {
925               value 1;
926               description "Individual flow statistics.
927                  The request body is struct ofp_flow_stats_request.
928                  The reply body is an array of struct ofp_flow_stats.";
929             }
930             enum OFPMP_AGGREGATE {
931               value 2;
932               description "Aggregate flow statistics.
933                  The request body is struct ofp_aggregate_stats_request.
934                  The reply body is struct ofp_aggregate_stats_reply.";
935             }
936             enum OFPMP_TABLE {
937               value 3;
938               description "Flow table statistics.
939                  The request body is empty.
940                  The reply body is an array of struct ofp_table_stats.";
941             }
942             enum OFPMP_PORT_STATS {
943               value 4;
944               description "Port statistics.
945                  The request body is struct ofp_port_stats_request.
946                  The reply body is an array of struct ofp_port_stats.";
947             }
948             enum OFPMP_QUEUE {
949               value 5;
950               description "Queue statistics for a port
951                  The request body is struct ofp_queue_stats_request.
952                  The reply body is an array of struct ofp_queue_stats";
953             }
954             enum OFPMP_GROUP {
955               value 6;
956               description "Group counter statistics.
957                  The request body is struct ofp_group_stats_request.
958                  The reply is an array of struct ofp_group_stats.";
959             }
960             enum OFPMP_GROUP_DESC {
961               value 7;
962               description "Group description.
963                  The request body is empty.
964                  The reply body is an array of struct ofp_group_desc.";
965             }
966             enum OFPMP_GROUP_FEATURES {
967               value 8;
968               description "Group features.
969                  The request body is empty.
970                  The reply body is struct ofp_group_features.";
971             }
972             enum OFPMP_METER {
973               value 9;
974               description "Meter statistics.
975                  The request body is struct ofp_meter_multipart_requests.
976                  The reply body is an array of struct ofp_meter_stats.";
977             }
978             enum OFPMP_METER_CONFIG {
979               value 10;
980               description "Meter configuration.
981                  The request body is struct ofp_meter_multipart_requests.
982                  The reply body is an array of struct ofp_meter_config.";
983             }
984             enum OFPMP_METER_FEATURES {
985               value 11;
986               description "Meter features.
987                  The request body is empty.
988                  The reply body is struct ofp_meter_features.";
989             }
990             enum OFPMP_TABLE_FEATURES {
991               value 12;
992               description "Table features.
993                  The request body is either empty or contains an array of
994                  struct ofp_table_features containing the controller’s
995                  desired view of the switch. If the switch is unable to
996                  set the specified view an error is returned.
997                  The reply body is an array of struct ofp_table_features.";
998             }
999             enum OFPMP_PORT_DESC {
1000               value 13;
1001               description "Port description.
1002                  The request body is empty.
1003                  The reply body is an array of struct ofp_port.";
1004             }
1005             enum OFPMP_EXPERIMENTER {
1006               value 65535; //0xffff
1007               description "Experimenter extension.
1008                  The request and reply bodies begin with
1009                  struct ofp_experimenter_multipart_header.
1010                  The request and reply bodies are otherwise experimenter-defined.";
1011             }
1012         }
1013     }
1014
1015     typedef queue-properties {
1016         /* ofp_queue_properties */
1017         type enumeration {
1018             enum OFPQT_NONE {
1019               value 0;
1020               description "No property defined for queue (default).";
1021             }
1022             enum OFPQT_MIN_RATE {
1023                 value 1;
1024                 description "Minimum datarate guaranteed.";
1025             }
1026             enum OFPQT_MAX_RATE {
1027                 value 2;
1028                 description "Maximum datarate.";
1029             }
1030             enum OFPQT_EXPERIMENTER {
1031                 value 65535; // 0xffff 
1032                 description "Experimenter defined property.";
1033             }
1034         }
1035     }
1036
1037     typedef controller-role {
1038         /* ofp_controller_role */
1039         type enumeration {
1040             enum OFPCR_ROLE_NOCHANGE {
1041               value 0;
1042               description "Don’t change current role.";
1043             }
1044             enum OFPCR_ROLE_EQUAL {
1045               value 1;
1046               description "Default role, full access.";
1047             }
1048             enum OFPCR_ROLE_MASTER {
1049               value 2;
1050               description "Full access, at most one master.";
1051             }
1052             enum OFPCR_ROLE_SLAVE {
1053               value 3;
1054               description "Read-only access.";
1055             }
1056         }
1057     }
1058
1059     typedef packet-in-reason {
1060         /* ofp_packet_in_reason */
1061         type enumeration {
1062             enum OFPR_NO_MATCH {
1063               value 0;
1064               description "No matching flow (table-miss flow entry). ";
1065             }
1066             enum OFPR_ACTION {
1067               value 1;
1068               description "Action explicitly output to controller. ";
1069             }
1070             enum OFPR_INVALID_TTL {
1071               value 2;
1072               description "Packet has invalid TTL ";
1073             }
1074         }
1075     }
1076     
1077     typedef action-type {
1078         /* ofp_action_type */
1079         type bits {
1080             bit OFPAT_OUTPUT {
1081                 position 0;
1082                 /* Output to switch port. */
1083             }
1084             bit OFPAT_COPY_TTL_OUT {
1085                 position 1;
1086                 /* Copy TTL "outwards" -- from next-to-outermost to outermost */
1087             }
1088             bit OFPAT_COPY_TTL_IN {
1089                 position 2;
1090                 /* Copy TTL "inwards" -- from outermost to next-to-outermost */
1091             }
1092             bit OFPAT_SET_MPLS_TTL {
1093                 position 3;
1094                 /* MPLS TTL */
1095             }
1096             bit OFPAT_DEC_MPLS_TTL {
1097                 position 4;
1098                 /* Decrement MPLS TTL */
1099             }
1100             bit OFPAT_PUSH_VLAN {
1101                 position 5;
1102                 /* Push a new VLAN tag */
1103             }
1104             bit OFPAT_POP_VLAN {
1105                 position 6;
1106                 /* Pop the outer VLAN tag */
1107             }
1108             bit OFPAT_PUSH_MPLS {
1109                 position 7;
1110                 /* Push a new MPLS tag */
1111             }
1112             bit OFPAT_POP_MPLS {
1113                 position 8;
1114                 /* Pop the outer MPLS tag */
1115             }
1116             bit OFPAT_SET_QUEUE {
1117                 position 9;
1118                 /* Set queue id when outputting to a port */
1119             }
1120             bit OFPAT_GROUP {
1121                 position 10;
1122                 /* Apply group. */
1123             }
1124             bit OFPAT_SET_NW_TTL {
1125                 position 11;
1126                 /* IP TTL. */
1127             }
1128             bit OFPAT_DEC_NW_TTL {
1129                 position 12;
1130                 /* Decrement IP TTL. */
1131             }
1132             bit OFPAT_SET_FIELD {
1133                 position 13;
1134                 /* Set a header field using OXM TLV format. */
1135             }
1136             bit OFPAT_PUSH_PBB {
1137                 position 14;
1138                 /* Push a new PBB service tag (I-TAG) */
1139             }
1140             bit OFPAT_POP_PBB {
1141                 position 15;
1142                 /* Pop the outer PBB service tag (I-TAG) */
1143             }
1144             bit OFPAT_EXPERIMENTER {
1145                 position 16;
1146             }
1147         }
1148     }
1149
1150     typedef meter-mod-command {
1151         /* ofp_meter_mod_command */
1152         type enumeration {
1153             enum OFPMC_ADD {
1154               description "New meter. ";
1155             }
1156             enum OFPMC_MODIFY {
1157               description "Modify specified meter. ";
1158             }
1159             enum OFPMC_DELETE {
1160               description "Delete specified meter. ";
1161             }
1162         }
1163     }
1164
1165     typedef meter-flags {
1166         /* ofp_meter_flags */
1167         type bits {
1168             bit OFPMF_KBPS {
1169                 position 0;
1170                 /* Rate value in kb/s (kilo-bit per second). */
1171             }
1172             bit OFPMF_PKTPS {
1173                 position 1;
1174                 /* Rate value in packet/sec. */
1175             }
1176             bit OFPMF_BURST {
1177                 position 2;
1178                 /* Do burst size. */
1179             }
1180             bit OFPMF_STATS {
1181                 position 3;
1182                 /* Collect statistics. */
1183             }
1184         }
1185     }
1186
1187     typedef meter-band-type {
1188         /* ofp_meter_band_type */
1189         type enumeration {
1190             enum OFPMBT_DROP {
1191               value 1;
1192               description "Drop packet. ";
1193             }
1194             enum OFPMBT_DSCP_REMARK {
1195               value 2;
1196               description "Remark DSCP in the IP header. ";
1197             }
1198             enum OFPMBT_EXPERIMENTER {
1199               value 65535; //0xFFFF
1200               description "Experimenter meter band. ";
1201             }
1202         }
1203     }
1204     
1205     typedef meter-band-type-bitmap {
1206         /* ofp_meter_band_type */
1207         type bits {
1208             bit OFPMBT_DROP {
1209               position 1;
1210               description "Drop packet. ";
1211             }
1212             bit OFPMBT_DSCP_REMARK {
1213               position 2;
1214               description "Remark DSCP in the IP header. ";
1215             }
1216         }
1217     }
1218
1219         typedef meter {
1220                 /* ofp_meter - Meter numbering. Flow meters can use any number up to OFPM_MAX*/
1221                 type enumeration {
1222                         enum OFPM_MAX {
1223                                 value -65536; //0xffff0000
1224                                 description "Last usable meter number";
1225                         }
1226                         
1227                         /* Virtual meters. */
1228                         enum OFPM_SLOWPATH {
1229                                 value -3; //0xfffffffd
1230                                 description "Meter for slow datapath";
1231                         }
1232                         enum OFPM_CONTROLLER {
1233                                 value -2; //0xfffffffe
1234                                 description "Meter for controller connection";
1235                         }
1236                         enum OFPM_ALL {
1237                                 value -1; //0xffffffff
1238                                 description "Represents all meters for stat requests commands";
1239                         }
1240                 }
1241                 
1242         }
1243
1244     typedef table-config {
1245         /* ofp_table_config */
1246         type bits {
1247             bit OFPTC_DEPRECATED_MASK {
1248                 /* Deprecated bits */
1249                 position 3;
1250             }
1251         }
1252     }
1253
1254     typedef table-features-prop-type {
1255         type enumeration {
1256             enum OFPTFPT_INSTRUCTIONS {
1257                 value 0; 
1258                 description "Instructions property.";
1259             }
1260             enum OFPTFPT_INSTRUCTIONS_MISS {
1261                 value 1; 
1262                 description "Instructions for table-miss.";
1263             }
1264             enum OFPTFPT_NEXT_TABLES {
1265                 value 2; 
1266                 description "Next Table property.";
1267             }
1268             enum OFPTFPT_NEXT_TABLES_MISS {
1269                 value 3; 
1270                 description "Next Table for table-miss.";
1271             }
1272             enum OFPTFPT_WRITE_ACTIONS {
1273                 value 4; 
1274                 description "Write Actions property.";
1275             }
1276             enum OFPTFPT_WRITE_ACTIONS_MISS {
1277                 value 5; 
1278                 description "Write Actions for table-miss.";
1279             }
1280             enum OFPTFPT_APPLY_ACTIONS {
1281                 value 6; 
1282                 description "Apply Actions property.";
1283             }
1284             enum OFPTFPT_APPLY_ACTIONS_MISS {
1285                 value 7; 
1286                 description "Apply Actions for table-miss.";
1287             }
1288             enum OFPTFPT_MATCH {
1289                 value 8; 
1290                 description "Match property.";
1291             }
1292             enum OFPTFPT_WILDCARDS {
1293                 value 10; 
1294                 description "Wildcards property.";
1295             }
1296             enum OFPTFPT_WRITE_SETFIELD {
1297                 value 12; 
1298                 description "Write Set-Field property.";
1299             }
1300             enum OFPTFPT_WRITE_SETFIELD_MISS {
1301                 value 13; 
1302                 description "Write Set-Field for table-miss.";
1303             }
1304             enum OFPTFPT_APPLY_SETFIELD {
1305                 value 14; 
1306                 description "Apply Set-Field property.";
1307             }
1308             enum OFPTFPT_APPLY_SETFIELD_MISS {
1309                 value 15; 
1310                 description "Apply Set-Field for table-miss.";
1311             }
1312             enum OFPTFPT_EXPERIMENTER {
1313                 value 65534; 
1314                 description "Experimenter property.";
1315             }
1316             enum OFPTFPT_EXPERIMENTER_MISS {
1317                 value 65535; //0xffff 
1318                 description "Experimenter for table-miss.";
1319             }
1320         }
1321     }
1322
1323     typedef group-types {
1324         /* ofp_group_type */
1325         type bits {
1326             bit OFPGT_ALL {
1327                 /* All (multicast/broadcast) group. */
1328                 position 0;
1329             }
1330             bit OFPGT_SELECT {
1331                 /* Select group. */
1332                 position 1;
1333             }
1334             bit OFPGT_INDIRECT {
1335                 /* Indirect group. */
1336                 position 2;
1337             }
1338             bit OFPGT_FF {
1339                 /* Fast failover group. */
1340                 position 3;
1341             }
1342         }
1343     }
1344
1345     typedef group-capabilities {
1346         /* ofp_group_capabilities */
1347         type bits {
1348             bit OFPGFC_SELECT_WEIGHT {
1349                 /* Support weight for select groups */
1350                 position 0;
1351             }
1352             bit OFPGFC_SELECT_LIVENESS {
1353                 /* Support liveness for select groups */
1354                 position 1;
1355             }
1356             bit OFPGFC_CHAINING {
1357                 /* Support chaining groups */
1358                 position 2;
1359             }
1360             bit OFPGFC_CHAINING_CHECKS {
1361                 /* Check chaining for loops and delete */
1362                 position 3;
1363             }
1364         }
1365     }
1366     
1367 // OPENFLOW v1.0 STRUCTURES
1368     // Structures under this line are needed to support OpenFlow version 1.0 
1369     // wire protocol 0x01;
1370     
1371     typedef error-type-v10 {
1372         type enumeration {
1373             enum HELLO_FAILED {
1374                 value 0; 
1375                 description "Hello Protocol failed.";
1376             }
1377             enum BAD_REQUEST {
1378                 value 1; 
1379                 description "Request was not understood.";
1380             }
1381             enum BAD_ACTION {
1382                 value 2; 
1383                 description "Error in action description.";
1384             }
1385             enum FLOW_MOD_FAILED {
1386                 value 3; 
1387                 description "Problem modifying flow entry.";
1388             }
1389             enum PORT_MOD_FAILED {
1390                 value 4; 
1391                 description "Port mod request failed.";
1392             }
1393             enum QUEUE_OP_FAILED {
1394                 value 5; 
1395                 description "Queue operation failed.";
1396             }
1397         }
1398     }
1399     
1400     typedef hello-failed-code-v10 {
1401         type enumeration {
1402             enum INCOMPATIBLE {
1403                 value 0; 
1404                 description "Hello Protocol failed.";
1405             }
1406             enum EPERM {
1407                 value 1; 
1408                 description "Request was not understood.";
1409             }
1410         }
1411     }
1412     
1413     typedef bad-request-code-v10 {
1414         type enumeration {
1415             enum BAD_VERSION {
1416                 value 0; 
1417             }
1418             enum BAD_TYPE {
1419                 value 1; 
1420             }
1421             enum BAD_STAT {
1422                 value 2; 
1423             }
1424             enum BAD_VENDOR {
1425                 value 3; 
1426             }
1427             enum BAD_SUBTYPE {
1428                 value 4; 
1429             }
1430             enum EPERM {
1431                 value 5; 
1432             }
1433             enum BAD_LEN {
1434                 value 6; 
1435             }
1436             enum BUFFER_EMPTY {
1437                 value 7; 
1438             }
1439             enum BUFFER_UNKNOWN {
1440                 value 8; 
1441             }
1442         }
1443     }
1444     
1445     typedef bad-action-code-v10 {
1446         type enumeration {
1447             enum BAD_TYPE {
1448                 value 0; 
1449             }
1450             enum BAD_LEN {
1451                 value 1; 
1452             }
1453             enum VENDOR {
1454                 value 2; 
1455             }
1456             enum BAD_VENDOR_TYPE {
1457                 value 3; 
1458             }
1459             enum BAD_OUT_PORT {
1460                 value 4; 
1461             }
1462             enum BAD_ARGUMENT {
1463                 value 5; 
1464             }
1465             enum EPERM {
1466                 value 6; 
1467             }
1468             enum TOO_MANY {
1469                 value 7; 
1470             }
1471             enum BAD_QUEUE {
1472                 value 8; 
1473             }
1474         }
1475     }
1476     
1477     typedef flow-mod-failed-code-v10 {
1478         type enumeration {
1479             enum ALL_TABLES_FULL {
1480                 value 0; 
1481             }
1482             enum OVERLAP {
1483                 value 1; 
1484             }
1485             enum EPERM {
1486                 value 2; 
1487             }
1488             enum BAD_EMERG_TIMEOUT {
1489                 value 3; 
1490             }
1491             enum BAD_COMMAND {
1492                 value 4; 
1493             }
1494             enum UNSUPPORTED {
1495                 value 5; 
1496             }
1497         }
1498     }
1499     
1500     typedef port-mod-failed-code-v10 {
1501         type enumeration {
1502             enum BAD_PORT {
1503                 value 0; 
1504             }
1505             enum BAD_HW_ADDR {
1506                 value 1; 
1507             }
1508         }
1509     }
1510     
1511     typedef queue-op-failed-code-v10 {
1512         type enumeration {
1513             enum BAD_PORT {
1514                 value 0; 
1515             }
1516             enum BAD_QUEUE {
1517                 value 1; 
1518             }
1519             enum EPERM {
1520                 value 2; 
1521             }
1522         }
1523     }
1524     
1525     typedef port-number-values-v10 {
1526         type enumeration {
1527             enum MAX {
1528                 value 65280; // 0xff00 
1529             }
1530             enum IN_PORT {
1531                 value 65528; // 0xfff8
1532             }
1533             enum TABLE {
1534                 value 65529; // 0xfff9 
1535             }
1536             enum NORMAL {
1537                 value 65530; // 0xfffa 
1538             }
1539             enum FLOOD {
1540                 value 65531; // 0xfffb 
1541             }
1542             enum ALL {
1543                 value 65532; // 0xfffc 
1544             }
1545             enum CONTROLLER {
1546                 value 65533; // 0xfffd
1547             }
1548             enum LOCAL {
1549                 value 65534; // 0xfffe
1550             }
1551             enum NONE {
1552                 value 65535; // 0xffff
1553             }
1554         }
1555     }
1556     
1557     typedef port-config-v10 {
1558         description 
1559            "Flags to indicate behavior of the physical port. These flags are
1560             describe the current configuration and used port_mod message 
1561             to configure the port's behavior.";
1562         type bits {
1563             bit port-down { 
1564                 //description " Port is administratively down.";
1565                 position 0;
1566             }
1567             bit no-stp {
1568                 //description" Disable 802.1D spanning tree on port.";
1569                 position 1;
1570             }
1571             bit no-recv { 
1572                 //description " Drop all packets received by port.";
1573                 position 2;
1574             }
1575             bit no-recv-stp { 
1576                 //description " Drop received 802.1D STP packets.";
1577                 position 3;
1578             }
1579             bit no-flood { 
1580                 //description " Do not include this port when flooding.";
1581                 position 4;
1582             }
1583             bit no-fwd { 
1584                 //description " Drop packets forwarded to port.";
1585                 position 5;
1586             }
1587             bit no-packet-in { 
1588                 //description "Do not send packet-in msgs for port.";
1589                 position 6;
1590             }
1591         }
1592     }
1593     
1594     typedef port-state-v10 {
1595         description 
1596             "Current state of the physical port. These are not configurable from
1597             the controller.";
1598         type bits {
1599             bit link_down {
1600                 //description "No physical link present.";
1601                 position 0;
1602             }
1603             bit blocked {
1604                 //description "Port is blocked";
1605                 position 1;
1606             }
1607             bit live {
1608                 //description "Live for Fast Failover Group.";
1609                 position 2;
1610             }
1611             bit stp_listen {
1612                 //description "Not learning or relaying frames.";
1613             }
1614             bit stp_learn {
1615                 //description "Learning but not relaying frames.";
1616             }
1617             bit stp_forward {
1618                 //description "Learning and relaying frames.";
1619             }
1620             bit stp_block {
1621                 //description "Not part of spanning tree.";
1622             }
1623             bit stp_mask {
1624                 //description "Bit mask for OFPPS_STP_* values.";
1625             }
1626         }
1627     }
1628     
1629     typedef port-features-v10 {
1630         ////description "Features of ports available in datapath.";
1631         //reference "ofp_port_features";
1632         type bits {
1633             bit _10mb-hd { 
1634                 position 0;
1635                 //description "10 Mb half-duplex rate support.";
1636             }
1637             bit _10mb-fd { 
1638                 position 1;
1639                 //description "10 Mb full-duplex rate support.";
1640             }
1641             bit _100mb-hd { 
1642                 position 2;
1643                 //description "100 Mb half-duplex rate support.";
1644             }
1645             bit _100mb-fd { 
1646                 position 3;
1647                 //description "100 Mb full-duplex rate support.";
1648             }
1649             bit _1gb-hd { 
1650                 position 4;
1651                 //description "1 Gb half-duplex rate support.";
1652             }
1653             bit _1gb-fd { 
1654                 position 5;
1655                 //description "1 Gb full-duplex rate support.";
1656             }
1657             bit _10gb-fd { 
1658                 position 6;
1659                 //description "10 Gb full-duplex rate support.";
1660             }
1661             bit copper { 
1662                 position 7;
1663                 //description "Copper medium.";
1664             }
1665             bit fiber { 
1666                 position 8;
1667                 //description "Fiber medium.";
1668             }
1669             bit autoneg { 
1670                 position 9;
1671                 //description "Auto-negotiation.";
1672             }
1673             bit pause { 
1674                 position 10;
1675                 //description "Pause.";
1676             }
1677             bit pause-asym { 
1678                 position 11;
1679                 //description "Asymmetric pause.";
1680             }
1681         }
1682     }
1683     
1684     typedef capabilities-v10 {
1685         type bits {
1686             bit OFPC_FLOW_STATS {
1687                 position 0;
1688                 /* Flow statistics. */
1689             } 
1690             bit OFPC_TABLE_STATS {
1691                 position 1;
1692                 /* Table statistics. */
1693             }
1694             bit OFPC_PORT_STATS {
1695                 position 2;
1696                 /* Port statistics. */
1697             }
1698             bit OFPC_STP {
1699                 position 3;
1700                 /* 802.1d spanning tree. */
1701             }
1702             bit OFPC_RESERVED {
1703                 position 4;
1704                 /* Reserved, must be zero. */
1705             }
1706             bit OFPC_IP_REASM {
1707                 position 5;
1708                 /* Can reassemble IP fragments. */
1709             }
1710             bit OFPC_QUEUE_STATS {
1711                 position 6;
1712                 /* Queue statistics. */
1713             }
1714             bit OFPC_ARP_MATCH_IP {
1715                 position 8;
1716                 /* Match IP addresses in ARP pkts. */
1717             }
1718         }
1719     }
1720     
1721     typedef flow-mod-flags-v10 {
1722         /* ofp_flow_mod_flags */
1723         type bits {
1724             bit OFPFF_SEND_FLOW_REM {
1725                 position 0;
1726                 /* Send flow removed message when flow expires or is deleted. */
1727             }
1728             bit OFPFF_CHECK_OVERLAP {
1729                 position 1;
1730                 /* Check for overlapping entries first. */
1731             }
1732             bit OFPFF_EMERG {
1733                 position 2;
1734                 /* Reset flow packet and byte counts. */
1735             }
1736         }
1737     }
1738     
1739     typedef action-type-v10 {
1740         /* ofp_action_type */
1741         type bits {
1742             bit OFPAT_OUTPUT {
1743                 position 0;
1744                 /* Output to switch port. */
1745             }
1746             bit OFPAT_SET_VLAN_VID {
1747                 position 1;
1748                 /* Set the 802.1q VLAN id. */
1749             }
1750             bit OFPAT_SET_VLAN_PCP {
1751                 position 2;
1752                 /* Set the 802.1q priority. */
1753             }
1754             bit OFPAT_STRIP_VLAN {
1755                 position 3;
1756                 /* Strip the 802.1q header. */
1757             }
1758             bit OFPAT_SET_DL_SRC {
1759                 position 4;
1760                 /* Ethernet source address. */
1761             }
1762             bit OFPAT_SET_DL_DST {
1763                 position 5;
1764                 /* Ethernet destination address. */
1765             }
1766             bit OFPAT_SET_NW_SRC {
1767                 position 6;
1768                 /* IP source address. */
1769             }
1770             bit OFPAT_SET_NW_DST {
1771                 position 7;
1772                 /* IP destination address. */
1773             }
1774             bit OFPAT_SET_NW_TOS {
1775                 position 8;
1776                 /* IP ToS (DSCP field, 6 bits). */
1777             }
1778             bit OFPAT_SET_TP_SRC {
1779                 position 9;
1780                 /* TCP/UDP source port. */
1781             }
1782             bit OFPAT_SET_TP_DST {
1783                 position 10;
1784                 /* TCP/UDP destination port. */
1785             }
1786             bit OFPAT_ENQUEUE {
1787                 position 11;
1788                 /* Output to queue. */
1789             }
1790             bit OFPAT_VENDOR {
1791                 position 12;
1792                 /* Experimenter in later versions */
1793             }
1794         }
1795     }
1796     
1797     typedef flow-wildcards-v10 {
1798         /* ofp_flow_wildcards */
1799         type bits {
1800             bit IN_PORT {
1801                 position 0;
1802             }
1803             bit DL_VLAN {
1804                 position 1;
1805             }
1806             bit DL_SRC {
1807                 position 2;
1808             }
1809             bit DL_DST {
1810                 position 3;
1811             }
1812             bit DL_TYPE {
1813                 position 4;
1814             }
1815             bit NW_PROTO {
1816                 position 5;
1817             }
1818             bit TP_SRC {
1819                 position 6;
1820             }
1821             bit TP_DST {
1822                 position 7;
1823             }
1824             bit DL_VLAN_PCP {
1825                 position 20;
1826             }
1827             bit NW_TOS {
1828                 position 21;
1829             }
1830         }
1831     }
1832     
1833 }