Merge "added content of grouping in of-protocol"
[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 group-mod-command {
390         /* ofp_group_mod_command */
391         type enumeration {
392             enum OFPGC_ADD {            
393               value 0;            
394               description "New group.";            
395             }
396             enum OFPGC_MODIFY {
397               value 1;
398               description "Modify all matching groups.";
399             }
400             enum OFPGC_DELETE {
401               value 2;
402               description "Delete all matching groups.";
403             }
404             
405         }
406     }
407     
408     
409     typedef group-type {
410         /* ofp_group_type */
411         type enumeration {
412             enum OFPGT_ALL {            
413               value 0;            
414               description "All (multicast/broadcast) group.";            
415             }
416             enum OFPGT_SELECT {
417               value 1;
418               description "Select group.";
419             }
420             enum OFPGT_INDIRECT {
421               value 2;
422               description "Indirect group.";
423             }
424             enum OFPGT_FF {
425               value 3;
426               description "Fast failover group.";
427             }
428         }
429     }
430     
431     typedef multipart-request-flags {
432         description
433             "enum ofp_multipart_request_flags ";
434         type bits {
435             bit OFPMPF_REQ_MORE {
436                 //description "More requests to follow.";
437                 position 0;
438             }
439         }
440     }
441     
442     typedef multipart-type {
443         /* ofp_multipart_type */
444         type enumeration {
445             enum OFPGT_ALL {
446               value 0;
447               description "All (multicast/broadcast) group.";
448             }
449             
450             enum OFPMP_DESC {
451               value 0;
452               description "Description of this OpenFlow switch.
453                  The request body is empty.
454                  The reply body is struct ofp_desc.";
455             }
456             enum OFPMP_FLOW {
457               value 1;
458               description "Individual flow statistics.
459                  The request body is struct ofp_flow_stats_request.
460                  The reply body is an array of struct ofp_flow_stats.";
461             }
462             enum OFPMP_AGGREGATE {
463               value 2;
464               description "Aggregate flow statistics.
465                  The request body is struct ofp_aggregate_stats_request.
466                  The reply body is struct ofp_aggregate_stats_reply.";
467             }
468             enum OFPMP_TABLE {
469               value 3;
470               description "Flow table statistics.
471                  The request body is empty.
472                  The reply body is an array of struct ofp_table_stats.";
473             }
474             enum OFPMP_PORT_STATS {
475               value 4;
476               description "Port statistics.
477                  The request body is struct ofp_port_stats_request.
478                  The reply body is an array of struct ofp_port_stats.";
479             }
480             enum OFPMP_QUEUE {
481               value 5;
482               description "Queue statistics for a port
483                  The request body is struct ofp_queue_stats_request.
484                  The reply body is an array of struct ofp_queue_stats";
485             }
486             enum OFPMP_GROUP {
487               value 6;
488               description "Group counter statistics.
489                  The request body is struct ofp_group_stats_request.
490                  The reply is an array of struct ofp_group_stats.";
491             }
492             enum OFPMP_GROUP_DESC {
493               value 7;
494               description "Group description.
495                  The request body is empty.
496                  The reply body is an array of struct ofp_group_desc.";
497             }
498             enum OFPMP_GROUP_FEATURES {
499               value 8;
500               description "Group features.
501                  The request body is empty.
502                  The reply body is struct ofp_group_features.";
503             }
504             enum OFPMP_METER {
505               value 9;
506               description "Meter statistics.
507                  The request body is struct ofp_meter_multipart_requests.
508                  The reply body is an array of struct ofp_meter_stats.";
509             }
510             enum OFPMP_METER_CONFIG {
511               value 10;
512               description "Meter configuration.
513                  The request body is struct ofp_meter_multipart_requests.
514                  The reply body is an array of struct ofp_meter_config.";
515             }
516             enum OFPMP_METER_FEATURES {
517               value 11;
518               description "Meter features.
519                  The request body is empty.
520                  The reply body is struct ofp_meter_features.";
521             }
522             enum OFPMP_TABLE_FEATURES {
523               value 12;
524               description "Table features.
525                  The request body is either empty or contains an array of
526                  struct ofp_table_features containing the controller’s
527                  desired view of the switch. If the switch is unable to
528                  set the specified view an error is returned.
529                  The reply body is an array of struct ofp_table_features.";
530             }
531             enum OFPMP_PORT_DESC {
532               value 13;
533               description "Port description.
534                  The request body is empty.
535                  The reply body is an array of struct ofp_port.";
536             }
537             enum OFPMP_EXPERIMENTER {
538               value 65535; //0xffff
539               description "Experimenter extension.
540                  The request and reply bodies begin with
541                  struct ofp_experimenter_multipart_header.
542                  The request and reply bodies are otherwise experimenter-defined.";
543             }
544         }
545     }
546     
547     typedef queue-property {
548         /* ofp_queue_properties */
549         type enumeration {
550             enum OFPGT_ALL {
551               value 0;
552               description "All (multicast/broadcast) group.";
553             }
554             enum OFPQT_MIN_RATE {
555                 value 1;
556                 description "Minimum datarate guaranteed.";
557             }
558             enum OFPQT_MAX_RATE {
559                 value 2;
560                 description "Maximum datarate.";
561             }
562             enum OFPQT_EXPERIMENTER {
563                 value 65535; // 0xffff 
564                 description "Experimenter defined property.";
565             }
566         }
567     }
568     
569     typedef controller-role {
570         /* ofp_controller_role */
571         type enumeration {
572             enum OFPCR_ROLE_NOCHANGE {
573               value 0;
574               description "Don’t change current role.";
575             }
576             enum OFPCR_ROLE_EQUAL {
577               value 1;
578               description "Default role, full access.";
579             }
580             enum OFPCR_ROLE_MASTER {
581               value 2;
582               description "Full access, at most one master.";
583             }
584             enum OFPCR_ROLE_SLAVE {
585               value 3;
586               description "Read-only access.";
587             }
588         }
589     }
590     
591     typedef packet-in-reason {
592         /* ofp_packet_in_reason */
593         type enumeration {
594             enum OFPR_NO_MATCH {
595               value 0;
596               description "No matching flow (table-miss flow entry). ";
597             }
598             enum OFPR_ACTION {
599               value 1;
600               description "Action explicitly output to controller. ";
601             }
602             enum OFPR_INVALID_TTL {
603               value 2;
604               description "Packet has invalid TTL ";
605             }
606         }
607     }
608     
609     typedef meter-mod-command {
610         /* ofp_meter_mod_command */
611         type enumeration {
612             enum OFPMC_ADD {
613               description "New meter. ";
614             }
615             enum OFPMC_MODIFY {
616               description "Modify specified meter. ";
617             }
618             enum OFPMC_DELETE {
619               description "Delete specified meter. ";
620             }
621
622         }
623     }
624  
625     typedef meter-flags {
626         /* ofp_meter_flags */
627         type bits {
628             bit OFPMF_KBPS {
629                 position 0;
630                 /* Rate value in kb/s (kilo-bit per second). */
631             }
632             bit OFPMF_PKTPS {
633                 position 1;
634                 /* Rate value in packet/sec. */
635             }
636             bit OFPMF_BURST {
637                 position 2;
638                 /* Do burst size. */
639             }
640             bit OFPMF_STATS {
641                 position 3;
642                 /* Collect statistics. */
643             }
644         }
645     }
646     
647     typedef meter-band-type {
648         /* ofp_meter_band_type */
649         type enumeration {
650             enum OFPMBT_DROP {
651               value 1;
652               description "Drop packet. ";
653             }
654             enum OFPMBT_DSCP_REMARK {
655               value 2;
656               description "Remark DSCP in the IP header. ";
657             }
658             enum OFPMBT_EXPERIMENTER {
659               value 65535; //0xFFFF
660               description "Experimenter meter band. ";
661             }
662
663         }
664     }
665 }