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 {
172 reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
173 /* Symmetric message */
192 grouping echo-request {
193 reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
194 /* Symmetric message */
201 grouping echo-reply {
202 reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec";
203 /* Symmetric message */
211 grouping experimenter-core {
212 description "General experimenter message content suitable for symmetric and multipart message";
214 type oft:experimenter-id;
219 choice experimenter-data-of-choice {
220 // to be augmented by vendors
223 grouping experimenter-of-message {
224 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
225 /* Symmetric message */
227 uses experimenter-core;
230 /* Switch configuration messages. */
231 grouping features-request {
232 reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";
233 /* Controller/switch message */
236 grouping features-reply {
237 reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";
238 /* Controller/switch message */
254 type oft:capabilities;
260 leaf capabilities-v10 {
261 type oft:capabilities-v10;
264 type oft:action-type-v10;
270 grouping get-config-request {
271 reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
272 /* Controller/switch message */
275 grouping get-config-reply {
276 reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
277 /* Controller/switch message */
281 type oft:switch-config-flag;
287 grouping set-config {
288 reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";
289 /* Controller/switch message */
294 type oft:switch-config-flag;
300 /* Asynchronous messages. */
302 reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";
308 // ID assigned by datapath.
312 // Full length of frame.
316 // Reason packet is being sent (one of OFPR_*)
317 type oft:packet-in-reason;
320 // ID of the table that was looked up
324 // Cookie of the flow entry that was looked up.
327 uses oxm:match-grouping;
338 grouping flow-removed {
339 reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";
350 type oft:flow-removed-reason;
373 uses oxm:match-grouping;
376 uses oxm:match-v10-grouping;
378 grouping port-status {
379 reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";
386 type oft:port-reason;
389 /* Controller command messages. */
390 grouping packet-out {
391 reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";
392 /* Controller/switch message */
396 uses ofaction:actions-grouping;
404 type oft:port-number;
408 reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";
409 /* Controller/switch message */
423 type oft:flow-mod-command;
438 type oft:port-number;
444 type oft:flow-mod-flags;
446 uses oxm:match-grouping;
448 uses ofinstruction:instructions-grouping;
452 type oft:flow-mod-flags-v10;
454 uses oxm:match-v10-grouping;
455 uses ofaction:actions-grouping;
458 reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";
459 /* Controller/switch message */
464 type oft:group-mod-command;
473 uses buckets-grouping;
477 reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";
478 /* Controller/switch message */
483 type oft:port-number;
486 type yang:mac-address;
489 type oft:port-config;
492 type oft:port-config;
495 type oft:port-features;
499 type oft:port-config-v10;
502 type oft:port-config-v10;
505 type oft:port-features-v10;
509 reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";
510 /* Controller/switch message */
518 type oft:table-config;
522 /* Multipart messages. */
523 grouping multipart-request {
524 reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";
525 /* Controller/switch message */
530 type oft:multipart-type;
533 type oft:multipart-request-flags;
535 choice multipart-request-body {
536 case multipart-request-desc-case {
537 container multipart-request-desc {
543 case multipart-request-flow-case {
544 container multipart-request-flow {
560 uses oxm:match-grouping;
563 uses oxm:match-v10-grouping;
566 case multipart-request-aggregate-case {
567 container multipart-request-aggregate {
583 uses oxm:match-grouping;
586 uses oxm:match-v10-grouping;
589 case multipart-request-table-case {
590 container multipart-request-table {
596 case multipart-request-port-stats-case {
597 container multipart-request-port-stats {
603 case multipart-request-queue-case {
604 container multipart-request-queue {
613 case multipart-request-group-case {
614 container multipart-request-group {
620 case multipart-request-group-desc-case {
621 container multipart-request-group-desc {
627 case multipart-request-group-features-case {
628 container multipart-request-group-features {
634 case multipart-request-meter-case {
635 container multipart-request-meter {
641 case multipart-request-meter-config-case {
642 container multipart-request-meter-config {
648 case multipart-request-meter-features-case {
649 container multipart-request-meter-features {
655 case multipart-request-table-features-case {
656 container multipart-request-table-features {
657 list table-features {
664 leaf metadata-match {
667 leaf metadata-write {
671 type oft:table-config;
676 uses table-features-properties-grouping;
680 case multipart-request-port-desc-case {
681 container multipart-request-port-desc {
687 case multipart-request-experimenter-case {
688 container multipart-request-experimenter {
689 uses experimenter-core;
694 grouping multipart-reply {
695 reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";
696 /* Controller/switch message */
701 type oft:multipart-type;
704 type oft:multipart-request-flags;
706 choice multipart-reply-body {
707 case multipart-reply-desc-case {
708 container multipart-reply-desc {
726 case multipart-reply-flow-case {
727 container multipart-reply-flow {
748 type oft:flow-mod-flags;
759 uses oxm:match-grouping;
761 uses ofinstruction:instructions-grouping;
764 uses oxm:match-v10-grouping;
765 uses ofaction:actions-grouping;
769 case multipart-reply-aggregate-case {
770 container multipart-reply-aggregate {
782 case multipart-reply-table-case {
783 container multipart-reply-table {
803 type oft:flow-wildcards-v10;
817 case multipart-reply-port-stats-case {
818 container multipart-reply-port-stats {
868 case multipart-reply-queue-case {
869 container multipart-reply-queue {
895 case multipart-reply-group-case {
896 container multipart-reply-group {
927 case multipart-reply-group-desc-case {
928 container multipart-reply-group-desc {
936 uses buckets-grouping;
940 case multipart-reply-group-features-case {
941 container multipart-reply-group-features {
943 type oft:group-types;
946 type oft:group-capabilities;
948 leaf-list max_groups {
951 leaf-list actions-bitmap {
952 type oft:action-type;
956 case multipart-reply-meter-case {
957 container multipart-reply-meter {
965 leaf packet-in-count {
977 list meter-band-stats {
978 leaf packet-band-count {
981 leaf byte-band-count {
988 case multipart-reply-meter-config-case {
989 container multipart-reply-meter-config {
992 type oft:meter-flags;
998 uses meter-band-header;
1003 case multipart-reply-meter-features-case {
1004 container multipart-reply-meter-features {
1009 type oft:meter-band-type-bitmap;
1012 type oft:meter-flags;
1022 case multipart-reply-table-features-case {
1023 container multipart-reply-table-features {
1024 list table-features {
1031 leaf metadata-match {
1034 leaf metadata-write {
1038 type oft:table-config;
1043 uses table-features-properties-grouping;
1047 case multipart-reply-port-desc-case {
1048 container multipart-reply-port-desc {
1054 case multipart-reply-experimenter-case {
1055 container multipart-reply-experimenter {
1056 uses experimenter-core;
1061 /* Barrier messages. */
1062 grouping barrier-request {
1063 reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";
1064 /* Controller/switch message */
1067 grouping barrier-reply {
1068 reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";
1069 /* Controller/switch message */
1072 /* Queue Configuration messages. */
1073 grouping queue-get-config-request {
1074 reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
1075 /* Controller/switch message */
1080 type oft:port-number;
1083 grouping queue-get-config-reply {
1084 reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
1085 /* Controller/switch message */
1090 type oft:port-number;
1096 grouping packet-queue {
1101 type oft:port-number;
1103 uses queue-property-header;
1105 container queue-prop-container {
1106 uses queue-property-header;
1108 grouping queue-property-header {
1109 list queue-property {
1112 type oft:queue-properties;
1116 /* Controller role change request messages. */
1117 grouping role-request {
1118 reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";
1119 /* Controller/switch message */
1124 type oft:controller-role;
1126 leaf generation-id {
1130 grouping role-reply {
1131 reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";
1132 /* Controller/switch message */
1137 type oft:controller-role;
1139 leaf generation-id {
1143 /* Asynchronous message configuration. */
1144 grouping get-async-request {
1145 reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";
1146 /* Controller/switch message */
1150 grouping get-async-reply {
1151 reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";
1152 /* Controller/switch message */
1155 uses async-body-grouping;
1157 grouping set-async {
1158 reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";
1159 /* Controller/switch message */
1162 uses async-body-grouping;
1165 grouping async-body-grouping {
1166 list packet-in-mask {
1168 type oft:packet-in-reason;
1171 list port-status-mask {
1173 type oft:port-reason;
1176 list flow-removed-mask {
1178 type oft:flow-removed-reason;
1182 /* Meters and rate limiters configuration messages. */
1183 grouping meter-mod {
1184 reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";
1185 /* Controller/switch message */
1190 type oft:meter-mod-command;
1193 type oft:meter-flags;
1199 uses meter-band-header;
1203 container meter-band-container {
1204 uses meter-band-header;
1206 grouping meter-band-header {
1208 case meter-band-drop-case {
1209 container meter-band-drop {
1210 uses meter-band-commons;
1213 case meter-band-dscp-remark-case {
1214 container meter-band-dscp-remark {
1215 uses meter-band-commons;
1221 case meter-band-experimenter-case {
1222 container meter-band-experimenter {
1223 uses meter-band-commons;
1229 grouping meter-band-commons {
1231 type oft:meter-band-type;
1241 /* Immutable messages. */
1242 notification hello-message {
1244 reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
1246 /* Symmetric message */
1248 notification error-message {
1250 reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
1252 /* Symmetric message */
1254 notification echo-request-message {
1256 reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
1258 /* Symmetric message */
1260 notification experimenter-message {
1261 description "Experimenter request message from device.";
1262 uses experimenter-of-message;
1263 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
1264 // TODO:: does switch send this when understood experimenter msg from lib?
1265 /* Symmetric message */
1267 // # Notification and RPCs
1268 /* Symmetric RPC. */
1273 /* Controller/switch message */
1292 description "Send experimenter message to device, reply is not solicitated.";
1294 uses experimenter-of-message;
1298 /* Switch configuration messages. */
1301 uses features-request;
1303 /* Controller/switch message */
1305 uses features-reply;
1311 uses get-config-request;
1314 uses get-config-reply;
1316 /* Controller/switch message */
1323 /* Controller/switch message */
1325 /* Asynchronous messages. */
1326 notification packet-in-message {
1331 notification flow-removed-message {
1336 notification port-status-message {
1339 } /* Async message */
1341 /* Controller command messages. */
1346 /* Controller/switch message */
1352 /* Controller/switch message */
1358 /* Controller/switch message */
1364 } /* Controller/switch message */
1370 } /* Controller/switch message */
1372 /* Multipart messages. */
1374 rpc multipart-request {
1376 uses multipart-request;
1380 /* Controller/switch message */
1381 notification multipart-reply-message {
1382 uses multipart-reply;
1383 // notification because of multiple following responses
1384 } /* Controller/switch message */
1387 /* Barrier messages. */
1390 uses barrier-request;
1396 /* Queue Configuration messages. */
1397 rpc get-queue-config {
1399 uses queue-get-config-request;
1402 uses queue-get-config-reply;
1406 /* Controller role change request messages. */
1414 } /* Controller/switch message */
1416 /* Asynchronous message configuration. */
1419 uses get-async-request;
1422 uses get-async-reply;
1425 /* Controller/switch message */
1432 /* Meters and rate limiters configuration messages. */
1437 } /* Controller/switch message */