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