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