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