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