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