Yang model fixed
[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 group {
867                 /* ofp_group - Group numbering. Groups can use any number up to OFPG_MAX.*/
868                 type enumeration {
869                         enum OFPG_MAX {
870                                 value -256; //0xffffff00
871                                 description "Last usable group number";
872                         }
873                         
874                         /* Fake groups. */
875                         enum OFPG_ALL {
876                                 value -4; //0xfffffffc
877                                 description "Represents all groups for group delete commands";
878                         }
879                         enum OFPG_ANY {
880                                 value -1; //0xffffffff
881                                 description "Wildcard group used only for flow stats requests. 
882                                                                 Selects all flows regardless of group (including flows with no group)";
883                                 
884                         }
885                 }
886                 
887         }
888         
889     typedef multipart-request-flags {
890         description
891             "enum ofp_multipart_request_flags ";
892         type bits {
893             bit OFPMPF_REQ_MORE {
894                 //description "More requests to follow.";
895                 position 0;
896             }
897         }
898     }
899
900     typedef multipart-type {
901         /* ofp_multipart_type */
902         type enumeration {
903             enum OFPMP_DESC {
904               value 0;
905               description "Description of this OpenFlow switch.
906                  The request body is empty.
907                  The reply body is struct ofp_desc.";
908             }
909             enum OFPMP_FLOW {
910               value 1;
911               description "Individual flow statistics.
912                  The request body is struct ofp_flow_stats_request.
913                  The reply body is an array of struct ofp_flow_stats.";
914             }
915             enum OFPMP_AGGREGATE {
916               value 2;
917               description "Aggregate flow statistics.
918                  The request body is struct ofp_aggregate_stats_request.
919                  The reply body is struct ofp_aggregate_stats_reply.";
920             }
921             enum OFPMP_TABLE {
922               value 3;
923               description "Flow table statistics.
924                  The request body is empty.
925                  The reply body is an array of struct ofp_table_stats.";
926             }
927             enum OFPMP_PORT_STATS {
928               value 4;
929               description "Port statistics.
930                  The request body is struct ofp_port_stats_request.
931                  The reply body is an array of struct ofp_port_stats.";
932             }
933             enum OFPMP_QUEUE {
934               value 5;
935               description "Queue statistics for a port
936                  The request body is struct ofp_queue_stats_request.
937                  The reply body is an array of struct ofp_queue_stats";
938             }
939             enum OFPMP_GROUP {
940               value 6;
941               description "Group counter statistics.
942                  The request body is struct ofp_group_stats_request.
943                  The reply is an array of struct ofp_group_stats.";
944             }
945             enum OFPMP_GROUP_DESC {
946               value 7;
947               description "Group description.
948                  The request body is empty.
949                  The reply body is an array of struct ofp_group_desc.";
950             }
951             enum OFPMP_GROUP_FEATURES {
952               value 8;
953               description "Group features.
954                  The request body is empty.
955                  The reply body is struct ofp_group_features.";
956             }
957             enum OFPMP_METER {
958               value 9;
959               description "Meter statistics.
960                  The request body is struct ofp_meter_multipart_requests.
961                  The reply body is an array of struct ofp_meter_stats.";
962             }
963             enum OFPMP_METER_CONFIG {
964               value 10;
965               description "Meter configuration.
966                  The request body is struct ofp_meter_multipart_requests.
967                  The reply body is an array of struct ofp_meter_config.";
968             }
969             enum OFPMP_METER_FEATURES {
970               value 11;
971               description "Meter features.
972                  The request body is empty.
973                  The reply body is struct ofp_meter_features.";
974             }
975             enum OFPMP_TABLE_FEATURES {
976               value 12;
977               description "Table features.
978                  The request body is either empty or contains an array of
979                  struct ofp_table_features containing the controller’s
980                  desired view of the switch. If the switch is unable to
981                  set the specified view an error is returned.
982                  The reply body is an array of struct ofp_table_features.";
983             }
984             enum OFPMP_PORT_DESC {
985               value 13;
986               description "Port description.
987                  The request body is empty.
988                  The reply body is an array of struct ofp_port.";
989             }
990             enum OFPMP_EXPERIMENTER {
991               value 65535; //0xffff
992               description "Experimenter extension.
993                  The request and reply bodies begin with
994                  struct ofp_experimenter_multipart_header.
995                  The request and reply bodies are otherwise experimenter-defined.";
996             }
997         }
998     }
999
1000     typedef queue-properties {
1001         /* ofp_queue_properties */
1002         type enumeration {
1003             enum OFPQT_NONE {
1004               value 0;
1005               description "No property defined for queue (default).";
1006             }
1007             enum OFPQT_MIN_RATE {
1008                 value 1;
1009                 description "Minimum datarate guaranteed.";
1010             }
1011             enum OFPQT_MAX_RATE {
1012                 value 2;
1013                 description "Maximum datarate.";
1014             }
1015             enum OFPQT_EXPERIMENTER {
1016                 value 65535; // 0xffff 
1017                 description "Experimenter defined property.";
1018             }
1019         }
1020     }
1021
1022     typedef controller-role {
1023         /* ofp_controller_role */
1024         type enumeration {
1025             enum OFPCR_ROLE_NOCHANGE {
1026               value 0;
1027               description "Don’t change current role.";
1028             }
1029             enum OFPCR_ROLE_EQUAL {
1030               value 1;
1031               description "Default role, full access.";
1032             }
1033             enum OFPCR_ROLE_MASTER {
1034               value 2;
1035               description "Full access, at most one master.";
1036             }
1037             enum OFPCR_ROLE_SLAVE {
1038               value 3;
1039               description "Read-only access.";
1040             }
1041         }
1042     }
1043
1044     typedef packet-in-reason {
1045         /* ofp_packet_in_reason */
1046         type enumeration {
1047             enum OFPR_NO_MATCH {
1048               value 0;
1049               description "No matching flow (table-miss flow entry). ";
1050             }
1051             enum OFPR_ACTION {
1052               value 1;
1053               description "Action explicitly output to controller. ";
1054             }
1055             enum OFPR_INVALID_TTL {
1056               value 2;
1057               description "Packet has invalid TTL ";
1058             }
1059         }
1060     }
1061     
1062     typedef action-type {
1063         /* ofp_action_type */
1064         type bits {
1065             bit OFPAT_OUTPUT {
1066                 position 0;
1067                 /* Output to switch port. */
1068             }
1069             bit OFPAT_COPY_TTL_OUT {
1070                 position 1;
1071                 /* Copy TTL "outwards" -- from next-to-outermost to outermost */
1072             }
1073             bit OFPAT_COPY_TTL_IN {
1074                 position 2;
1075                 /* Copy TTL "inwards" -- from outermost to next-to-outermost */
1076             }
1077             bit OFPAT_SET_MPLS_TTL {
1078                 position 3;
1079                 /* MPLS TTL */
1080             }
1081             bit OFPAT_DEC_MPLS_TTL {
1082                 position 4;
1083                 /* Decrement MPLS TTL */
1084             }
1085             bit OFPAT_PUSH_VLAN {
1086                 position 5;
1087                 /* Push a new VLAN tag */
1088             }
1089             bit OFPAT_POP_VLAN {
1090                 position 6;
1091                 /* Pop the outer VLAN tag */
1092             }
1093             bit OFPAT_PUSH_MPLS {
1094                 position 7;
1095                 /* Push a new MPLS tag */
1096             }
1097             bit OFPAT_POP_MPLS {
1098                 position 8;
1099                 /* Pop the outer MPLS tag */
1100             }
1101             bit OFPAT_SET_QUEUE {
1102                 position 9;
1103                 /* Set queue id when outputting to a port */
1104             }
1105             bit OFPAT_GROUP {
1106                 position 10;
1107                 /* Apply group. */
1108             }
1109             bit OFPAT_SET_NW_TTL {
1110                 position 11;
1111                 /* IP TTL. */
1112             }
1113             bit OFPAT_DEC_NW_TTL {
1114                 position 12;
1115                 /* Decrement IP TTL. */
1116             }
1117             bit OFPAT_SET_FIELD {
1118                 position 13;
1119                 /* Set a header field using OXM TLV format. */
1120             }
1121             bit OFPAT_PUSH_PBB {
1122                 position 14;
1123                 /* Push a new PBB service tag (I-TAG) */
1124             }
1125             bit OFPAT_POP_PBB {
1126                 position 15;
1127                 /* Pop the outer PBB service tag (I-TAG) */
1128             }
1129             bit OFPAT_EXPERIMENTER {
1130                 position 16;
1131             }
1132         }
1133     }
1134
1135     typedef meter-mod-command {
1136         /* ofp_meter_mod_command */
1137         type enumeration {
1138             enum OFPMC_ADD {
1139               description "New meter. ";
1140             }
1141             enum OFPMC_MODIFY {
1142               description "Modify specified meter. ";
1143             }
1144             enum OFPMC_DELETE {
1145               description "Delete specified meter. ";
1146             }
1147         }
1148     }
1149
1150     typedef meter-flags {
1151         /* ofp_meter_flags */
1152         type bits {
1153             bit OFPMF_KBPS {
1154                 position 0;
1155                 /* Rate value in kb/s (kilo-bit per second). */
1156             }
1157             bit OFPMF_PKTPS {
1158                 position 1;
1159                 /* Rate value in packet/sec. */
1160             }
1161             bit OFPMF_BURST {
1162                 position 2;
1163                 /* Do burst size. */
1164             }
1165             bit OFPMF_STATS {
1166                 position 3;
1167                 /* Collect statistics. */
1168             }
1169         }
1170     }
1171
1172     typedef meter-band-type {
1173         /* ofp_meter_band_type */
1174         type enumeration {
1175             enum OFPMBT_DROP {
1176               value 1;
1177               description "Drop packet. ";
1178             }
1179             enum OFPMBT_DSCP_REMARK {
1180               value 2;
1181               description "Remark DSCP in the IP header. ";
1182             }
1183             enum OFPMBT_EXPERIMENTER {
1184               value 65535; //0xFFFF
1185               description "Experimenter meter band. ";
1186             }
1187         }
1188     }
1189     
1190     typedef meter-band-type-bitmap {
1191         /* ofp_meter_band_type */
1192         type bits {
1193             bit OFPMBT_DROP {
1194               position 1;
1195               description "Drop packet. ";
1196             }
1197             bit OFPMBT_DSCP_REMARK {
1198               position 2;
1199               description "Remark DSCP in the IP header. ";
1200             }
1201         }
1202     }
1203
1204         typedef meter {
1205                 /* ofp_meter - Meter numbering. Flow meters can use any number up to OFPM_MAX*/
1206                 type enumeration {
1207                         enum OFPM_MAX {
1208                                 value -65536; //0xffff0000
1209                                 description "Last usable meter number";
1210                         }
1211                         
1212                         /* Virtual meters. */
1213                         enum OFPM_SLOWPATH {
1214                                 value -3; //0xfffffffd
1215                                 description "Meter for slow datapath";
1216                         }
1217                         enum OFPM_CONTROLLER {
1218                                 value -2; //0xfffffffe
1219                                 description "Meter for controller connection";
1220                         }
1221                         enum OFPM_ALL {
1222                                 value -1; //0xffffffff
1223                                 description "Represents all meters for stat requests commands";
1224                         }
1225                 }
1226                 
1227         }
1228
1229     typedef table-config {
1230         /* ofp_table_config */
1231         type bits {
1232             bit OFPTC_DEPRECATED_MASK {
1233                 /* Deprecated bits */
1234                 position 3;
1235             }
1236         }
1237     }
1238
1239     typedef table-features-prop-type {
1240         type enumeration {
1241             enum OFPTFPT_INSTRUCTIONS {
1242                 value 0; 
1243                 description "Instructions property.";
1244             }
1245             enum OFPTFPT_INSTRUCTIONS_MISS {
1246                 value 1; 
1247                 description "Instructions for table-miss.";
1248             }
1249             enum OFPTFPT_NEXT_TABLES {
1250                 value 2; 
1251                 description "Next Table property.";
1252             }
1253             enum OFPTFPT_NEXT_TABLES_MISS {
1254                 value 3; 
1255                 description "Next Table for table-miss.";
1256             }
1257             enum OFPTFPT_WRITE_ACTIONS {
1258                 value 4; 
1259                 description "Write Actions property.";
1260             }
1261             enum OFPTFPT_WRITE_ACTIONS_MISS {
1262                 value 5; 
1263                 description "Write Actions for table-miss.";
1264             }
1265             enum OFPTFPT_APPLY_ACTIONS {
1266                 value 6; 
1267                 description "Apply Actions property.";
1268             }
1269             enum OFPTFPT_APPLY_ACTIONS_MISS {
1270                 value 7; 
1271                 description "Apply Actions for table-miss.";
1272             }
1273             enum OFPTFPT_MATCH {
1274                 value 8; 
1275                 description "Match property.";
1276             }
1277             enum OFPTFPT_WILDCARDS {
1278                 value 10; 
1279                 description "Wildcards property.";
1280             }
1281             enum OFPTFPT_WRITE_SETFIELD {
1282                 value 12; 
1283                 description "Write Set-Field property.";
1284             }
1285             enum OFPTFPT_WRITE_SETFIELD_MISS {
1286                 value 13; 
1287                 description "Write Set-Field for table-miss.";
1288             }
1289             enum OFPTFPT_APPLY_SETFIELD {
1290                 value 14; 
1291                 description "Apply Set-Field property.";
1292             }
1293             enum OFPTFPT_APPLY_SETFIELD_MISS {
1294                 value 15; 
1295                 description "Apply Set-Field for table-miss.";
1296             }
1297             enum OFPTFPT_EXPERIMENTER {
1298                 value 65534; 
1299                 description "Experimenter property.";
1300             }
1301             enum OFPTFPT_EXPERIMENTER_MISS {
1302                 value 65535; //0xffff 
1303                 description "Experimenter for table-miss.";
1304             }
1305         }
1306     }
1307
1308     typedef group-types {
1309         /* ofp_group_type */
1310         type bits {
1311             bit OFPGT_ALL {
1312                 /* All (multicast/broadcast) group. */
1313                 position 0;
1314             }
1315             bit OFPGT_SELECT {
1316                 /* Select group. */
1317                 position 1;
1318             }
1319             bit OFPGT_INDIRECT {
1320                 /* Indirect group. */
1321                 position 2;
1322             }
1323             bit OFPGT_FF {
1324                 /* Fast failover group. */
1325                 position 3;
1326             }
1327         }
1328     }
1329
1330     typedef group-capabilities {
1331         /* ofp_group_capabilities */
1332         type bits {
1333             bit OFPGFC_SELECT_WEIGHT {
1334                 /* Support weight for select groups */
1335                 position 0;
1336             }
1337             bit OFPGFC_SELECT_LIVENESS {
1338                 /* Support liveness for select groups */
1339                 position 1;
1340             }
1341             bit OFPGFC_CHAINING {
1342                 /* Support chaining groups */
1343                 position 2;
1344             }
1345             bit OFPGFC_CHAINING_CHECKS {
1346                 /* Check chaining for loops and delete */
1347                 position 3;
1348             }
1349         }
1350     }
1351     
1352 // OPENFLOW v1.0 STRUCTURES
1353     // Structures under this line are needed to support OpenFlow version 1.0 
1354     // wire protocol 0x01;
1355     
1356     typedef error-type-v10 {
1357         type enumeration {
1358             enum HELLO_FAILED {
1359                 value 0; 
1360                 description "Hello Protocol failed.";
1361             }
1362             enum BAD_REQUEST {
1363                 value 1; 
1364                 description "Request was not understood.";
1365             }
1366             enum BAD_ACTION {
1367                 value 2; 
1368                 description "Error in action description.";
1369             }
1370             enum FLOW_MOD_FAILED {
1371                 value 3; 
1372                 description "Problem modifying flow entry.";
1373             }
1374             enum PORT_MOD_FAILED {
1375                 value 4; 
1376                 description "Port mod request failed.";
1377             }
1378             enum QUEUE_OP_FAILED {
1379                 value 5; 
1380                 description "Queue operation failed.";
1381             }
1382         }
1383     }
1384     
1385     typedef hello-failed-code-v10 {
1386         type enumeration {
1387             enum INCOMPATIBLE {
1388                 value 0; 
1389                 description "Hello Protocol failed.";
1390             }
1391             enum EPERM {
1392                 value 1; 
1393                 description "Request was not understood.";
1394             }
1395         }
1396     }
1397     
1398     typedef bad-request-code-v10 {
1399         type enumeration {
1400             enum BAD_VERSION {
1401                 value 0; 
1402             }
1403             enum BAD_TYPE {
1404                 value 1; 
1405             }
1406             enum BAD_STAT {
1407                 value 2; 
1408             }
1409             enum BAD_VENDOR {
1410                 value 3; 
1411             }
1412             enum BAD_SUBTYPE {
1413                 value 4; 
1414             }
1415             enum EPERM {
1416                 value 5; 
1417             }
1418             enum BAD_LEN {
1419                 value 6; 
1420             }
1421             enum BUFFER_EMPTY {
1422                 value 7; 
1423             }
1424             enum BUFFER_UNKNOWN {
1425                 value 8; 
1426             }
1427         }
1428     }
1429     
1430     typedef bad-action-code-v10 {
1431         type enumeration {
1432             enum BAD_TYPE {
1433                 value 0; 
1434             }
1435             enum BAD_LEN {
1436                 value 1; 
1437             }
1438             enum VENDOR {
1439                 value 2; 
1440             }
1441             enum BAD_VENDOR_TYPE {
1442                 value 3; 
1443             }
1444             enum BAD_OUT_PORT {
1445                 value 4; 
1446             }
1447             enum BAD_ARGUMENT {
1448                 value 5; 
1449             }
1450             enum EPERM {
1451                 value 6; 
1452             }
1453             enum TOO_MANY {
1454                 value 7; 
1455             }
1456             enum BAD_QUEUE {
1457                 value 8; 
1458             }
1459         }
1460     }
1461     
1462     typedef flow-mod-failed-code-v10 {
1463         type enumeration {
1464             enum ALL_TABLES_FULL {
1465                 value 0; 
1466             }
1467             enum OVERLAP {
1468                 value 1; 
1469             }
1470             enum EPERM {
1471                 value 2; 
1472             }
1473             enum BAD_EMERG_TIMEOUT {
1474                 value 3; 
1475             }
1476             enum BAD_COMMAND {
1477                 value 4; 
1478             }
1479             enum UNSUPPORTED {
1480                 value 5; 
1481             }
1482         }
1483     }
1484     
1485     typedef port-mod-failed-code-v10 {
1486         type enumeration {
1487             enum BAD_PORT {
1488                 value 0; 
1489             }
1490             enum BAD_HW_ADDR {
1491                 value 1; 
1492             }
1493         }
1494     }
1495     
1496     typedef queue-op-failed-code-v10 {
1497         type enumeration {
1498             enum BAD_PORT {
1499                 value 0; 
1500             }
1501             enum BAD_QUEUE {
1502                 value 1; 
1503             }
1504             enum EPERM {
1505                 value 2; 
1506             }
1507         }
1508     }
1509     
1510     typedef port-number-values-v10 {
1511         type enumeration {
1512             enum MAX {
1513                 value 65280; // 0xff00 
1514             }
1515             enum IN_PORT {
1516                 value 65528; // 0xfff8
1517             }
1518             enum TABLE {
1519                 value 65529; // 0xfff9 
1520             }
1521             enum NORMAL {
1522                 value 65530; // 0xfffa 
1523             }
1524             enum FLOOD {
1525                 value 65531; // 0xfffb 
1526             }
1527             enum ALL {
1528                 value 65532; // 0xfffc 
1529             }
1530             enum CONTROLLER {
1531                 value 65533; // 0xfffd
1532             }
1533             enum LOCAL {
1534                 value 65534; // 0xfffe
1535             }
1536             enum NONE {
1537                 value 65535; // 0xffff
1538             }
1539         }
1540     }
1541     
1542     typedef port-config-v10 {
1543         description 
1544            "Flags to indicate behavior of the physical port. These flags are
1545             describe the current configuration and used port_mod message 
1546             to configure the port's behavior.";
1547         type bits {
1548             bit port-down { 
1549                 //description " Port is administratively down.";
1550                 position 0;
1551             }
1552             bit no-stp {
1553                 //description" Disable 802.1D spanning tree on port.";
1554                 position 1;
1555             }
1556             bit no-recv { 
1557                 //description " Drop all packets received by port.";
1558                 position 2;
1559             }
1560             bit no-recv-stp { 
1561                 //description " Drop received 802.1D STP packets.";
1562                 position 3;
1563             }
1564             bit no-flood { 
1565                 //description " Do not include this port when flooding.";
1566                 position 4;
1567             }
1568             bit no-fwd { 
1569                 //description " Drop packets forwarded to port.";
1570                 position 5;
1571             }
1572             bit no-packet-in { 
1573                 //description "Do not send packet-in msgs for port.";
1574                 position 6;
1575             }
1576         }
1577     }
1578     
1579     typedef port-state-v10 {
1580         description 
1581             "Current state of the physical port. These are not configurable from
1582             the controller.";
1583         type bits {
1584             bit link_down {
1585                 //description "No physical link present.";
1586                 position 0;
1587             }
1588             bit blocked {
1589                 //description "Port is blocked";
1590                 position 1;
1591             }
1592             bit live {
1593                 //description "Live for Fast Failover Group.";
1594                 position 2;
1595             }
1596             bit stp_listen {
1597                 //description "Not learning or relaying frames.";
1598             }
1599             bit stp_learn {
1600                 //description "Learning but not relaying frames.";
1601             }
1602             bit stp_forward {
1603                 //description "Learning and relaying frames.";
1604             }
1605             bit stp_block {
1606                 //description "Not part of spanning tree.";
1607             }
1608             bit stp_mask {
1609                 //description "Bit mask for OFPPS_STP_* values.";
1610             }
1611         }
1612     }
1613     
1614     typedef port-features-v10 {
1615         ////description "Features of ports available in datapath.";
1616         //reference "ofp_port_features";
1617         type bits {
1618             bit _10mb-hd { 
1619                 position 0;
1620                 //description "10 Mb half-duplex rate support.";
1621             }
1622             bit _10mb-fd { 
1623                 position 1;
1624                 //description "10 Mb full-duplex rate support.";
1625             }
1626             bit _100mb-hd { 
1627                 position 2;
1628                 //description "100 Mb half-duplex rate support.";
1629             }
1630             bit _100mb-fd { 
1631                 position 3;
1632                 //description "100 Mb full-duplex rate support.";
1633             }
1634             bit _1gb-hd { 
1635                 position 4;
1636                 //description "1 Gb half-duplex rate support.";
1637             }
1638             bit _1gb-fd { 
1639                 position 5;
1640                 //description "1 Gb full-duplex rate support.";
1641             }
1642             bit _10gb-fd { 
1643                 position 6;
1644                 //description "10 Gb full-duplex rate support.";
1645             }
1646             bit copper { 
1647                 position 7;
1648                 //description "Copper medium.";
1649             }
1650             bit fiber { 
1651                 position 8;
1652                 //description "Fiber medium.";
1653             }
1654             bit autoneg { 
1655                 position 9;
1656                 //description "Auto-negotiation.";
1657             }
1658             bit pause { 
1659                 position 10;
1660                 //description "Pause.";
1661             }
1662             bit pause-asym { 
1663                 position 11;
1664                 //description "Asymmetric pause.";
1665             }
1666         }
1667     }
1668     
1669     typedef capabilities-v10 {
1670         type bits {
1671             bit OFPC_FLOW_STATS {
1672                 position 0;
1673                 /* Flow statistics. */
1674             } 
1675             bit OFPC_TABLE_STATS {
1676                 position 1;
1677                 /* Table statistics. */
1678             }
1679             bit OFPC_PORT_STATS {
1680                 position 2;
1681                 /* Port statistics. */
1682             }
1683             bit OFPC_STP {
1684                 position 3;
1685                 /* 802.1d spanning tree. */
1686             }
1687             bit OFPC_RESERVED {
1688                 position 4;
1689                 /* Reserved, must be zero. */
1690             }
1691             bit OFPC_IP_REASM {
1692                 position 5;
1693                 /* Can reassemble IP fragments. */
1694             }
1695             bit OFPC_QUEUE_STATS {
1696                 position 6;
1697                 /* Queue statistics. */
1698             }
1699             bit OFPC_ARP_MATCH_IP {
1700                 position 8;
1701                 /* Match IP addresses in ARP pkts. */
1702             }
1703         }
1704     }
1705     
1706     typedef flow-mod-flags-v10 {
1707         /* ofp_flow_mod_flags */
1708         type bits {
1709             bit OFPFF_SEND_FLOW_REM {
1710                 position 0;
1711                 /* Send flow removed message when flow expires or is deleted. */
1712             }
1713             bit OFPFF_CHECK_OVERLAP {
1714                 position 1;
1715                 /* Check for overlapping entries first. */
1716             }
1717             bit OFPFF_EMERG {
1718                 position 2;
1719                 /* Reset flow packet and byte counts. */
1720             }
1721         }
1722     }
1723     
1724     typedef action-type-v10 {
1725         /* ofp_action_type */
1726         type bits {
1727             bit OFPAT_OUTPUT {
1728                 position 0;
1729                 /* Output to switch port. */
1730             }
1731             bit OFPAT_SET_VLAN_VID {
1732                 position 1;
1733                 /* Set the 802.1q VLAN id. */
1734             }
1735             bit OFPAT_SET_VLAN_PCP {
1736                 position 2;
1737                 /* Set the 802.1q priority. */
1738             }
1739             bit OFPAT_STRIP_VLAN {
1740                 position 3;
1741                 /* Strip the 802.1q header. */
1742             }
1743             bit OFPAT_SET_DL_SRC {
1744                 position 4;
1745                 /* Ethernet source address. */
1746             }
1747             bit OFPAT_SET_DL_DST {
1748                 position 5;
1749                 /* Ethernet destination address. */
1750             }
1751             bit OFPAT_SET_NW_SRC {
1752                 position 6;
1753                 /* IP source address. */
1754             }
1755             bit OFPAT_SET_NW_DST {
1756                 position 7;
1757                 /* IP destination address. */
1758             }
1759             bit OFPAT_SET_NW_TOS {
1760                 position 8;
1761                 /* IP ToS (DSCP field, 6 bits). */
1762             }
1763             bit OFPAT_SET_TP_SRC {
1764                 position 9;
1765                 /* TCP/UDP source port. */
1766             }
1767             bit OFPAT_SET_TP_DST {
1768                 position 10;
1769                 /* TCP/UDP destination port. */
1770             }
1771             bit OFPAT_ENQUEUE {
1772                 position 11;
1773                 /* Output to queue. */
1774             }
1775             bit OFPAT_VENDOR {
1776                 position 12;
1777                 /* Experimenter in later versions */
1778             }
1779         }
1780     }
1781     
1782     typedef flow-wildcards-v10 {
1783         /* ofp_flow_wildcards */
1784         type bits {
1785             bit IN_PORT {
1786                 position 0;
1787                 /* Switch input port. */
1788             }
1789             bit DL_VLAN {
1790                 position 1;
1791                 /* Switch input port. */
1792             }
1793             bit DL_SRC {
1794                 position 2;
1795                 /* Switch input port. */
1796             }
1797             bit DL_DST {
1798                 position 3;
1799                 /* Switch input port. */
1800             }
1801             bit DL_TYPE {
1802                 position 4;
1803                 /* Switch input port. */
1804             }
1805             bit NW_PROTO {
1806                 position 5;
1807                 /* Switch input port. */
1808             }
1809             bit TP_SRC {
1810                 position 6;
1811                 /* Switch input port. */
1812             }
1813             bit TP_DST {
1814                 position 7;
1815                 /* Switch input port. */
1816             }
1817             bit DL_VLAN_PCP {
1818                 position 20;
1819                 /* Switch input port. */
1820             }
1821             bit NW_TOS {
1822                 position 21;
1823                 /* Switch input port. */
1824             }
1825             bit ALL {
1826                 position 22;
1827                 /* Switch input port. */
1828             }
1829         }
1830     }
1831     
1832 }