multipart request message updated
[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 "Initial model";
7     }
8
9     typedef port-number {
10         type uint32 {
11                 range "0..4294967040"; // 0xffffff00 See for actual value
12         }
13     }
14
15     typedef special-port-number {
16         type enumeration {
17             enum in-port { 
18                 //value "4294967288";
19                 //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
20             }
21             enum table { 
22                 //value "4294967289"; // 0xfffffff9;
23                 //description "Perform actions in flow table. NB: This can only be the destination port for packet-out messages."
24             }
25             enum normal { 
26                 //value "4294967290"; // 0xfffffffa;
27                 //description "Process with normal L2/L3 switching."
28             }
29             enum flood { 
30                 //value "4294967291"; // 0xfffffffb;
31                 //description "All physical ports except input port and those disabled by STP."
32             }
33             enum all { 
34                 //value "4294967292"; // 0xfffffffc;
35                 //description "All physical ports except input port."
36             }
37             enum controller { 
38                 //value "4294967293";  // 0xfffffffd;
39                 //description "Send to controller."
40             }
41             enum local { 
42                 //value "4294967294"; // 0xfffffffe;
43                 //description "Local openflow port."
44             }
45             enum none { 
46                 //value "4294967295"; // 0xffffffff;
47                 //description "not associated with a physical port."
48             }
49         }
50     }
51
52     typedef any-port-number {
53         type union {
54             type port-number;
55             type special-port-number;
56         }
57     }
58
59
60     typedef port-features {
61         ////description "Features of ports available in datapath.";
62         //reference "ofp_port_features";
63         type bits {
64             bit 10mb_hd { 
65                 position 0;
66                 //description "10 Mb half-duplex rate support.";
67             }
68             bit 10mb-fd { 
69                 position 1;
70                 //description "10 Mb full-duplex rate support.";
71             }
72             bit 100mb-hd { 
73                 position 2;
74                 //description "100 Mb half-duplex rate support.";
75             }
76             bit 100mb-fd { 
77                 position 3;
78                 //description "100 Mb full-duplex rate support.";
79             }
80             bit 1gb-hd { 
81                 position 4;
82                 //description "1 Gb half-duplex rate support.";
83             }
84             bit 1gb-fd { 
85                 position 5;
86                 //description "1 Gb full-duplex rate support.";
87             }
88             bit 10gb-fd { 
89                 position 6;
90                 //description "10 Gb full-duplex rate support.";
91             }
92             bit 40gb-fd { 
93                 position 7;
94                 //description "40 Gb full-duplex rate support.";
95             }
96             bit 100gb-fd { 
97                 position 8;
98                 //description "100 Gb full-duplex rate support.";
99             }
100             bit 1tb-fd { 
101                 position 9;
102                 //description "1 Tb full-duplex rate support.";
103             }
104             bit other { 
105                 position 10;
106                 //description "Other rate, not in the list.";
107             }
108             bit copper { 
109                 position 11;
110                 //description "Copper medium.";
111             }
112             bit fiber { 
113                 position 12;
114                 //description "Fiber medium.";
115             }
116             bit autoneg { 
117                 position 13;
118                 //description "Auto-negotiation.";
119             }
120             bit pause { 
121                 position 14;
122                 //description "Pause.";
123             }
124             bit pause-asym { 
125                 position 15;
126                 //description "Asymmetric pause.";
127             }
128         }
129     }
130
131     typedef port-config {
132         description 
133            "Flags to indicate behavior of the physical port. These flags are
134             describe the current configuration and used port_mod message 
135             to configure the port's behavior.";
136         type bits {
137             bit port-down { 
138                 //description " Port is administratively down.";
139                 position 0;
140             }
141             bit no-recv { 
142                 //description " Drop all packets received by port.";
143                 position 2;
144             }
145             bit no-fwd { 
146                 //description " Drop packets forwarded to port.";
147                 position 5;
148             }
149             bit no-packet-in { 
150                 //description "Do not send packet-in msgs for port.";
151                 position 6;
152             }
153         }
154     }
155
156     typedef port-state {
157         description 
158             "Current state of the physical port. These are not configurable from
159             the controller.";
160         type bits {
161             bit link_down {
162                 //description "No physical link present.";
163                 position 0;
164             }
165             bit blocked {
166                 //description "Port is blocked";
167                 position 1;
168             }
169             bit live {
170                 //description "Live for Fast Failover Group.";
171                 position 2;
172             }
173         }
174     }
175
176     identity match-type-base {
177         description 
178            "The match type indicates the match structure (set of fields that compose the
179             match) in use. The match type is placed in the type field at the beginning
180             of all match structures.Extensions that define match types may be 
181             published on the ONF wiki. Support for extensions is optional.";
182     }
183
184     identity standard-match-type {
185         deprecated true;
186         base oft:match-type-base;
187     }
188
189     typedef match-type {
190         //type identityref {
191         //    base oft:match-type-base;
192         //}
193         
194         //TODO: use identityref, when generating available
195         type string;
196     }
197
198     identity instruction {
199
200     }
201
202     identity action {
203
204     }
205
206
207     typedef metadata {
208         type binary;
209     }
210     
211     typedef table-id {
212         type uint32;
213     }
214     typedef meter-id {
215         type uint32;
216     }
217     typedef queue-id {
218         type uint32;
219     }
220     typedef group-id {
221         type uint32;
222     }
223     
224     typedef ether-type {
225         type uint16;
226     }
227     
228     typedef error-type {
229         type enumeration {
230             enum HELLO_FAILED {
231                 value 0; 
232                 description "Hello Protocol failed.";
233             }
234             enum BAD_REQUEST {
235                 value 1; 
236                 description "Request was not understood.";
237             }
238             enum BAD_ACTION {
239                 value 2; 
240                 description "Error in action description.";
241             }
242             enum BAD_INSTRUCTION {
243                 value 3; 
244                 description "Error in instruction list.";
245             }
246             enum BAD_MATCH {
247                 value 4; 
248                 description "Error in match.";
249             }
250             enum FLOW_MOD_FAILED {
251                 value 5; 
252                 description "Problem modifying flow entry.";
253             }
254             enum GROUP_MOD_FAILED {
255                 value 6; 
256                 description "Problem modifying group entry.";
257             }
258             enum PORT_MOD_FAILED {
259                 value 7; 
260                 description "Port mod request failed.";
261             }
262             enum TABLE_MOD_FAILED {
263                 value 8; 
264                 description "Table mod request failed.";
265             }
266             enum QUEUE_OP_FAILED {
267                 value 9; 
268                 description "Queue operation failed.";
269             }
270             enum SWITCH_CONFIG_FAILED {
271                 value 10; 
272                 description "Switch config request failed.";
273             }
274             enum ROLE_REQUEST_FAILED {
275                 value 11; 
276                 description "Controller Role request failed.";
277             }
278             enum METER_MOD_FAILED {
279                 value 12; 
280                 description "Error in meter.";
281             }
282             enum TABLE_FEATURES_FAILED {
283                 value 13; 
284                 description "Setting table features failed.";
285             }
286             enum EXPERIMENTER {
287                 value 65535; //0xffff 
288                 description "Experimenter error messages.";
289             }
290         }
291     }
292     
293     typedef hello-element-type {
294         type enumeration {
295             enum VERSIONBITMAP {
296                 value 1; 
297                 description "Bitmap of version supported.";
298             }
299         }
300     }
301     
302     typedef switch-config-flag {
303         /* Handling of IP fragments. */
304         type enumeration {
305             enum FRAG_NORMAL {
306                 value 0; 
307                 description "No special handling for fragments.";
308             }
309             enum OFPC_FRAG_DROP {
310                 value 1; 
311                 description "Drop fragments.";
312             }
313             enum OFPC_FRAG_REASM {
314                 value 2; 
315                 description "Reassemble (only if OFPC_IP_REASM set).";
316             }
317             enum OFPC_FRAG_MASK {
318                 value 3; 
319             }
320         }
321     }
322     
323     typedef flow-removed-reason {
324         /* flow removed */
325         type enumeration {
326             enum OFPRR_IDLE_TIMEOUT {
327                 value 0;
328                 description "Flow idle time exceeded idle_timeout.";
329             }
330             enum OFPRR_HARD_TIMEOUT {
331                 value 1;
332                 description "Time exceeded hard_timeout.";
333             }
334             enum OFPRR_DELETE {
335                 value 2;
336                 description "Evicted by a DELETE flow mod.";
337             }
338             enum OFPRR_GROUP_DELETE {
339                 value 3;
340                 description "Group was removed.";
341             }
342         }
343     }
344     
345     typedef port-reason {
346         /* port status */
347         type enumeration {
348             enum OFPPR_ADD {
349                 value 0;
350                 description "The port was added.";
351             }
352             enum OFPPR_DELETE {
353                 value 1;
354                 description "he port was removed.";
355             }
356             enum OFPPR_MODIFY {
357                 value 2;
358                 description "Some attribute of the port has changed.";
359             }
360         }
361     }
362     
363     typedef flow-mod-command {
364         /* ofp_flow_mod_command */
365         type enumeration {
366             enum OFPFC_ADD {      
367                 value 0;      
368                 description "New flow.";    
369             }
370             enum OFPFC_MODIFY {
371                 value 1;
372                 description "Modify all matching flows.";
373             }
374             enum OFPFC_MODIFY_STRICT {
375                 value 2;
376                 description "Modify entry strictly matching wildcards and priority.";
377             }
378             enum OFPFC_DELETE {
379                 value 3;
380                 description "Delete all matching flows.";
381             }
382             enum OFPFC_DELETE_STRICT {
383                 value 4;
384                 description "Delete entry strictly matching wildcards and priority.";
385             }
386         }
387     }
388     
389     typedef flow-mod-flags {
390         /* ofp_flow_mod_flags */
391         type bits {
392             bit OFPFF_SEND_FLOW_REM {
393                 position 0;
394                 /* Send flow removed message when flow expires or is deleted. */
395             }
396             bit OFPFF_CHECK_OVERLAP {
397                 position 1;
398                 /* Check for overlapping entries first. */
399             }
400             bit OFPFF_RESET_COUNTS {
401                 position 2;
402                 /* Reset flow packet and byte counts. */
403             }
404             bit OFPFF_NO_PKT_COUNTS {
405                 position 3;
406                 /* Don't keep track of packet count. */
407             }
408             bit OFPFF_NO_BYT_COUNTS {
409                 position 4;
410                 /* Don't keep track of byte count. */
411             }
412         }
413     }
414     
415     typedef group-mod-command {
416         /* ofp_group_mod_command */
417         type enumeration {
418             enum OFPGC_ADD {            
419               value 0;            
420               description "New group.";            
421             }
422             enum OFPGC_MODIFY {
423               value 1;
424               description "Modify all matching groups.";
425             }
426             enum OFPGC_DELETE {
427               value 2;
428               description "Delete all matching groups.";
429             }
430             
431         }
432     }
433     
434     
435     typedef group-type {
436         /* ofp_group_type */
437         type enumeration {
438             enum OFPGT_ALL {            
439               value 0;            
440               description "All (multicast/broadcast) group.";            
441             }
442             enum OFPGT_SELECT {
443               value 1;
444               description "Select group.";
445             }
446             enum OFPGT_INDIRECT {
447               value 2;
448               description "Indirect group.";
449             }
450             enum OFPGT_FF {
451               value 3;
452               description "Fast failover group.";
453             }
454         }
455     }
456     
457     typedef multipart-request-flags {
458         description
459             "enum ofp_multipart_request_flags ";
460         type bits {
461             bit OFPMPF_REQ_MORE {
462                 //description "More requests to follow.";
463                 position 0;
464             }
465         }
466     }
467     
468     typedef multipart-type {
469         /* ofp_multipart_type */
470         type enumeration {
471             enum OFPMP_DESC {
472               value 0;
473               description "Description of this OpenFlow switch.
474                  The request body is empty.
475                  The reply body is struct ofp_desc.";
476             }
477             enum OFPMP_FLOW {
478               value 1;
479               description "Individual flow statistics.
480                  The request body is struct ofp_flow_stats_request.
481                  The reply body is an array of struct ofp_flow_stats.";
482             }
483             enum OFPMP_AGGREGATE {
484               value 2;
485               description "Aggregate flow statistics.
486                  The request body is struct ofp_aggregate_stats_request.
487                  The reply body is struct ofp_aggregate_stats_reply.";
488             }
489             enum OFPMP_TABLE {
490               value 3;
491               description "Flow table statistics.
492                  The request body is empty.
493                  The reply body is an array of struct ofp_table_stats.";
494             }
495             enum OFPMP_PORT_STATS {
496               value 4;
497               description "Port statistics.
498                  The request body is struct ofp_port_stats_request.
499                  The reply body is an array of struct ofp_port_stats.";
500             }
501             enum OFPMP_QUEUE {
502               value 5;
503               description "Queue statistics for a port
504                  The request body is struct ofp_queue_stats_request.
505                  The reply body is an array of struct ofp_queue_stats";
506             }
507             enum OFPMP_GROUP {
508               value 6;
509               description "Group counter statistics.
510                  The request body is struct ofp_group_stats_request.
511                  The reply is an array of struct ofp_group_stats.";
512             }
513             enum OFPMP_GROUP_DESC {
514               value 7;
515               description "Group description.
516                  The request body is empty.
517                  The reply body is an array of struct ofp_group_desc.";
518             }
519             enum OFPMP_GROUP_FEATURES {
520               value 8;
521               description "Group features.
522                  The request body is empty.
523                  The reply body is struct ofp_group_features.";
524             }
525             enum OFPMP_METER {
526               value 9;
527               description "Meter statistics.
528                  The request body is struct ofp_meter_multipart_requests.
529                  The reply body is an array of struct ofp_meter_stats.";
530             }
531             enum OFPMP_METER_CONFIG {
532               value 10;
533               description "Meter configuration.
534                  The request body is struct ofp_meter_multipart_requests.
535                  The reply body is an array of struct ofp_meter_config.";
536             }
537             enum OFPMP_METER_FEATURES {
538               value 11;
539               description "Meter features.
540                  The request body is empty.
541                  The reply body is struct ofp_meter_features.";
542             }
543             enum OFPMP_TABLE_FEATURES {
544               value 12;
545               description "Table features.
546                  The request body is either empty or contains an array of
547                  struct ofp_table_features containing the controller’s
548                  desired view of the switch. If the switch is unable to
549                  set the specified view an error is returned.
550                  The reply body is an array of struct ofp_table_features.";
551             }
552             enum OFPMP_PORT_DESC {
553               value 13;
554               description "Port description.
555                  The request body is empty.
556                  The reply body is an array of struct ofp_port.";
557             }
558             enum OFPMP_EXPERIMENTER {
559               value 65535; //0xffff
560               description "Experimenter extension.
561                  The request and reply bodies begin with
562                  struct ofp_experimenter_multipart_header.
563                  The request and reply bodies are otherwise experimenter-defined.";
564             }
565         }
566     }
567     
568     typedef queue-property {
569         /* ofp_queue_properties */
570         type enumeration {
571             enum OFPGT_ALL {
572               value 0;
573               description "All (multicast/broadcast) group.";
574             }
575             enum OFPQT_MIN_RATE {
576                 value 1;
577                 description "Minimum datarate guaranteed.";
578             }
579             enum OFPQT_MAX_RATE {
580                 value 2;
581                 description "Maximum datarate.";
582             }
583             enum OFPQT_EXPERIMENTER {
584                 value 65535; // 0xffff 
585                 description "Experimenter defined property.";
586             }
587         }
588     }
589     
590     typedef controller-role {
591         /* ofp_controller_role */
592         type enumeration {
593             enum OFPCR_ROLE_NOCHANGE {
594               value 0;
595               description "Don’t change current role.";
596             }
597             enum OFPCR_ROLE_EQUAL {
598               value 1;
599               description "Default role, full access.";
600             }
601             enum OFPCR_ROLE_MASTER {
602               value 2;
603               description "Full access, at most one master.";
604             }
605             enum OFPCR_ROLE_SLAVE {
606               value 3;
607               description "Read-only access.";
608             }
609         }
610     }
611     
612     typedef packet-in-reason {
613         /* ofp_packet_in_reason */
614         type enumeration {
615             enum OFPR_NO_MATCH {
616               value 0;
617               description "No matching flow (table-miss flow entry). ";
618             }
619             enum OFPR_ACTION {
620               value 1;
621               description "Action explicitly output to controller. ";
622             }
623             enum OFPR_INVALID_TTL {
624               value 2;
625               description "Packet has invalid TTL ";
626             }
627         }
628     }
629     
630     typedef meter-mod-command {
631         /* ofp_meter_mod_command */
632         type enumeration {
633             enum OFPMC_ADD {
634               description "New meter. ";
635             }
636             enum OFPMC_MODIFY {
637               description "Modify specified meter. ";
638             }
639             enum OFPMC_DELETE {
640               description "Delete specified meter. ";
641             }
642
643         }
644     }
645  
646     typedef meter-flags {
647         /* ofp_meter_flags */
648         type bits {
649             bit OFPMF_KBPS {
650                 position 0;
651                 /* Rate value in kb/s (kilo-bit per second). */
652             }
653             bit OFPMF_PKTPS {
654                 position 1;
655                 /* Rate value in packet/sec. */
656             }
657             bit OFPMF_BURST {
658                 position 2;
659                 /* Do burst size. */
660             }
661             bit OFPMF_STATS {
662                 position 3;
663                 /* Collect statistics. */
664             }
665         }
666     }
667     
668     typedef meter-band-type {
669         /* ofp_meter_band_type */
670         type enumeration {
671             enum OFPMBT_DROP {
672               value 1;
673               description "Drop packet. ";
674             }
675             enum OFPMBT_DSCP_REMARK {
676               value 2;
677               description "Remark DSCP in the IP header. ";
678             }
679             enum OFPMBT_EXPERIMENTER {
680               value 65535; //0xFFFF
681               description "Experimenter meter band. ";
682             }
683
684         }
685     }
686     
687     typedef table-config {
688         /* ofp_table_config */
689         type bits {
690             bit OFPTC_DEPRECATED_MASK {
691                 /* Deprecated bits */
692                 position 3;
693             }
694         }
695     }
696     
697     typedef table-features-prop-type {
698         type enumeration {
699             enum OFPTFPT_INSTRUCTIONS {
700                 value 0; 
701                 description "Instructions property.";
702             }
703             enum OFPTFPT_INSTRUCTIONS_MISS {
704                 value 1; 
705                 description "Instructions for table-miss.";
706             }
707             enum OFPTFPT_NEXT_TABLES {
708                 value 2; 
709                 description "Next Table property.";
710             }
711             enum OFPTFPT_NEXT_TABLES_MISS {
712                 value 3; 
713                 description "Next Table for table-miss.";
714             }
715             enum OFPTFPT_WRITE_ACTIONS {
716                 value 4; 
717                 description "Write Actions property.";
718             }
719             enum OFPTFPT_WRITE_ACTIONS_MISS {
720                 value 5; 
721                 description "Write Actions for table-miss.";
722             }
723             enum OFPTFPT_APPLY_ACTIONS {
724                 value 6; 
725                 description "Apply Actions property.";
726             }
727             enum OFPTFPT_APPLY_ACTIONS_MISS {
728                 value 7; 
729                 description "Apply Actions for table-miss.";
730             }
731             enum OFPTFPT_MATCH {
732                 value 8; 
733                 description "Match property.";
734             }
735             enum OFPTFPT_WILDCARDS {
736                 value 10; 
737                 description "Wildcards property.";
738             }
739             enum OFPTFPT_WRITE_SETFIELD {
740                 value 12; 
741                 description "Write Set-Field property.";
742             }
743             enum OFPTFPT_WRITE_SETFIELD_MISS {
744                 value 13; 
745                 description "Write Set-Field for table-miss.";
746             }
747             enum OFPTFPT_APPLY_SETFIELD {
748                 value 14; 
749                 description "Apply Set-Field property.";
750             }
751             enum OFPTFPT_APPLY_SETFIELD_MISS {
752                 value 15; 
753                 description "Apply Set-Field for table-miss.";
754             }
755             enum OFPTFPT_EXPERIMENTER {
756                 value 65534; 
757                 description "Experimenter property.";
758             }
759             enum OFPTFPT_EXPERIMENTER_MISS {
760                 value 65535; //0xffff 
761                 description "Experimenter for table-miss.";
762             }
763         }
764     }
765     
766     typedef group-types {
767         /* ofp_group_type */
768         type bits {
769             bit OFPGT_ALL {
770                 /* All (multicast/broadcast) group. */
771                 position 0;
772             }
773             bit OFPGT_SELECT {
774                 /* Select group. */
775                 position 1;
776             }
777             bit OFPGT_INDIRECT {
778                 /* Indirect group. */
779                 position 2;
780             }
781             bit OFPGT_FF {
782                 /* Fast failover group. */
783                 position 3;
784             }
785         }
786     }
787     
788     typedef group-capabilities {
789         /* ofp_group_capabilities */
790         type bits {
791             bit OFPGFC_SELECT_WEIGHT {
792                 /* Support weight for select groups */
793                 position 0;
794             }
795             bit OFPGFC_SELECT_LIVENESS {
796                 /* Support liveness for select groups */
797                 position 1;
798             }
799             bit OFPGFC_CHAINING {
800                 /* Support chaining groups */
801                 position 2;
802             }
803             bit OFPGFC_CHAINING_CHECKS {
804                 /* Check chaining for loops and delete */
805                 position 3;
806             }
807         }
808     }
809     
810 }