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