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