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