81f2f601332671b08e99531a16c09213bfaa63ed
[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                         // empty body\r
546                     }\r
547                     case multipart-request-flow {\r
548                         leaf table-id {\r
549                             type uint8;\r
550                         }\r
551                         leaf out-port {\r
552                             type uint32;\r
553                         }\r
554                         leaf out-group {\r
555                             type uint32;\r
556                         }\r
557                         leaf cookie {\r
558                             type uint64;\r
559                         }\r
560                         leaf cookie-mask {\r
561                             type uint64;\r
562                         }\r
563                         uses match-grouping;\r
564                         \r
565                         // OF1.0 structures\r
566                         uses oxm:match-v10-grouping;\r
567                     }\r
568                     case multipart-request-aggregate {\r
569                         leaf table-id {\r
570                             type uint8;\r
571                         }\r
572                         leaf out-port {\r
573                             type uint32;\r
574                         }\r
575                         leaf out-group {\r
576                             type uint32;\r
577                         }\r
578                         leaf cookie {\r
579                             type uint64;\r
580                         }\r
581                         leaf cookie-mask {\r
582                             type uint64;\r
583                         }\r
584                         uses match-grouping;\r
585                         \r
586                         // OF1.0 structures\r
587                         uses oxm:match-v10-grouping;\r
588                     }\r
589                     case multipart-request-table {\r
590                         // empty body\r
591                     }\r
592                     case multipart-request-port-stats {\r
593                         leaf port-no {\r
594                             type uint32;\r
595                         }\r
596                     }\r
597                     case multipart-request-queue {\r
598                         leaf port-no {\r
599                             type uint32;\r
600                         }\r
601                         leaf queue-id {\r
602                             type uint32;\r
603                         }\r
604                     }\r
605                     case multipart-request-group {\r
606                         leaf group-id {\r
607                             type uint32;\r
608                         }\r
609                     }\r
610                     case multipart-request-group-desc {\r
611                         // empty body\r
612                     }\r
613                     case multipart-request-group-features {\r
614                         // empty body\r
615                     }\r
616                     case multipart-request-meter {\r
617                         leaf meter-id {\r
618                             type uint32;\r
619                         }\r
620                     }\r
621                     case multipart-request-meter-config {\r
622                         leaf meter-id {\r
623                             type uint32;\r
624                         }\r
625                     }\r
626                     case multipart-request-meter-features {\r
627                         // empty body\r
628                     }\r
629                     case multipart-request-table-features {\r
630                         list table-features {\r
631                             leaf table-id {\r
632                                 type uint8;\r
633                             }\r
634                             leaf name {\r
635                                 type string;\r
636                             }\r
637                             leaf metadata-match {\r
638                                 type uint64;\r
639                             }\r
640                             leaf metadata-write {\r
641                                 type uint64;\r
642                             }\r
643                             leaf config {\r
644                                 type oft:table-config;\r
645                             }\r
646                             leaf max-entries {\r
647                                 type uint32;\r
648                             }\r
649                             uses table-features-properties;\r
650                         }\r
651                     }\r
652                     case multipart-request-port-desc {\r
653                         // empty body\r
654                     }\r
655                     case multipart-request-experimenter {\r
656                         leaf experimenter {\r
657                             type uint32;\r
658                         }\r
659                         leaf exp-type {\r
660                             type uint32;\r
661                         }\r
662                         leaf data {\r
663                             type binary;\r
664                         }\r
665                     }\r
666                 }\r
667             } \r
668             grouping multipart-reply {\r
669                 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"\r
670                 /* Controller/switch message */\r
671 \r
672                 uses ofHeader;\r
673                 \r
674                 leaf type {\r
675                     type oft:multipart-type;\r
676                 }\r
677                 leaf flags {\r
678                     type oft:multipart-request-flags;\r
679                 }\r
680                 choice multipart-reply-body {\r
681                     case multipart-reply-desc {\r
682                         leaf mfr_desc {\r
683                             type string;\r
684                         }\r
685                         leaf hw_desc {\r
686                             type string;\r
687                         }\r
688                         leaf sw_desc {\r
689                             type string;\r
690                         }\r
691                         leaf serial_num {\r
692                             type string;\r
693                         }\r
694                         leaf dp_desc {\r
695                             type string;\r
696                         }\r
697                     }\r
698                     case multipart-reply-flow {\r
699                         list flow-stats {\r
700                             leaf table-id {\r
701                                 type uint8;\r
702                             }\r
703                             leaf duration-sec {\r
704                                 type uint32;\r
705                             }\r
706                             leaf duration-nsec {\r
707                                 type uint32;\r
708                             }\r
709                             leaf priority {\r
710                                 type uint16;\r
711                             }\r
712                             leaf idle-timeout {\r
713                                 type uint16;\r
714                             }\r
715                             leaf hard-timeout {\r
716                                 type uint16;\r
717                             }\r
718                             leaf flags {\r
719                                 type oft:flow-mod-flags;\r
720                             }\r
721                             leaf cookie {\r
722                                 type uint64;\r
723                             }\r
724                             leaf packet-count {\r
725                                 type uint64;\r
726                             }\r
727                             leaf byte-count {\r
728                                 type uint64;\r
729                             }\r
730                             uses match-grouping;\r
731                             \r
732                             uses ofinstruction:instructions;\r
733                             \r
734                             // OF1.0 structures\r
735                             uses oxm:match-v10-grouping;\r
736                             uses ofaction:actions;\r
737                         }\r
738                     }\r
739                     case multipart-reply-aggregate {\r
740                         leaf packet-count {\r
741                             type uint64;\r
742                         }\r
743                         leaf byte-count {\r
744                             type uint64;\r
745                         }\r
746                         leaf flow-count {\r
747                             type uint32;\r
748                         }\r
749                     }\r
750                     case multipart-reply-table {\r
751                         list table-stats {\r
752                             leaf table-id {\r
753                                 type uint8;\r
754                             }\r
755                             leaf active-count {\r
756                                 type uint32;\r
757                             }\r
758                             leaf lookup-count {\r
759                                 type uint64;\r
760                             }\r
761                             leaf matched-count {\r
762                                 type uint64;\r
763                             }\r
764                             \r
765                             // OF1.0 structures\r
766                             leaf name {\r
767                                 type string;\r
768                             }\r
769                         }\r
770                     }\r
771                     case multipart-reply-port-stats {\r
772                         list port-stats {\r
773                             leaf port-no {\r
774                                 type uint32;\r
775                             }\r
776                             leaf rx-packets {\r
777                                 type uint64;\r
778                             }\r
779                             leaf tx-packets {\r
780                                 type uint64;\r
781                             }\r
782                             leaf rx-bytes {\r
783                                 type uint64;\r
784                             }\r
785                             leaf tx-bytes {\r
786                                 type uint64;\r
787                             }\r
788                             leaf rx-dropped {\r
789                                 type uint64;\r
790                             }\r
791                             leaf tx-dropped {\r
792                                 type uint64;\r
793                             }\r
794                             leaf rx-errors {\r
795                                 type uint64;\r
796                             }\r
797                             leaf tx-errors {\r
798                                 type uint64;\r
799                             }\r
800                             leaf rx-frame-err {\r
801                                 type uint64;\r
802                             }\r
803                             leaf rx-over-err {\r
804                                 type uint64;\r
805                             }\r
806                             leaf rx-crc-err {\r
807                                 type uint64;\r
808                             }\r
809                             leaf collisions {\r
810                                 type uint64;\r
811                             }\r
812                             leaf duration-sec {\r
813                                 type uint32;\r
814                             }\r
815                             leaf duration-nsec {\r
816                                 type uint32;\r
817                             }\r
818                         }\r
819                     }\r
820                     case multipart-reply-queue {\r
821                         list queue-stats {\r
822                             leaf port-no {\r
823                                 type uint32;\r
824                             }\r
825                             leaf queue-id {\r
826                                 type uint32;\r
827                             }\r
828                             leaf tx-bytes {\r
829                                 type uint64;\r
830                             }\r
831                             leaf tx-packets {\r
832                                 type uint64;\r
833                             }\r
834                             leaf tx-errors {\r
835                                 type uint64;\r
836                             }\r
837                             leaf duration-sec {\r
838                                 type uint32;\r
839                             }\r
840                             leaf duration-nsec {\r
841                                 type uint32;\r
842                             }\r
843                         }\r
844                     }\r
845                     case multipart-reply-group {\r
846                         list group-stats {\r
847                             leaf group-id {\r
848                                 type uint32;\r
849                             }\r
850                             leaf ref-count {\r
851                                 type uint32;\r
852                             }\r
853                             leaf packet-count {\r
854                                 type uint64;\r
855                             }\r
856                             leaf byte-count {\r
857                                 type uint64;\r
858                             }\r
859                             leaf duration-sec {\r
860                                 type uint32;\r
861                             }\r
862                             leaf duration-nsec {\r
863                                 type uint32;\r
864                             }\r
865                             list bucket-stats {\r
866                                 leaf packet-count {\r
867                                     type uint64;\r
868                                 }\r
869                                 leaf byte-count {\r
870                                     type uint64;\r
871                                 }\r
872                             }\r
873                         }\r
874                     }\r
875                     case multipart-reply-group-desc {\r
876                         list group-desc {\r
877                             leaf type {\r
878                                 type oft:group-type;\r
879                             }\r
880                             leaf group-id {\r
881                                 type uint32;\r
882                             }\r
883                             uses buckets;\r
884                         }\r
885                     }\r
886                     case multipart-reply-group-features {\r
887                         leaf types {\r
888                             type oft:group-types;\r
889                         }\r
890                         leaf capabilities {\r
891                             type oft:group-capabilities;\r
892                         }\r
893                         leaf-list max_groups {\r
894                             type uint32;\r
895                         }\r
896                         leaf-list actions-bitmap {\r
897                             type oft:action-type;\r
898                         }\r
899                     }\r
900                     case multipart-reply-meter {\r
901                         list meter-stats {\r
902                             leaf meter-id {\r
903                                 type uint32;\r
904                             }\r
905                             leaf flow-count {\r
906                                 type uint32;\r
907                             }\r
908                             leaf packet-in-count {\r
909                                 type uint64;\r
910                             }\r
911                             leaf byte-in-count {\r
912                                 type uint64;\r
913                             }\r
914                             leaf duration-sec {\r
915                                 type uint32;\r
916                             }\r
917                             leaf duration-nsec {\r
918                                 type uint32;\r
919                             }\r
920                             list meter-band-stats {\r
921                                 leaf packet-band-count {\r
922                                     type uint64;\r
923                                 }\r
924                                 leaf byte-band-count {\r
925                                     type uint64;\r
926                                 }\r
927                             }\r
928                         }\r
929                     }\r
930                     case multipart-reply-meter-config {\r
931                         list meter-config {\r
932                             leaf flags {\r
933                                 type oft:meter-flags;\r
934                             }\r
935                             leaf meter-id {\r
936                                 type uint32;\r
937                             }\r
938                             list bands {\r
939                                 uses meter-band-header;\r
940                             }\r
941                         }\r
942                     }\r
943                     case multipart-reply-meter-features {\r
944                         leaf max-meter {\r
945                             type uint32;\r
946                         }\r
947                         leaf band-types {\r
948                             type oft:meter-band-type;\r
949                         }\r
950                         leaf capabilities {\r
951                             type oft:meter-flags;\r
952                         }\r
953                         leaf max-bands {\r
954                             type uint8;\r
955                         }\r
956                         leaf max-color {\r
957                             type uint8;\r
958                         }\r
959                     }\r
960                     case multipart-reply-table-features {\r
961                         list table-features {\r
962                             leaf table-id {\r
963                                 type uint8;\r
964                             }\r
965                             leaf name {\r
966                                 type string;\r
967                             }\r
968                             leaf metadata-match {\r
969                                 type binary;\r
970                             }\r
971                             leaf metadata-write {\r
972                                 type binary;\r
973                             }\r
974                             leaf config {\r
975                                 type oft:port-config;\r
976                             } \r
977                             leaf max-entries {\r
978                                 type uint32;\r
979                             }\r
980                             uses table-features-properties;\r
981                         }\r
982                     }\r
983                     case multipart-reply-port-desc {\r
984                         list ports {\r
985                             uses port;\r
986                         }\r
987                     }\r
988                     case multipart-reply-experimenter {\r
989                         leaf experimenter {\r
990                             type uint32;\r
991                         }\r
992                         leaf exp-type {\r
993                             type uint32;\r
994                         }\r
995                         leaf data {\r
996                             type binary;\r
997                         }\r
998                     }\r
999                 }\r
1000             } \r
1001             /* Barrier messages. */\r
1002             grouping barrier-request {\r
1003                 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"\r
1004                 /* Controller/switch message */\r
1005                 uses ofHeader;\r
1006             } \r
1007             grouping barrier-reply {\r
1008                 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"\r
1009                 /* Controller/switch message */\r
1010                 uses ofHeader;\r
1011             } \r
1012         /* Queue Configuration messages. */\r
1013             grouping queue-get-config-request {\r
1014                 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1015                 /* Controller/switch message */\r
1016                 \r
1017                 uses ofHeader;\r
1018                 \r
1019                 leaf port {\r
1020                     type oft:port-number;\r
1021                 }\r
1022             } \r
1023             grouping queue-get-config-reply {\r
1024                 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"\r
1025                 /* Controller/switch message */\r
1026 \r
1027                 uses ofHeader;\r
1028                 \r
1029                 leaf port {\r
1030                     type oft:port-number;\r
1031                 }\r
1032                 list queues {\r
1033                     uses packet-queue;\r
1034                 }\r
1035             }\r
1036             grouping packet-queue {\r
1037                 leaf queue-id {\r
1038                     type oft:queue-id;\r
1039                 }\r
1040                 leaf port {\r
1041                     type oft:port-number;\r
1042                 }\r
1043                 uses queue-property-header;\r
1044             }\r
1045             container queue-prop-container {\r
1046                 uses queue-property-header;\r
1047             }\r
1048             grouping queue-property-header {\r
1049                 list queue-property {\r
1050                     leaf property {\r
1051                         type oft:queue-properties;\r
1052                     }\r
1053                 }\r
1054             }\r
1055             /* Controller role change request messages. */\r
1056             grouping role-request {\r
1057                 // reference "OFPT_ROLE_REQUEST 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             grouping role-reply {\r
1070                 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"\r
1071                 /* Controller/switch message */\r
1072 \r
1073                 uses ofHeader;\r
1074                 \r
1075                 leaf role {\r
1076                     type oft:controller-role;\r
1077                 }\r
1078                 leaf generation-id {\r
1079                     type uint64;\r
1080                 }\r
1081             } \r
1082             /* Asynchronous message configuration. */\r
1083             grouping get-async-request {\r
1084                 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"\r
1085                 /* Controller/switch message */\r
1086 \r
1087                 uses ofHeader;                \r
1088             } \r
1089             grouping get-async-reply {\r
1090                 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"\r
1091                 /* Controller/switch message */\r
1092 \r
1093                 uses ofHeader;\r
1094                 \r
1095                 list packet-in-mask {\r
1096                     leaf-list mask {\r
1097                         type oft:packet-in-reason;\r
1098                     }\r
1099                 }\r
1100                 list port-status-mask {\r
1101                     leaf-list mask {\r
1102                         type oft:port-reason;\r
1103                     }\r
1104                 }\r
1105                 list flow-removed-mask {\r
1106                     leaf-list mask {\r
1107                         type oft:flow-removed-reason;\r
1108                     }\r
1109                 }\r
1110             } \r
1111             grouping set-async {\r
1112                 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"\r
1113                 /* Controller/switch message */\r
1114                 \r
1115                 uses ofHeader;\r
1116                 \r
1117                 leaf-list packet-in-mask {\r
1118                     type oft:packet-in-reason;\r
1119                 }\r
1120                 leaf-list port-status-mask {\r
1121                     type oft:port-reason;\r
1122                 }\r
1123                 leaf-list flow-removed-mask {\r
1124                     type oft:flow-removed-reason;\r
1125                 }\r
1126             } \r
1127             /* Meters and rate limiters configuration messages. */\r
1128             grouping meter-mod {\r
1129                 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"\r
1130                 /* Controller/switch message */\r
1131 \r
1132                 uses ofHeader;\r
1133                 \r
1134                 leaf command {\r
1135                     type oft:meter-mod-command;\r
1136                 } \r
1137                 leaf flags {\r
1138                     type oft:meter-flags;\r
1139                 }            \r
1140                 leaf meter-id {\r
1141                     type oft:meter-id;\r
1142                 }   \r
1143                 list bands {\r
1144                     uses meter-band-header;\r
1145                 }\r
1146             } \r
1147             \r
1148             grouping meter-band-header {\r
1149                 choice meter-band {\r
1150                     case meter-band-drop {\r
1151                         uses meter-band-commons;\r
1152                     }\r
1153                     case meter-band-dscp-remark {\r
1154                         uses meter-band-commons;\r
1155                         leaf prec-level {\r
1156                             type uint8;\r
1157                         }\r
1158                     }\r
1159                     case meter-band-experimenter {\r
1160                         uses meter-band-commons;\r
1161                         leaf experimenter {\r
1162                             type uint32;\r
1163                         }\r
1164                     }\r
1165                 }\r
1166             }\r
1167             \r
1168             grouping meter-band-commons {\r
1169                 leaf type {\r
1170                     type oft:meter-band-type;\r
1171                 }\r
1172                 leaf rate {\r
1173                     type uint32;\r
1174                 }\r
1175                 leaf burst-size {\r
1176                     type uint32;\r
1177                 }\r
1178             }\r
1179 \r
1180             /* Immutable messages. */\r
1181             notification hello-message {\r
1182                 uses hello;\r
1183                 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
1184                 \r
1185                 /* Symmetric message */\r
1186             }\r
1187             notification error-message {\r
1188                 uses error;\r
1189                 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"\r
1190                 \r
1191                 /* Symmetric message */\r
1192             }\r
1193             notification echo-request-message {\r
1194                 uses echo-request;\r
1195                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1196                 \r
1197                 /* Symmetric message */\r
1198             }\r
1199             notification experimenter-message {\r
1200                 uses experimenter;\r
1201                 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"\r
1202                 // TODO:: does switch send this when understood experimenter msg from lib?\r
1203                 /* Symmetric message */\r
1204             }\r
1205     // # Notification and RPCs\r
1206         /* Symmetric RPC. */\r
1207             rpc echo {\r
1208                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1209                 input {\r
1210                     uses echo-request;\r
1211                 }\r
1212                 /* Controller/switch message */\r
1213                 output {\r
1214                     uses echo-reply;\r
1215                 }\r
1216             }\r
1217             \r
1218             rpc echo-reply {\r
1219                 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"\r
1220                 input {\r
1221                     uses echo-reply;\r
1222                 }\r
1223             }\r
1224             \r
1225             rpc hello {\r
1226                 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
1227                 input {\r
1228                     uses hello;\r
1229                 }\r
1230             }\r
1231             \r
1232             rpc experimenter {\r
1233                 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"\r
1234                 input {\r
1235                     uses experimenter;\r
1236                 }\r
1237             }\r
1238 \r
1239         /* Switch configuration messages. */\r
1240             rpc get-features {\r
1241                 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"\r
1242                 input {\r
1243                     uses features-request;\r
1244                 }\r
1245                 /* Controller/switch message */\r
1246                 output {\r
1247                     uses features-reply;\r
1248                 }\r
1249             }\r
1250             \r
1251             rpc get-config {\r
1252                 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1253                 input {\r
1254                     uses get-config-request;\r
1255                 }\r
1256                 output {\r
1257                     uses get-config-reply;\r
1258                 }\r
1259                 /* Controller/switch message */\r
1260             }\r
1261             \r
1262             rpc set-config {\r
1263                 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"\r
1264                 input {\r
1265                     uses set-config;\r
1266                 }   \r
1267                 /* Controller/switch message */\r
1268             }\r
1269         /* Asynchronous messages. */\r
1270             notification packet-in-message {\r
1271                 uses packet-in;\r
1272                 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"\r
1273                 \r
1274              /* Async message */\r
1275             }\r
1276             notification flow-removed-message {\r
1277                 uses flow-removed;\r
1278                 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"\r
1279                 \r
1280                 /* Async message */\r
1281             } \r
1282             notification port-status-message {\r
1283                 uses port-status;\r
1284                 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"\r
1285                 \r
1286             } /* Async message */\r
1287 \r
1288         /* Controller command messages. */\r
1289             rpc packet-out {\r
1290                 input {\r
1291                     uses packet-out;\r
1292                     // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"\r
1293                 }\r
1294                 /* Controller/switch message */\r
1295             } \r
1296             rpc flow-mod {\r
1297                 input {\r
1298                     uses flow-mod;\r
1299                     // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"\r
1300                 }\r
1301                 /* Controller/switch message */\r
1302             } \r
1303             rpc group-mod {\r
1304                 input {\r
1305                     uses group-mod;\r
1306                     // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"\r
1307                 }\r
1308                 /* Controller/switch message */\r
1309             } \r
1310             rpc port-mod {\r
1311                 input {\r
1312                     uses port-mod;\r
1313                     // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"\r
1314                 }\r
1315             } /* Controller/switch message */\r
1316             \r
1317             rpc table-mod {\r
1318                 input {\r
1319                     uses table-mod;\r
1320                     // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"\r
1321                 }\r
1322             } /* Controller/switch message */\r
1323 \r
1324         /* Multipart messages. */\r
1325 \r
1326             rpc multipart-request {\r
1327                 input {\r
1328                     uses multipart-request;\r
1329                 }\r
1330             }\r
1331 \r
1332              /* Controller/switch message */\r
1333             notification multipart-reply-message {\r
1334                 uses multipart-reply;\r
1335                 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"\r
1336                 // notification because of multiple following responses\r
1337             } /* Controller/switch message */\r
1338             \r
1339 \r
1340             /* Barrier messages. */\r
1341             rpc barrier {\r
1342                 input {\r
1343                     uses barrier-request;\r
1344                     // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"\r
1345                 }\r
1346                 output {\r
1347                     uses barrier-reply;\r
1348                     // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"\r
1349                 }\r
1350             }\r
1351         /* Queue Configuration messages. */\r
1352             rpc get-queue-config {\r
1353                 input {\r
1354                     uses queue-get-config-request;\r
1355                     // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"\r
1356                 }\r
1357                 output {\r
1358                     uses queue-get-config-reply;\r
1359                     // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"\r
1360                 }\r
1361             } \r
1362 \r
1363         /* Controller role change request messages. */\r
1364             rpc role-request {\r
1365                 input {\r
1366                     uses role-request;\r
1367                     // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"\r
1368                 }\r
1369                 output {\r
1370                     uses role-reply;\r
1371                     // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"\r
1372                 }\r
1373             } /* Controller/switch message */\r
1374             \r
1375         /* Asynchronous message configuration. */\r
1376             rpc get-async {\r
1377                 input {\r
1378                     uses get-async-request;\r
1379                     // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"\r
1380                 }\r
1381                 output {\r
1382                     uses get-async-reply;\r
1383                     // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"\r
1384                 }\r
1385             } \r
1386              /* Controller/switch message */\r
1387             rpc set-async {\r
1388                 input { \r
1389                     uses set-async;\r
1390                 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"\r
1391                 }\r
1392                 \r
1393             } \r
1394         /* Meters and rate limiters configuration messages. */\r
1395             rpc meter-mod {\r
1396                 input {\r
1397                     uses meter-mod;\r
1398                     // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"\r
1399                 }\r
1400             } /* Controller/switch message */\r
1401 }