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