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