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