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