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