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