Fixed issues
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-protocol.yang
1 module openflow-protocol {\r
2     namespace "urn:opendaylight:openflow:protocol";\r
3     prefix "ofproto";\r
4 \r
5     import ietf-yang-types {prefix yang;}\r
6     \r
7     import openflow-types {prefix oft;}\r
8     import openflow-extensible-match { prefix oxm;}\r
9     import openflow-instruction { prefix ofinstruction;}\r
10     import openflow-action {prefix ofaction;}\r
11 \r
12     revision "2013-07-31" {\r
13         description "OpenFlow 1.3 - protocol objects model";\r
14     }\r
15 \r
16     // Generic Structures\r
17         grouping port {\r
18             // reference "ofp_port";\r
19             leaf port-no { \r
20                 // reference "ofp_port.port_no"; \r
21                 type uint32;\r
22             }\r
23             leaf hw-addr { \r
24                 // reference "ofp_port.hw_addr"; \r
25                 type yang:mac-address;\r
26             }\r
27             leaf name { \r
28                 // reference "ofp_port.name"; \r
29                 type string;\r
30             }\r
31             leaf config { \r
32                 // reference "ofp_port.config"; \r
33                 type oft:port-config;\r
34             }\r
35             leaf state { \r
36                 // reference "ofp_port.state"; \r
37                 type oft:port-state;\r
38             }\r
39             leaf current-features { \r
40                 description "Current features.";\r
41                 // reference "ofp_port.curr"; \r
42                 type oft:port-features; \r
43             }\r
44             leaf advertised-features { \r
45                 description "Features being advertised by the port.";\r
46                 // reference "ofp_port.advertised"; \r
47                 type oft:port-features; \r
48             }\r
49             leaf supported-features { \r
50                 description "Features supported by the port.";\r
51                 // reference "ofp_port.supported"; \r
52                 type oft:port-features; \r
53             }\r
54             leaf peer-features { \r
55                 description "Features advertised by peer.";\r
56                 // reference "ofp_port.peer"; \r
57                 type oft:port-features; \r
58             }\r
59             leaf curr-speed { \r
60                 description "Current port bitrate in kbps.";\r
61                 // reference "ofp_port.curr_speed"; \r
62                 type uint32; \r
63                 units "kbps";\r
64             }\r
65             leaf max-speed { \r
66                 description "Max port bitrate in kbps";\r
67                 // reference "ofp_port.max_speed"; \r
68                 type uint32;\r
69                 units "kbps"; \r
70             }\r
71             \r
72             // OF1.0 structures\r
73             leaf config-v10 { \r
74                 // reference "ofp_port.config"; \r
75                 type oft:port-config-v10;\r
76             }\r
77             leaf state-v10 { \r
78                 // reference "ofp_port.state"; \r
79                 type oft:port-state-v10;\r
80             }\r
81             leaf current-features-v10 { \r
82                 description "Current features.";\r
83                 // reference "ofp_port.curr"; \r
84                 type oft:port-features-v10; \r
85             }\r
86             leaf advertised-features-v10 { \r
87                 description "Features being advertised by the port.";\r
88                 // reference "ofp_port.advertised"; \r
89                 type oft:port-features-v10; \r
90             }\r
91             leaf supported-features-v10 { \r
92                 description "Features supported by the port.";\r
93                 // reference "ofp_port.supported"; \r
94                 type oft:port-features-v10; \r
95             }\r
96             leaf peer-features-v10 { \r
97                 description "Features advertised by peer.";\r
98                 // reference "ofp_port.peer"; \r
99                 type oft:port-features-v10; \r
100             }\r
101         }\r
102         \r
103         grouping match-grouping {\r
104             container match {\r
105                 leaf type {\r
106                     type identityref {\r
107                         base oft:match-type-base;\r
108                     }\r
109                 }\r
110                 uses oxm:oxm-fields;\r
111             }\r
112         }\r
113 \r
114         grouping buckets {\r
115                 list buckets-list {\r
116                     uses bucket;\r
117                 }\r
118             }\r
119             \r
120             grouping bucket {\r
121                 leaf weight {\r
122                     type uint16;\r
123                 }\r
124                 leaf watch-port {\r
125                     type oft:port-number;\r
126                 }\r
127                 leaf watch-group {\r
128                     type uint32;\r
129                 }\r
130                 \r
131                 uses ofaction:actions;\r
132             }\r
133             \r
134         container table-features-properties-container {\r
135             uses table-features-properties;\r
136         }\r
137 \r
138         grouping table-features-properties {\r
139             list table-feature-properties {\r
140                 key "type";\r
141                 leaf type {\r
142                     type oft:table-features-prop-type;\r
143                 }\r
144             }\r
145         }\r
146 \r
147     // # MESSAGE Structures\r
148         /* Immutable messages. */\r
149             grouping ofHeader {\r
150                 //reference "ofpt_header struct in Openflow Switch 1.3 Spec"\r
151                 leaf version {\r
152                     type uint8;\r
153                     //reference "OpenFlow Header - OFP_VERSION";\r
154                 }\r
155                 leaf xid {\r
156                     type uint32;\r
157                     //reference "OpenFlow Header - transaction id";\r
158                 }\r
159             }\r
160             grouping ofHelloElementHeader {\r
161                 //reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec"\r
162                 leaf type {\r
163                     type oft:hello-element-type;\r
164                     //reference "OpenFlow Header element type - OFPHET_*";\r
165                 }\r
166             }\r
167             grouping hello {\r
168                 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
169                 /* Symmetric message */\r
170                 uses ofHeader;\r
171                 \r
172                 list elements {\r
173                     uses ofHelloElementHeader;\r
174                     \r
175                     leaf-list version-bitmap {\r
176                         type boolean;\r
177                     }\r
178                 }\r
179             }\r
180             grouping error {\r
181                 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"\r
182                 /* Symmetric message */\r
183                 uses ofHeader;\r
184                 \r
185                 leaf type {\r
186                     type uint16;\r
187                 }\r
188                 leaf code {\r
189                     type uint16;\r
190                 }\r
191                 leaf type-string {\r
192                     type string;\r
193                 }\r
194                 leaf code-string {\r
195                     type string;\r
196                 }\r
197                 leaf data {\r
198                     type binary; \r
199                 }\r
200             }\r
201             grouping echo-request {\r
202                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
203                 /* Symmetric message */\r
204                 uses ofHeader;\r
205                 \r
206                 leaf data {\r
207                     type binary;\r
208                 }\r
209             }\r
210             grouping echo-reply {\r
211                 // reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"\r
212                 /* Symmetric message */\r
213                 uses ofHeader;\r
214                 \r
215                 leaf data {\r
216                     type binary;\r
217                 }\r
218             }\r
219             grouping experimenter {\r
220                 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"\r
221                 /* Symmetric message */\r
222                 uses ofHeader;\r
223                 \r
224                 leaf experimenter {\r
225                     type uint32;\r
226                 }\r
227                 leaf exp_type {\r
228                     type uint32;\r
229                 }\r
230                 leaf data {\r
231                     type binary;\r
232                 }\r
233             }\r
234         /* Switch configuration messages. */\r
235             grouping features-request {\r
236                 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"\r
237                 /* Controller/switch message */\r
238                 uses ofHeader;\r
239             }\r
240             grouping features-reply {\r
241                 // reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"\r
242                 /* Controller/switch message */\r
243                 uses ofHeader;\r
244                 \r
245                 leaf datapathId {\r
246                     type uint64;\r
247                 }\r
248                 leaf buffers {\r
249                     type uint32;\r
250                 }\r
251                 leaf tables {\r
252                     type uint8;\r
253                 }\r
254                 leaf auxiliaryId {\r
255                     type uint8;\r
256                 }\r
257                 leaf capabilities {\r
258                     type oft:capabilities;\r
259                 }\r
260                 leaf reserved {\r
261                     type uint32;\r
262                 }\r
263                 // OF1.0 structures\r
264                 leaf capabilities-v10 {\r
265                     type oft:capabilities-v10;\r
266                 }\r
267                 leaf actions-v10 {\r
268                     type oft:action-type-v10;\r
269                 }\r
270                 list phy-port {\r
271                     uses port;\r
272                 }\r
273             }\r
274             grouping get-config-request {\r
275                 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
276                 /* Controller/switch message */\r
277                 uses ofHeader;\r
278             }\r
279             grouping get-config-reply {\r
280                 // reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"\r
281                 /* Controller/switch message */\r
282                 uses ofHeader;\r
283                 \r
284                 leaf flags {\r
285                     type oft:switch-config-flag;\r
286                 }\r
287                 leaf miss-send-len {\r
288                     type uint16;\r
289                 }\r
290             }\r
291             grouping set-config {\r
292                 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"\r
293                 /* Controller/switch message */\r
294                 \r
295                 uses ofHeader;\r
296                 \r
297                 leaf flags {\r
298                     type oft:switch-config-flag;\r
299                 }\r
300                 leaf miss-send-len {\r
301                     type uint16;\r
302                 }\r
303             }\r
304         /* Asynchronous messages. */\r
305             grouping packet-in {\r
306                 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"\r
307                 /* Async message */\r
308                 \r
309                 uses ofHeader;\r
310                 \r
311                 leaf buffer-id {\r
312                     // ID assigned by datapath.\r
313                     type uint32;\r
314                 }\r
315                 leaf total-len {\r
316                     // Full length of frame.\r
317                     type uint16;\r
318                 }\r
319                 leaf reason {\r
320                     // Reason packet is being sent (one of OFPR_*) \r
321                     type oft:packet-in-reason;\r
322                 }\r
323                 leaf table-id {\r
324                     // ID of the table that was looked up\r
325                     type oft:table-id;\r
326                 }\r
327                 leaf cookie {\r
328                     // Cookie of the flow entry that was looked up.\r
329                     type uint64;\r
330                 }\r
331                 uses match-grouping;\r
332                 \r
333 // struct ofp_match match; /* Packet metadata. Variable size. */\r
334 // /* The variable size and padded match is always followed by:\r
335 //  *   - Exactly 2 all-zero padding bytes, then\r
336 //  *   - An Ethernet frame whose length is inferred from header.length.\r
337 //  * The padding bytes preceding the Ethernet frame ensure that the IP\r
338 //  * header (if any) following the Ethernet header is 32-bit aligned.\r
339 //  */\r
340                 leaf data {\r
341                     type binary;\r
342                 }\r
343                 \r
344                 // OF1.0 structures\r
345                 leaf in-port {\r
346                     type uint16;\r
347                 }\r
348             }\r
349             grouping flow-removed {\r
350                 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"\r
351                 /* Async message */\r
352                 uses ofHeader;\r
353                 \r
354                 leaf cookie {\r
355                     type uint64;\r
356                 }\r
357                 leaf priority {\r
358                     type uint16;\r
359                 }\r
360                 leaf reason {\r
361                     type oft:flow-removed-reason;\r
362                 }\r
363                 leaf table-id {\r
364                     type oft:table-id;\r
365                 }\r
366                 leaf duration-sec {\r
367                     type uint32;\r
368                 }\r
369                 leaf duration-nsec {\r
370                     type uint32;\r
371                 }\r
372                 leaf idle-timeout {\r
373                     type uint16;\r
374                 }\r
375                 leaf hard-timeout {\r
376                     type uint16;\r
377                 }\r
378                 leaf packet-count {\r
379                     type uint64;\r
380                 }\r
381                 leaf byte-count {\r
382                     type uint64;\r
383                 }\r
384                 uses match-grouping;\r
385                 \r
386                 // OF1.0 structures\r
387                 uses oxm:match-v10-grouping;\r
388             } \r
389             grouping port-status {\r
390                 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"\r
391                 \r
392                 uses ofHeader;\r
393                 \r
394                 uses port;\r
395                 \r
396                 leaf reason {\r
397                     type oft:port-reason;\r
398                 }\r
399             } /* Async message */\r
400         /* Controller command messages. */\r
401             grouping packet-out {\r
402                 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"\r
403                 /* Controller/switch message */\r
404                 \r
405                 uses ofHeader;\r
406                 \r
407                 uses ofaction:actions;\r
408                 \r
409                 leaf data {\r
410                     type binary;\r
411                 }\r
412                 leaf buffer-id {\r
413                     type uint32;\r
414                 }\r
415                 leaf in-port {\r
416                     type oft:port-number;\r
417                 }\r
418             } \r
419             grouping flow-mod {\r
420                 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"\r
421                 /* Controller/switch message */\r
422                 \r
423                 uses ofHeader;\r
424                 \r
425                 leaf cookie {\r
426                     type uint64;\r
427                 }\r
428                 leaf cookie-mask {\r
429                     type uint64;\r
430                 }\r
431                 leaf table-id {\r
432                     type oft:table-id;\r
433                 }\r
434                 leaf command {\r
435                     type oft:flow-mod-command;\r
436                 }\r
437                 leaf idle-timeout {\r
438                     type uint16;\r
439                 }\r
440                 leaf hard-timeout {\r
441                     type uint16;\r
442                 }\r
443                 leaf priority {\r
444                     type uint16;\r
445                 }\r
446                 leaf buffer-id {\r
447                     type uint32;\r
448                 }\r
449                 leaf out-port {\r
450                     type oft:port-number;\r
451                 }\r
452                 leaf out-group {\r
453                     type uint32;\r
454                 }\r
455                 leaf flags {\r
456                     type oft:flow-mod-flags;\r
457                 }\r
458                 uses match-grouping;\r
459                 \r
460                 uses ofinstruction:instructions;\r
461                 \r
462                 // OF1.0 structures\r
463                 leaf flags-v10 {\r
464                     type oft:flow-mod-flags-v10;\r
465                 }\r
466                 uses oxm:match-v10-grouping;\r
467                 uses ofaction:actions;\r
468             } \r
469             grouping group-mod {\r
470                 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"\r
471                 /* Controller/switch message */\r
472                 \r
473                 uses ofHeader;\r
474                 \r
475                 leaf command {\r
476                     type oft:group-mod-command;\r
477                 }\r
478                 leaf type {\r
479                     type oft:group-type;\r
480                 }\r
481                 leaf group-id {\r
482                     type oft:group-id;\r
483                 }\r
484                 \r
485                 uses buckets;\r
486             }\r
487             \r
488             grouping port-mod {\r
489                 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"\r
490                 /* Controller/switch message */\r
491 \r
492                 uses ofHeader;\r
493                 \r
494                 leaf port-no {\r
495                     type oft:port-number;\r
496                 }\r
497                 leaf hw-address {\r
498                     type yang:mac-address;\r
499                 }       \r
500                 leaf config {\r
501                     type oft:port-config;\r
502                 }   \r
503                 leaf mask {\r
504                     type oft:port-config;\r
505                 }\r
506                 leaf advertise {\r
507                     type oft:port-features;\r
508                 }\r
509                 // OF1.0 structures\r
510                 leaf config-v10 {\r
511                     type oft:port-config-v10;\r
512                 }\r
513                 leaf mask-v10 {\r
514                     type oft:port-config-v10;\r
515                 }\r
516                 leaf advertise-v10 {\r
517                     type oft:port-features-v10;\r
518                 }\r
519             } \r
520             grouping table-mod {\r
521                 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"\r
522                 /* Controller/switch message */\r
523 \r
524                 uses ofHeader;\r
525                 \r
526                 leaf table-id {\r
527                     type oft:table-id;\r
528                 }\r
529                 leaf config {\r
530                     type oft:table-config;\r
531                 }\r
532             } \r
533             \r
534         /* Multipart messages. */\r
535             grouping multipart-request {\r
536                 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"\r
537                 /* Controller/switch message */\r
538 \r
539                 uses ofHeader;\r
540                 \r
541                 leaf type {\r
542                     type oft:multipart-type;\r
543                 }          \r
544                 leaf flags {\r
545                     type oft:multipart-request-flags;\r
546                 }      \r
547                 choice multipart-request-body {\r
548                     case multipart-request-desc-case {\r
549                         container multipart-request-desc {\r
550                             leaf empty {\r
551                                 type empty;\r
552                             }\r
553                         }\r
554                     }\r
555                     case multipart-request-flow-case {\r
556                         container multipart-request-flow {\r
557                             leaf table-id {\r
558                                 type uint8;\r
559                             }\r
560                             leaf out-port {\r
561                                 type uint32;\r
562                             }\r
563                             leaf out-group {\r
564                                 type uint32;\r
565                             }\r
566                             leaf cookie {\r
567                                 type uint64;\r
568                             }\r
569                             leaf cookie-mask {\r
570                                 type uint64;\r
571                             }\r
572                             uses match-grouping;\r
573                             \r
574                             // OF1.0 structures\r
575                             uses oxm:match-v10-grouping;\r
576                         }\r
577                     }\r
578                     case multipart-request-aggregate-case {\r
579                         container multipart-request-aggregate {\r
580                             leaf table-id {\r
581                                 type uint8;\r
582                             }\r
583                             leaf out-port {\r
584                                 type uint32;\r
585                             }\r
586                             leaf out-group {\r
587                                 type uint32;\r
588                             }\r
589                             leaf cookie {\r
590                                 type uint64;\r
591                             }\r
592                             leaf cookie-mask {\r
593                                 type uint64;\r
594                             }\r
595                             uses match-grouping;\r
596                             \r
597                             // OF1.0 structures\r
598                             uses oxm:match-v10-grouping;\r
599                         }\r
600                     }\r
601                     case multipart-request-table-case {\r
602                         container multipart-request-table {\r
603                             leaf empty {\r
604                                 type empty;\r
605                             }\r
606                         }\r
607                     }\r
608                     case multipart-request-port-stats-case {\r
609                         container multipart-request-port-stats {\r
610                             leaf port-no {\r
611                                 type uint32;\r
612                             }\r
613                         }\r
614                     }\r
615                     case multipart-request-queue-case {\r
616                         container multipart-request-queue {\r
617                             leaf port-no {\r
618                                 type uint32;\r
619                             }\r
620                             leaf queue-id {\r
621                                 type uint32;\r
622                             }\r
623                         }\r
624                     }\r
625                     case multipart-request-group-case {\r
626                         container multipart-request-group {\r
627                             leaf group-id {\r
628                                 type oft:group-id;\r
629                             }\r
630                         }\r
631                     }\r
632                     case multipart-request-group-desc-case {\r
633                         container multipart-request-group-desc {\r
634                             leaf empty {\r
635                                 type empty;\r
636                             }\r
637                         }\r
638                     }\r
639                     case multipart-request-group-features-case {\r
640                         container multipart-request-group-features {\r
641                             leaf empty {\r
642                                 type empty;\r
643                             }\r
644                         }\r
645                     }\r
646                     case multipart-request-meter-case {\r
647                         container multipart-request-meter {\r
648                             leaf meter-id {\r
649                                 type oft:meter-id;\r
650                             }\r
651                         }\r
652                     }\r
653                     case multipart-request-meter-config-case {\r
654                         container multipart-request-meter-config {\r
655                             leaf meter-id {\r
656                                 type oft:meter-id;\r
657                             }\r
658                         }\r
659                     }\r
660                     case multipart-request-meter-features-case {\r
661                         container multipart-request-meter-features {\r
662                             leaf empty {\r
663                                 type empty;\r
664                             }\r
665                         }\r
666                     }\r
667                     case multipart-request-table-features-case {\r
668                         container multipart-request-table-features {\r
669                             list table-features {\r
670                                 leaf table-id {\r
671                                     type uint8;\r
672                                 }\r
673                                 leaf name {\r
674                                     type string;\r
675                                 }\r
676                                 leaf metadata-match {\r
677                                     type uint64;\r
678                                 }\r
679                                 leaf metadata-write {\r
680                                     type uint64;\r
681                                 }\r
682                                 leaf config {\r
683                                     type oft:table-config;\r
684                                 }\r
685                                 leaf max-entries {\r
686                                     type uint32;\r
687                                 }\r
688                                 uses table-features-properties;\r
689                             }\r
690                         }\r
691                     }\r
692                     case multipart-request-port-desc-case {\r
693                         container multipart-request-port-desc {\r
694                             leaf empty {\r
695                                 type empty;\r
696                             }\r
697                         }\r
698                     }\r
699                     case multipart-request-experimenter-case {\r
700                         container multipart-request-experimenter {\r
701                             leaf experimenter {\r
702                                 type uint32;\r
703                             }\r
704                             leaf exp-type {\r
705                                 type uint32;\r
706                             }\r
707                             leaf data {\r
708                                 type binary;\r
709                             }\r
710                         }\r
711                     }\r
712                 }\r
713             } \r
714             grouping multipart-reply {\r
715                 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"\r
716                 /* Controller/switch message */\r
717 \r
718                 uses ofHeader;\r
719                 \r
720                 leaf type {\r
721                     type oft:multipart-type;\r
722                 }\r
723                 leaf flags {\r
724                     type oft:multipart-request-flags;\r
725                 }\r
726                 choice multipart-reply-body {\r
727                     case multipart-reply-desc-case {\r
728                         container multipart-reply-desc {\r
729                             leaf mfr_desc {\r
730                                 type string;\r
731                             }\r
732                             leaf hw_desc {\r
733                                 type string;\r
734                             }\r
735                             leaf sw_desc {\r
736                                 type string;\r
737                             }\r
738                             leaf serial_num {\r
739                                 type string;\r
740                             }\r
741                             leaf dp_desc {\r
742                                 type string;\r
743                             }\r
744                         }\r
745                     }\r
746                     case multipart-reply-flow-case {\r
747                         container multipart-reply-flow {\r
748                             list flow-stats {\r
749                                 leaf table-id {\r
750                                     type uint8;\r
751                                 }\r
752                                 leaf duration-sec {\r
753                                     type uint32;\r
754                                 }\r
755                                 leaf duration-nsec {\r
756                                     type uint32;\r
757                                 }\r
758                                 leaf priority {\r
759                                     type uint16;\r
760                                 }\r
761                                 leaf idle-timeout {\r
762                                     type uint16;\r
763                                 }\r
764                                 leaf hard-timeout {\r
765                                     type uint16;\r
766                                 }\r
767                                 leaf flags {\r
768                                     type oft:flow-mod-flags;\r
769                                 }\r
770                                 leaf cookie {\r
771                                     type uint64;\r
772                                 }\r
773                                 leaf packet-count {\r
774                                     type uint64;\r
775                                 }\r
776                                 leaf byte-count {\r
777                                     type uint64;\r
778                                 }\r
779                                 uses match-grouping;\r
780                                 \r
781                                 uses ofinstruction:instructions;\r
782                                 \r
783                                 // OF1.0 structures\r
784                                 uses oxm:match-v10-grouping;\r
785                                 uses ofaction:actions;\r
786                             }\r
787                         }\r
788                     }\r
789                     case multipart-reply-aggregate-case {\r
790                         container multipart-reply-aggregate {\r
791                             leaf packet-count {\r
792                                 type uint64;\r
793                             }\r
794                             leaf byte-count {\r
795                                 type uint64;\r
796                             }\r
797                             leaf flow-count {\r
798                                 type uint32;\r
799                             }\r
800                         }\r
801                     }\r
802                     case multipart-reply-table-case {\r
803                         container multipart-reply-table {\r
804                             list table-stats {\r
805                                 leaf table-id {\r
806                                     type uint8;\r
807                                 }\r
808                                 leaf active-count {\r
809                                     type uint32;\r
810                                 }\r
811                                 leaf lookup-count {\r
812                                     type uint64;\r
813                                 }\r
814                                 leaf matched-count {\r
815                                     type uint64;\r
816                                 }\r
817                                 \r
818                                 // OF1.0 structures\r
819                                 leaf name {\r
820                                     type string;\r
821                                 }\r
822                                 leaf wildcards {\r
823                                     type oft:flow-wildcards-v10;\r
824                                 }\r
825                                 leaf nw-src-mask {\r
826                                     type uint8;\r
827                                 }\r
828                                 leaf nw-dst-mask {\r
829                                     type uint8;\r
830                                 }\r
831                                 leaf max-entries {\r
832                                     type uint32;\r
833                                 }\r
834                             }\r
835                         }\r
836                     }\r
837                     case multipart-reply-port-stats-case {\r
838                         container multipart-reply-port-stats {\r
839                             list port-stats {\r
840                                 leaf port-no {\r
841                                     type uint32;\r
842                                 }\r
843                                 leaf rx-packets {\r
844                                     type uint64;\r
845                                 }\r
846                                 leaf tx-packets {\r
847                                     type uint64;\r
848                                 }\r
849                                 leaf rx-bytes {\r
850                                     type uint64;\r
851                                 }\r
852                                 leaf tx-bytes {\r
853                                     type uint64;\r
854                                 }\r
855                                 leaf rx-dropped {\r
856                                     type uint64;\r
857                                 }\r
858                                 leaf tx-dropped {\r
859                                     type uint64;\r
860                                 }\r
861                                 leaf rx-errors {\r
862                                     type uint64;\r
863                                 }\r
864                                 leaf tx-errors {\r
865                                     type uint64;\r
866                                 }\r
867                                 leaf rx-frame-err {\r
868                                     type uint64;\r
869                                 }\r
870                                 leaf rx-over-err {\r
871                                     type uint64;\r
872                                 }\r
873                                 leaf rx-crc-err {\r
874                                     type uint64;\r
875                                 }\r
876                                 leaf collisions {\r
877                                     type uint64;\r
878                                 }\r
879                                 leaf duration-sec {\r
880                                     type uint32;\r
881                                 }\r
882                                 leaf duration-nsec {\r
883                                     type uint32;\r
884                                 }\r
885                             }\r
886                         }\r
887                     }\r
888                     case multipart-reply-queue-case {\r
889                         container multipart-reply-queue {\r
890                             list queue-stats {\r
891                                 leaf port-no {\r
892                                     type uint32;\r
893                                 }\r
894                                 leaf queue-id {\r
895                                     type uint32;\r
896                                 }\r
897                                 leaf tx-bytes {\r
898                                     type uint64;\r
899                                 }\r
900                                 leaf tx-packets {\r
901                                     type uint64;\r
902                                 }\r
903                                 leaf tx-errors {\r
904                                     type uint64;\r
905                                 }\r
906                                 leaf duration-sec {\r
907                                     type uint32;\r
908                                 }\r
909                                 leaf duration-nsec {\r
910                                     type uint32;\r
911                                 }\r
912                             }\r
913                         }\r
914                     }\r
915                     case multipart-reply-group-case {\r
916                         container multipart-reply-group {\r
917                             list group-stats {\r
918                                 leaf group-id {\r
919                                     type oft:group-id;\r
920                                 }\r
921                                 leaf ref-count {\r
922                                     type uint32;\r
923                                 }\r
924                                 leaf packet-count {\r
925                                     type uint64;\r
926                                 }\r
927                                 leaf byte-count {\r
928                                     type uint64;\r
929                                 }\r
930                                 leaf duration-sec {\r
931                                     type uint32;\r
932                                 }\r
933                                 leaf duration-nsec {\r
934                                     type uint32;\r
935                                 }\r
936                                 list bucket-stats {\r
937                                     leaf packet-count {\r
938                                         type uint64;\r
939                                     }\r
940                                     leaf byte-count {\r
941                                         type uint64;\r
942                                     }\r
943                                 }\r
944                             }\r
945                         }\r
946                     }\r
947                     case multipart-reply-group-desc-case {\r
948                         container multipart-reply-group-desc {\r
949                             list group-desc {\r
950                                 leaf type {\r
951                                     type oft:group-type;\r
952                                 }\r
953                                 leaf group-id {\r
954                                     type oft:group-id;\r
955                                 }\r
956                                 uses buckets;\r
957                             }\r
958                         }\r
959                     }\r
960                     case multipart-reply-group-features-case {\r
961                         container multipart-reply-group-features {\r
962                             leaf types {\r
963                                 type oft:group-types;\r
964                             }\r
965                             leaf capabilities {\r
966                                 type oft:group-capabilities;\r
967                             }\r
968                             leaf-list max_groups {\r
969                                 type uint32;\r
970                             }\r
971                             leaf-list actions-bitmap {\r
972                                 type oft:action-type;\r
973                             }\r
974                         }\r
975                     }\r
976                     case multipart-reply-meter-case {\r
977                         container multipart-reply-meter {\r
978                             list meter-stats {\r
979                                 leaf meter-id {\r
980                                     type oft:meter-id;\r
981                                 }\r
982                                 leaf flow-count {\r
983                                     type uint32;\r
984                                 }\r
985                                 leaf packet-in-count {\r
986                                     type uint64;\r
987                                 }\r
988                                 leaf byte-in-count {\r
989                                     type uint64;\r
990                                 }\r
991                                 leaf duration-sec {\r
992                                     type uint32;\r
993                                 }\r
994                                 leaf duration-nsec {\r
995                                     type uint32;\r
996                                 }\r
997                                 list meter-band-stats {\r
998                                     leaf packet-band-count {\r
999                                         type uint64;\r
1000                                     }\r
1001                                     leaf byte-band-count {\r
1002                                         type uint64;\r
1003                                     }\r
1004                                 }\r
1005                             }\r
1006                         }\r
1007                     }\r
1008                     case multipart-reply-meter-config-case {\r
1009                         container multipart-reply-meter-config {\r
1010                             list meter-config {\r
1011                                 leaf flags {\r
1012                                     type oft:meter-flags;\r
1013                                 }\r
1014                                 leaf meter-id {\r
1015                                     type oft:meter-id;\r
1016                                 }\r
1017                                 list bands {\r
1018                                     uses meter-band-header;\r
1019                                 }\r
1020                             }\r
1021                         }\r
1022                     }\r
1023                     case multipart-reply-meter-features-case {\r
1024                         container multipart-reply-meter-features {\r
1025                             leaf max-meter {\r
1026                                 type uint32;\r
1027                             }\r
1028                             leaf band-types {\r
1029                                 type oft:meter-band-type-bitmap;\r
1030                             }\r
1031                             leaf capabilities {\r
1032                                 type oft:meter-flags;\r
1033                             }\r
1034                             leaf max-bands {\r
1035                                 type uint8;\r
1036                             }\r
1037                             leaf max-color {\r
1038                                 type uint8;\r
1039                             }\r
1040                         }\r
1041                     }\r
1042                     case multipart-reply-table-features-case {\r
1043                         container multipart-reply-table-features {\r
1044                             list table-features {\r
1045                                 leaf table-id {\r
1046                                     type uint8;\r
1047                                 }\r
1048                                 leaf name {\r
1049                                     type string;\r
1050                                 }\r
1051                                 leaf metadata-match {\r
1052                                     type binary;\r
1053                                 }\r
1054                                 leaf metadata-write {\r
1055                                     type binary;\r
1056                                 }\r
1057                                 leaf config {\r
1058                                     type oft:table-config;\r
1059                                 } \r
1060                                 leaf max-entries {\r
1061                                     type uint32;\r
1062                                 }\r
1063                                 uses table-features-properties;\r
1064                             }\r
1065                         }\r
1066                     }\r
1067                     case multipart-reply-port-desc-case {\r
1068                         container multipart-reply-port-desc {\r
1069                             list ports {\r
1070                                 uses port;\r
1071                             }\r
1072                         }\r
1073                     }\r
1074                     case multipart-reply-experimenter-case {\r
1075                         container multipart-reply-experimenter {\r
1076                             leaf experimenter {\r
1077                                 type uint32;\r
1078                             }\r
1079                             leaf exp-type {\r
1080                                 type uint32;\r
1081                             }\r
1082                             leaf data {\r
1083                                 type binary;\r
1084                             }\r
1085                         }\r
1086                     }\r
1087                 }\r
1088             } \r
1089             /* Barrier messages. */\r
1090             grouping barrier-request {\r
1091                 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"\r
1092                 /* Controller/switch message */\r
1093                 uses ofHeader;\r
1094             } \r
1095             grouping barrier-reply {\r
1096                 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"\r
1097                 /* Controller/switch message */\r
1098                 uses ofHeader;\r
1099             } \r
1100         /* Queue Configuration messages. */\r
1101             grouping queue-get-config-request {\r
1102                 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1103                 /* Controller/switch message */\r
1104                 \r
1105                 uses ofHeader;\r
1106                 \r
1107                 leaf port {\r
1108                     type oft:port-number;\r
1109                 }\r
1110             } \r
1111             grouping queue-get-config-reply {\r
1112                 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"\r
1113                 /* Controller/switch message */\r
1114 \r
1115                 uses ofHeader;\r
1116                 \r
1117                 leaf port {\r
1118                     type oft:port-number;\r
1119                 }\r
1120                 list queues {\r
1121                     uses packet-queue;\r
1122                 }\r
1123             }\r
1124             grouping packet-queue {\r
1125                 leaf queue-id {\r
1126                     type oft:queue-id;\r
1127                 }\r
1128                 leaf port {\r
1129                     type oft:port-number;\r
1130                 }\r
1131                 uses queue-property-header;\r
1132             }\r
1133             container queue-prop-container {\r
1134                 uses queue-property-header;\r
1135             }\r
1136             grouping queue-property-header {\r
1137                 list queue-property {\r
1138                     key "property";\r
1139                     leaf property {\r
1140                         type oft:queue-properties;\r
1141                     }\r
1142                 }\r
1143             }\r
1144             /* Controller role change request messages. */\r
1145             grouping role-request {\r
1146                 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"\r
1147                 /* Controller/switch message */\r
1148                 \r
1149                 uses ofHeader;\r
1150                 \r
1151                 leaf role {\r
1152                     type oft:controller-role;\r
1153                 }\r
1154                 leaf generation-id {\r
1155                     type uint64;\r
1156                 }\r
1157             } \r
1158             grouping role-reply {\r
1159                 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"\r
1160                 /* Controller/switch message */\r
1161 \r
1162                 uses ofHeader;\r
1163                 \r
1164                 leaf role {\r
1165                     type oft:controller-role;\r
1166                 }\r
1167                 leaf generation-id {\r
1168                     type uint64;\r
1169                 }\r
1170             } \r
1171             /* Asynchronous message configuration. */\r
1172             grouping get-async-request {\r
1173                 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"\r
1174                 /* Controller/switch message */\r
1175 \r
1176                 uses ofHeader;                \r
1177             } \r
1178             grouping get-async-reply {\r
1179                 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"\r
1180                 /* Controller/switch message */\r
1181 \r
1182                 uses ofHeader;\r
1183                 uses async-body-grouping;\r
1184             } \r
1185             grouping set-async {\r
1186                 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"\r
1187                 /* Controller/switch message */\r
1188                 \r
1189                 uses ofHeader;\r
1190                 uses async-body-grouping;\r
1191             }\r
1192             \r
1193             grouping async-body-grouping {\r
1194                 list packet-in-mask {\r
1195                     leaf-list mask {\r
1196                         type oft:packet-in-reason;\r
1197                     }\r
1198                 }\r
1199                 list port-status-mask {\r
1200                     leaf-list mask {\r
1201                         type oft:port-reason;\r
1202                     }\r
1203                 }\r
1204                 list flow-removed-mask {\r
1205                     leaf-list mask {\r
1206                         type oft:flow-removed-reason;\r
1207                     }\r
1208                 }\r
1209             }\r
1210             /* Meters and rate limiters configuration messages. */\r
1211             grouping meter-mod {\r
1212                 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"\r
1213                 /* Controller/switch message */\r
1214 \r
1215                 uses ofHeader;\r
1216                 \r
1217                 leaf command {\r
1218                     type oft:meter-mod-command;\r
1219                 } \r
1220                 leaf flags {\r
1221                     type oft:meter-flags;\r
1222                 }\r
1223                 leaf meter-id {\r
1224                     type oft:meter-id;\r
1225                 }\r
1226                 list bands {\r
1227                     uses meter-band-header;\r
1228                 }\r
1229             }\r
1230             \r
1231             grouping meter-band-header {\r
1232                 choice meter-band {\r
1233                     case meter-band-drop-case {\r
1234                         container meter-band-drop {\r
1235                             uses meter-band-commons;\r
1236                         }\r
1237                     }\r
1238                     case meter-band-dscp-remark-case {\r
1239                         container meter-band-dscp-remark {\r
1240                             uses meter-band-commons;\r
1241                             leaf prec-level {\r
1242                                 type uint8;\r
1243                             }\r
1244                         }\r
1245                     }\r
1246                     case meter-band-experimenter-case {\r
1247                         container meter-band-experimenter {\r
1248                             uses meter-band-commons;\r
1249                             leaf experimenter {\r
1250                                 type uint32;\r
1251                             }\r
1252                         }\r
1253                     }\r
1254                 }\r
1255             }\r
1256             \r
1257             grouping meter-band-commons {\r
1258                 leaf type {\r
1259                     type oft:meter-band-type;\r
1260                 }\r
1261                 leaf rate {\r
1262                     type uint32;\r
1263                 }\r
1264                 leaf burst-size {\r
1265                     type uint32;\r
1266                 }\r
1267             }\r
1268 \r
1269             /* Immutable messages. */\r
1270             notification hello-message {\r
1271                 uses hello;\r
1272                 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
1273                 \r
1274                 /* Symmetric message */\r
1275             }\r
1276             notification error-message {\r
1277                 uses error;\r
1278                 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"\r
1279                 \r
1280                 /* Symmetric message */\r
1281             }\r
1282             notification echo-request-message {\r
1283                 uses echo-request;\r
1284                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1285                 \r
1286                 /* Symmetric message */\r
1287             }\r
1288             notification experimenter-message {\r
1289                 uses experimenter;\r
1290                 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"\r
1291                 // TODO:: does switch send this when understood experimenter msg from lib?\r
1292                 /* Symmetric message */\r
1293             }\r
1294     // # Notification and RPCs\r
1295         /* Symmetric RPC. */\r
1296             rpc echo {\r
1297                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1298                 input {\r
1299                     uses echo-request;\r
1300                 }\r
1301                 /* Controller/switch message */\r
1302                 output {\r
1303                     uses echo-reply;\r
1304                 }\r
1305             }\r
1306             \r
1307             rpc echo-reply {\r
1308                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1309                 input {\r
1310                     uses echo-reply;\r
1311                 }\r
1312             }\r
1313             \r
1314             rpc hello {\r
1315                 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
1316                 input {\r
1317                     uses hello;\r
1318                 }\r
1319             }\r
1320             \r
1321             rpc experimenter {\r
1322                 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"\r
1323                 input {\r
1324                     uses experimenter;\r
1325                 }\r
1326             }\r
1327 \r
1328         /* Switch configuration messages. */\r
1329             rpc get-features {\r
1330                 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"\r
1331                 input {\r
1332                     uses features-request;\r
1333                 }\r
1334                 /* Controller/switch message */\r
1335                 output {\r
1336                     uses features-reply;\r
1337                 }\r
1338             }\r
1339             \r
1340             rpc get-config {\r
1341                 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1342                 input {\r
1343                     uses get-config-request;\r
1344                 }\r
1345                 output {\r
1346                     uses get-config-reply;\r
1347                 }\r
1348                 /* Controller/switch message */\r
1349             }\r
1350             \r
1351             rpc set-config {\r
1352                 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"\r
1353                 input {\r
1354                     uses set-config;\r
1355                 }   \r
1356                 /* Controller/switch message */\r
1357             }\r
1358         /* Asynchronous messages. */\r
1359             notification packet-in-message {\r
1360                 uses packet-in;\r
1361                 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"\r
1362                 \r
1363              /* Async message */\r
1364             }\r
1365             notification flow-removed-message {\r
1366                 uses flow-removed;\r
1367                 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"\r
1368                 \r
1369                 /* Async message */\r
1370             } \r
1371             notification port-status-message {\r
1372                 uses port-status;\r
1373                 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"\r
1374                 \r
1375             } /* Async message */\r
1376 \r
1377         /* Controller command messages. */\r
1378             rpc packet-out {\r
1379                 input {\r
1380                     uses packet-out;\r
1381                     // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"\r
1382                 }\r
1383                 /* Controller/switch message */\r
1384             } \r
1385             rpc flow-mod {\r
1386                 input {\r
1387                     uses flow-mod;\r
1388                     // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"\r
1389                 }\r
1390                 /* Controller/switch message */\r
1391             } \r
1392             rpc group-mod {\r
1393                 input {\r
1394                     uses group-mod;\r
1395                     // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"\r
1396                 }\r
1397                 /* Controller/switch message */\r
1398             } \r
1399             rpc port-mod {\r
1400                 input {\r
1401                     uses port-mod;\r
1402                     // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"\r
1403                 }\r
1404             } /* Controller/switch message */\r
1405             \r
1406             rpc table-mod {\r
1407                 input {\r
1408                     uses table-mod;\r
1409                     // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"\r
1410                 }\r
1411             } /* Controller/switch message */\r
1412 \r
1413         /* Multipart messages. */\r
1414 \r
1415             rpc multipart-request {\r
1416                 input {\r
1417                     uses multipart-request;\r
1418                 }\r
1419             }\r
1420 \r
1421              /* Controller/switch message */\r
1422             notification multipart-reply-message {\r
1423                 uses multipart-reply;\r
1424                 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"\r
1425                 // notification because of multiple following responses\r
1426             } /* Controller/switch message */\r
1427             \r
1428 \r
1429             /* Barrier messages. */\r
1430             rpc barrier {\r
1431                 input {\r
1432                     uses barrier-request;\r
1433                     // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"\r
1434                 }\r
1435                 output {\r
1436                     uses barrier-reply;\r
1437                     // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"\r
1438                 }\r
1439             }\r
1440         /* Queue Configuration messages. */\r
1441             rpc get-queue-config {\r
1442                 input {\r
1443                     uses queue-get-config-request;\r
1444                     // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1445                 }\r
1446                 output {\r
1447                     uses queue-get-config-reply;\r
1448                     // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"\r
1449                 }\r
1450             } \r
1451 \r
1452         /* Controller role change request messages. */\r
1453             rpc role-request {\r
1454                 input {\r
1455                     uses role-request;\r
1456                     // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"\r
1457                 }\r
1458                 output {\r
1459                     uses role-reply;\r
1460                     // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"\r
1461                 }\r
1462             } /* Controller/switch message */\r
1463             \r
1464         /* Asynchronous message configuration. */\r
1465             rpc get-async {\r
1466                 input {\r
1467                     uses get-async-request;\r
1468                     // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"\r
1469                 }\r
1470                 output {\r
1471                     uses get-async-reply;\r
1472                     // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"\r
1473                 }\r
1474             } \r
1475              /* Controller/switch message */\r
1476             rpc set-async {\r
1477                 input { \r
1478                     uses set-async;\r
1479                 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"\r
1480                 }\r
1481                 \r
1482             } \r
1483         /* Meters and rate limiters configuration messages. */\r
1484             rpc meter-mod {\r
1485                 input {\r
1486                     uses meter-mod;\r
1487                     // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"\r
1488                 }\r
1489             } /* Controller/switch message */\r
1490 }