2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 module openflow-protocol {
10 namespace "urn:opendaylight:openflow:protocol";
13 import ietf-yang-types {prefix yang;}
15 import openflow-types {prefix oft;}
16 import openflow-extensible-match { prefix oxm;}
17 import openflow-instruction { prefix ofinstruction;}
18 import openflow-action {prefix ofaction;}
20 revision "2013-07-31" {
21 description "#NOT_PUBLISHED# OpenFlow 1.3 - protocol objects model";
25 grouping port-grouping {
31 type yang:mac-address;
37 description "Bitmap of OFPPC_* flags.";
41 description "Bitmap of OFPPS_* flags.";
44 leaf current-features {
45 description "Current features.";
46 type oft:port-features;
48 leaf advertised-features {
49 description "Features being advertised by the port.";
50 type oft:port-features;
52 leaf supported-features {
53 description "Features supported by the port.";
54 type oft:port-features;
57 description "Features advertised by peer.";
58 type oft:port-features;
61 description "Current port bitrate in kbps.";
66 description "Max port bitrate in kbps";
73 type oft:port-config-v10;
76 type oft:port-state-v10;
78 leaf current-features-v10 {
79 description "Current features.";
80 type oft:port-features-v10;
82 leaf advertised-features-v10 {
83 description "Features being advertised by the port.";
84 type oft:port-features-v10;
86 leaf supported-features-v10 {
87 description "Features supported by the port.";
88 type oft:port-features-v10;
90 leaf peer-features-v10 {
91 description "Features advertised by peer.";
92 type oft:port-features-v10;
96 grouping buckets-grouping {
102 grouping bucket-grouping {
103 description "Bucket for use in groups.";
105 description "Relative weight of bucket. Only
106 defined for select groups.";
110 description "Port whose state affects whether this
111 bucket is live. Only required for fast
113 type oft:port-number;
116 description "Group whose state affects whether this
117 bucket is live. Only required for fast
122 uses ofaction:actions-grouping;
125 container table-features-properties-container {
126 uses table-features-properties-grouping;
129 grouping table-features-properties-grouping {
130 list table-feature-properties {
133 type oft:table-features-prop-type;
138 // # MESSAGE Structures
139 /* Immutable messages. */
141 reference "ofp_header struct in Openflow Switch 1.3 Spec";
144 description "OpenFlow version";
148 description "Transaction ID";
151 grouping ofHelloElementHeader {
152 reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec";
154 type oft:hello-element-type;
155 //reference "OpenFlow Header element type - OFPHET_*";
159 reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
160 /* Symmetric message */
164 uses ofHelloElementHeader;
166 leaf-list version-bitmap {
173 reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
174 /* Symmetric message */
193 grouping echo-request {
194 reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
195 /* Symmetric message */
202 grouping echo-reply {
203 reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";
204 /* Symmetric message */
212 grouping experimenter-core {
213 description "General experimenter message content suitable for symmetric and multipart message";
215 type oft:experimenter-id;
220 choice experimenter-data-of-choice {
221 // to be augmented by vendors
224 grouping experimenter-of-message {
225 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
226 /* Symmetric message */
228 uses experimenter-core;
231 /* Switch configuration messages. */
232 grouping features-request {
233 reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";
234 /* Controller/switch message */
237 grouping features-reply {
238 reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";
239 /* Controller/switch message */
255 type oft:capabilities;
261 leaf capabilities-v10 {
262 type oft:capabilities-v10;
265 type oft:action-type-v10;
271 grouping get-config-request {
272 reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
273 /* Controller/switch message */
276 grouping get-config-reply {
277 reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
278 /* Controller/switch message */
282 type oft:switch-config-flag;
288 grouping set-config {
289 reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";
290 /* Controller/switch message */
295 type oft:switch-config-flag;
301 /* Asynchronous messages. */
303 reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";
309 // ID assigned by datapath.
313 // Full length of frame.
317 // Reason packet is being sent (one of OFPR_*)
318 type oft:packet-in-reason;
321 // ID of the table that was looked up
325 // Cookie of the flow entry that was looked up.
328 uses oxm:match-grouping;
339 grouping flow-removed {
340 reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";
351 type oft:flow-removed-reason;
374 uses oxm:match-grouping;
377 uses oxm:match-v10-grouping;
379 grouping port-status {
380 reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";
387 type oft:port-reason;
390 /* Controller command messages. */
391 grouping packet-out {
392 reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";
393 /* Controller/switch message */
397 uses ofaction:actions-grouping;
405 type oft:port-number;
409 reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";
410 /* Controller/switch message */
424 type oft:flow-mod-command;
439 type oft:port-number;
445 type oft:flow-mod-flags;
447 uses oxm:match-grouping;
449 uses ofinstruction:instructions-grouping;
453 type oft:flow-mod-flags-v10;
455 uses oxm:match-v10-grouping;
456 uses ofaction:actions-grouping;
459 reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";
460 /* Controller/switch message */
465 type oft:group-mod-command;
474 uses buckets-grouping;
478 reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";
479 /* Controller/switch message */
484 type oft:port-number;
487 type yang:mac-address;
490 type oft:port-config;
493 type oft:port-config;
496 type oft:port-features;
500 type oft:port-config-v10;
503 type oft:port-config-v10;
506 type oft:port-features-v10;
510 reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";
511 /* Controller/switch message */
519 type oft:table-config;
523 /* Multipart messages. */
524 grouping multipart-request {
525 reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";
526 /* Controller/switch message */
531 type oft:multipart-type;
534 type oft:multipart-request-flags;
536 choice multipart-request-body {
537 case multipart-request-desc-case {
538 container multipart-request-desc {
544 case multipart-request-flow-case {
545 container multipart-request-flow {
561 uses oxm:match-grouping;
564 uses oxm:match-v10-grouping;
567 case multipart-request-aggregate-case {
568 container multipart-request-aggregate {
584 uses oxm:match-grouping;
587 uses oxm:match-v10-grouping;
590 case multipart-request-table-case {
591 container multipart-request-table {
597 case multipart-request-port-stats-case {
598 container multipart-request-port-stats {
604 case multipart-request-queue-case {
605 container multipart-request-queue {
614 case multipart-request-group-case {
615 container multipart-request-group {
621 case multipart-request-group-desc-case {
622 container multipart-request-group-desc {
628 case multipart-request-group-features-case {
629 container multipart-request-group-features {
635 case multipart-request-meter-case {
636 container multipart-request-meter {
642 case multipart-request-meter-config-case {
643 container multipart-request-meter-config {
649 case multipart-request-meter-features-case {
650 container multipart-request-meter-features {
656 case multipart-request-table-features-case {
657 container multipart-request-table-features {
658 list table-features {
665 leaf metadata-match {
668 leaf metadata-write {
672 type oft:table-config;
677 uses table-features-properties-grouping;
681 case multipart-request-port-desc-case {
682 container multipart-request-port-desc {
688 case multipart-request-experimenter-case {
689 container multipart-request-experimenter {
690 uses experimenter-core;
695 grouping multipart-reply {
696 reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";
697 /* Controller/switch message */
702 type oft:multipart-type;
705 type oft:multipart-request-flags;
707 choice multipart-reply-body {
708 case multipart-reply-desc-case {
709 container multipart-reply-desc {
727 case multipart-reply-flow-case {
728 container multipart-reply-flow {
749 type oft:flow-mod-flags;
760 uses oxm:match-grouping;
762 uses ofinstruction:instructions-grouping;
765 uses oxm:match-v10-grouping;
766 uses ofaction:actions-grouping;
770 case multipart-reply-aggregate-case {
771 container multipart-reply-aggregate {
783 case multipart-reply-table-case {
784 container multipart-reply-table {
804 type oft:flow-wildcards-v10;
818 case multipart-reply-port-stats-case {
819 container multipart-reply-port-stats {
869 case multipart-reply-queue-case {
870 container multipart-reply-queue {
896 case multipart-reply-group-case {
897 container multipart-reply-group {
928 case multipart-reply-group-desc-case {
929 container multipart-reply-group-desc {
937 uses buckets-grouping;
941 case multipart-reply-group-features-case {
942 container multipart-reply-group-features {
944 type oft:group-types;
947 type oft:group-capabilities;
949 leaf-list max_groups {
952 // FIXME: min-elements = max-elements = 4
954 leaf-list actions-bitmap {
955 type oft:action-type;
957 // FIXME: min-elements = max-elements = 4
961 case multipart-reply-meter-case {
962 container multipart-reply-meter {
970 leaf packet-in-count {
982 list meter-band-stats {
983 leaf packet-band-count {
986 leaf byte-band-count {
993 case multipart-reply-meter-config-case {
994 container multipart-reply-meter-config {
997 type oft:meter-flags;
1003 uses meter-band-header;
1008 case multipart-reply-meter-features-case {
1009 container multipart-reply-meter-features {
1014 type oft:meter-band-type-bitmap;
1017 type oft:meter-flags;
1027 case multipart-reply-table-features-case {
1028 container multipart-reply-table-features {
1029 list table-features {
1036 leaf metadata-match {
1039 leaf metadata-write {
1043 type oft:table-config;
1048 uses table-features-properties-grouping;
1052 case multipart-reply-port-desc-case {
1053 container multipart-reply-port-desc {
1059 case multipart-reply-experimenter-case {
1060 container multipart-reply-experimenter {
1061 uses experimenter-core;
1066 /* Barrier messages. */
1067 grouping barrier-request {
1068 reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";
1069 /* Controller/switch message */
1072 grouping barrier-reply {
1073 reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";
1074 /* Controller/switch message */
1077 /* Queue Configuration messages. */
1078 grouping queue-get-config-request {
1079 reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
1080 /* Controller/switch message */
1085 type oft:port-number;
1088 grouping queue-get-config-reply {
1089 reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
1090 /* Controller/switch message */
1095 type oft:port-number;
1101 grouping packet-queue {
1106 type oft:port-number;
1108 uses queue-property-header;
1110 container queue-prop-container {
1111 uses queue-property-header;
1113 grouping queue-property-header {
1114 list queue-property {
1117 type oft:queue-properties;
1121 /* Controller role change request messages. */
1122 grouping role-request {
1123 reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";
1124 /* Controller/switch message */
1129 type oft:controller-role;
1131 leaf generation-id {
1135 grouping role-reply {
1136 reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";
1137 /* Controller/switch message */
1142 type oft:controller-role;
1144 leaf generation-id {
1148 /* Asynchronous message configuration. */
1149 grouping get-async-request {
1150 reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";
1151 /* Controller/switch message */
1155 grouping get-async-reply {
1156 reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";
1157 /* Controller/switch message */
1160 uses async-body-grouping;
1162 grouping set-async {
1163 reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";
1164 /* Controller/switch message */
1167 uses async-body-grouping;
1170 grouping async-body-grouping {
1171 list packet-in-mask {
1173 type oft:packet-in-reason;
1176 list port-status-mask {
1178 type oft:port-reason;
1181 list flow-removed-mask {
1183 type oft:flow-removed-reason;
1187 /* Meters and rate limiters configuration messages. */
1188 grouping meter-mod {
1189 reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";
1190 /* Controller/switch message */
1195 type oft:meter-mod-command;
1198 type oft:meter-flags;
1204 uses meter-band-header;
1208 container meter-band-container {
1209 uses meter-band-header;
1211 grouping meter-band-header {
1213 case meter-band-drop-case {
1214 container meter-band-drop {
1215 uses meter-band-commons;
1218 case meter-band-dscp-remark-case {
1219 container meter-band-dscp-remark {
1220 uses meter-band-commons;
1226 case meter-band-experimenter-case {
1227 container meter-band-experimenter {
1228 uses meter-band-commons;
1234 grouping meter-band-commons {
1236 type oft:meter-band-type;
1246 /* Immutable messages. */
1247 notification hello-message {
1249 reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
1251 /* Symmetric message */
1253 notification error-message {
1255 reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
1257 /* Symmetric message */
1259 notification echo-request-message {
1261 reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
1263 /* Symmetric message */
1265 notification experimenter-message {
1266 description "Experimenter request message from device.";
1267 uses experimenter-of-message;
1268 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
1269 // TODO:: does switch send this when understood experimenter msg from lib?
1270 /* Symmetric message */
1272 // # Notification and RPCs
1273 /* Symmetric RPC. */
1278 /* Controller/switch message */
1297 description "Send experimenter message to device, reply is not solicitated.";
1299 uses experimenter-of-message;
1303 /* Switch configuration messages. */
1306 uses features-request;
1308 /* Controller/switch message */
1310 uses features-reply;
1316 uses get-config-request;
1319 uses get-config-reply;
1321 /* Controller/switch message */
1328 /* Controller/switch message */
1330 /* Asynchronous messages. */
1331 notification packet-in-message {
1336 notification flow-removed-message {
1341 notification port-status-message {
1344 } /* Async message */
1346 /* Controller command messages. */
1351 /* Controller/switch message */
1357 /* Controller/switch message */
1363 /* Controller/switch message */
1369 } /* Controller/switch message */
1375 } /* Controller/switch message */
1377 /* Multipart messages. */
1379 rpc multipart-request {
1381 uses multipart-request;
1385 /* Controller/switch message */
1386 notification multipart-reply-message {
1387 uses multipart-reply;
1388 // notification because of multiple following responses
1389 } /* Controller/switch message */
1392 /* Barrier messages. */
1395 uses barrier-request;
1401 /* Queue Configuration messages. */
1402 rpc get-queue-config {
1404 uses queue-get-config-request;
1407 uses queue-get-config-reply;
1411 /* Controller role change request messages. */
1419 } /* Controller/switch message */
1421 /* Asynchronous message configuration. */
1424 uses get-async-request;
1427 uses get-async-reply;
1430 /* Controller/switch message */
1437 /* Meters and rate limiters configuration messages. */
1442 } /* Controller/switch message */