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