Finished yang generation for match, action, instruction and tableFeatureProperties
[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 OFPGT_ALL {
472               value 0;
473               description "All (multicast/broadcast) group.";
474             }
475             
476             enum OFPMP_DESC {
477               value 0;
478               description "Description of this OpenFlow switch.
479                  The request body is empty.
480                  The reply body is struct ofp_desc.";
481             }
482             enum OFPMP_FLOW {
483               value 1;
484               description "Individual flow statistics.
485                  The request body is struct ofp_flow_stats_request.
486                  The reply body is an array of struct ofp_flow_stats.";
487             }
488             enum OFPMP_AGGREGATE {
489               value 2;
490               description "Aggregate flow statistics.
491                  The request body is struct ofp_aggregate_stats_request.
492                  The reply body is struct ofp_aggregate_stats_reply.";
493             }
494             enum OFPMP_TABLE {
495               value 3;
496               description "Flow table statistics.
497                  The request body is empty.
498                  The reply body is an array of struct ofp_table_stats.";
499             }
500             enum OFPMP_PORT_STATS {
501               value 4;
502               description "Port statistics.
503                  The request body is struct ofp_port_stats_request.
504                  The reply body is an array of struct ofp_port_stats.";
505             }
506             enum OFPMP_QUEUE {
507               value 5;
508               description "Queue statistics for a port
509                  The request body is struct ofp_queue_stats_request.
510                  The reply body is an array of struct ofp_queue_stats";
511             }
512             enum OFPMP_GROUP {
513               value 6;
514               description "Group counter statistics.
515                  The request body is struct ofp_group_stats_request.
516                  The reply is an array of struct ofp_group_stats.";
517             }
518             enum OFPMP_GROUP_DESC {
519               value 7;
520               description "Group description.
521                  The request body is empty.
522                  The reply body is an array of struct ofp_group_desc.";
523             }
524             enum OFPMP_GROUP_FEATURES {
525               value 8;
526               description "Group features.
527                  The request body is empty.
528                  The reply body is struct ofp_group_features.";
529             }
530             enum OFPMP_METER {
531               value 9;
532               description "Meter statistics.
533                  The request body is struct ofp_meter_multipart_requests.
534                  The reply body is an array of struct ofp_meter_stats.";
535             }
536             enum OFPMP_METER_CONFIG {
537               value 10;
538               description "Meter configuration.
539                  The request body is struct ofp_meter_multipart_requests.
540                  The reply body is an array of struct ofp_meter_config.";
541             }
542             enum OFPMP_METER_FEATURES {
543               value 11;
544               description "Meter features.
545                  The request body is empty.
546                  The reply body is struct ofp_meter_features.";
547             }
548             enum OFPMP_TABLE_FEATURES {
549               value 12;
550               description "Table features.
551                  The request body is either empty or contains an array of
552                  struct ofp_table_features containing the controller’s
553                  desired view of the switch. If the switch is unable to
554                  set the specified view an error is returned.
555                  The reply body is an array of struct ofp_table_features.";
556             }
557             enum OFPMP_PORT_DESC {
558               value 13;
559               description "Port description.
560                  The request body is empty.
561                  The reply body is an array of struct ofp_port.";
562             }
563             enum OFPMP_EXPERIMENTER {
564               value 65535; //0xffff
565               description "Experimenter extension.
566                  The request and reply bodies begin with
567                  struct ofp_experimenter_multipart_header.
568                  The request and reply bodies are otherwise experimenter-defined.";
569             }
570         }
571     }
572     
573     typedef queue-property {
574         /* ofp_queue_properties */
575         type enumeration {
576             enum OFPGT_ALL {
577               value 0;
578               description "All (multicast/broadcast) group.";
579             }
580             enum OFPQT_MIN_RATE {
581                 value 1;
582                 description "Minimum datarate guaranteed.";
583             }
584             enum OFPQT_MAX_RATE {
585                 value 2;
586                 description "Maximum datarate.";
587             }
588             enum OFPQT_EXPERIMENTER {
589                 value 65535; // 0xffff 
590                 description "Experimenter defined property.";
591             }
592         }
593     }
594     
595     typedef controller-role {
596         /* ofp_controller_role */
597         type enumeration {
598             enum OFPCR_ROLE_NOCHANGE {
599               value 0;
600               description "Don’t change current role.";
601             }
602             enum OFPCR_ROLE_EQUAL {
603               value 1;
604               description "Default role, full access.";
605             }
606             enum OFPCR_ROLE_MASTER {
607               value 2;
608               description "Full access, at most one master.";
609             }
610             enum OFPCR_ROLE_SLAVE {
611               value 3;
612               description "Read-only access.";
613             }
614         }
615     }
616     
617     typedef packet-in-reason {
618         /* ofp_packet_in_reason */
619         type enumeration {
620             enum OFPR_NO_MATCH {
621               value 0;
622               description "No matching flow (table-miss flow entry). ";
623             }
624             enum OFPR_ACTION {
625               value 1;
626               description "Action explicitly output to controller. ";
627             }
628             enum OFPR_INVALID_TTL {
629               value 2;
630               description "Packet has invalid TTL ";
631             }
632         }
633     }
634     
635     typedef meter-mod-command {
636         /* ofp_meter_mod_command */
637         type enumeration {
638             enum OFPMC_ADD {
639               description "New meter. ";
640             }
641             enum OFPMC_MODIFY {
642               description "Modify specified meter. ";
643             }
644             enum OFPMC_DELETE {
645               description "Delete specified meter. ";
646             }
647
648         }
649     }
650  
651     typedef meter-flags {
652         /* ofp_meter_flags */
653         type bits {
654             bit OFPMF_KBPS {
655                 position 0;
656                 /* Rate value in kb/s (kilo-bit per second). */
657             }
658             bit OFPMF_PKTPS {
659                 position 1;
660                 /* Rate value in packet/sec. */
661             }
662             bit OFPMF_BURST {
663                 position 2;
664                 /* Do burst size. */
665             }
666             bit OFPMF_STATS {
667                 position 3;
668                 /* Collect statistics. */
669             }
670         }
671     }
672     
673     typedef meter-band-type {
674         /* ofp_meter_band_type */
675         type enumeration {
676             enum OFPMBT_DROP {
677               value 1;
678               description "Drop packet. ";
679             }
680             enum OFPMBT_DSCP_REMARK {
681               value 2;
682               description "Remark DSCP in the IP header. ";
683             }
684             enum OFPMBT_EXPERIMENTER {
685               value 65535; //0xFFFF
686               description "Experimenter meter band. ";
687             }
688
689         }
690     }
691     
692     typedef table-config {
693         /* ofp_table_config */
694         type bits {
695             bit OFPTC_DEPRECATED_MASK {
696                 /* Deprecated bits */
697                 position 3;
698             }
699         }
700     }
701     
702     typedef table-features-prop-type {
703         type enumeration {
704             enum OFPTFPT_INSTRUCTIONS {
705                 value 0; 
706                 description "Instructions property.";
707             }
708             enum OFPTFPT_INSTRUCTIONS_MISS {
709                 value 1; 
710                 description "Instructions for table-miss.";
711             }
712             enum OFPTFPT_NEXT_TABLES {
713                 value 2; 
714                 description "Next Table property.";
715             }
716             enum OFPTFPT_NEXT_TABLES_MISS {
717                 value 3; 
718                 description "Next Table for table-miss.";
719             }
720             enum OFPTFPT_WRITE_ACTIONS {
721                 value 4; 
722                 description "Write Actions property.";
723             }
724             enum OFPTFPT_WRITE_ACTIONS_MISS {
725                 value 5; 
726                 description "Write Actions for table-miss.";
727             }
728             enum OFPTFPT_APPLY_ACTIONS {
729                 value 6; 
730                 description "Apply Actions property.";
731             }
732             enum OFPTFPT_APPLY_ACTIONS_MISS {
733                 value 7; 
734                 description "Apply Actions for table-miss.";
735             }
736             enum OFPTFPT_MATCH {
737                 value 8; 
738                 description "Match property.";
739             }
740             enum OFPTFPT_WILDCARDS {
741                 value 10; 
742                 description "Wildcards property.";
743             }
744             enum OFPTFPT_WRITE_SETFIELD {
745                 value 12; 
746                 description "Write Set-Field property.";
747             }
748             enum OFPTFPT_WRITE_SETFIELD_MISS {
749                 value 13; 
750                 description "Write Set-Field for table-miss.";
751             }
752             enum OFPTFPT_APPLY_SETFIELD {
753                 value 14; 
754                 description "Apply Set-Field property.";
755             }
756             enum OFPTFPT_APPLY_SETFIELD_MISS {
757                 value 15; 
758                 description "Apply Set-Field for table-miss.";
759             }
760             enum OFPTFPT_EXPERIMENTER {
761                 value 65534; 
762                 description "Experimenter property.";
763             }
764             enum OFPTFPT_EXPERIMENTER_MISS {
765                 value 65535; //0xffff 
766                 description "Experimenter for table-miss.";
767             }
768         }
769     }
770     
771     typedef group-types {
772         /* ofp_group_type */
773         type bits {
774             bit OFPGT_ALL {
775                 /* All (multicast/broadcast) group. */
776                 position 0;
777             }
778             bit OFPGT_SELECT {
779                 /* Select group. */
780                 position 1;
781             }
782             bit OFPGT_INDIRECT {
783                 /* Indirect group. */
784                 position 2;
785             }
786             bit OFPGT_FF {
787                 /* Fast failover group. */
788                 position 3;
789             }
790         }
791     }
792     
793     typedef group-capabilities {
794         /* ofp_group_capabilities */
795         type bits {
796             bit OFPGFC_SELECT_WEIGHT {
797                 /* Support weight for select groups */
798                 position 0;
799             }
800             bit OFPGFC_SELECT_LIVENESS {
801                 /* Support liveness for select groups */
802                 position 1;
803             }
804             bit OFPGFC_CHAINING {
805                 /* Support chaining groups */
806                 position 2;
807             }
808             bit OFPGFC_CHAINING_CHECKS {
809                 /* Check chaining for loops and delete */
810                 position 3;
811             }
812         }
813     }
814     
815 }