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