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