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