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 "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 */
210 grouping experimenter {
211 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
212 /* Symmetric message */
216 type oft:experimenter-id;
222 /* Switch configuration messages. */
223 grouping features-request {
224 reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec";
225 /* Controller/switch message */
228 grouping features-reply {
229 reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec";
230 /* Controller/switch message */
246 type oft:capabilities;
252 leaf capabilities-v10 {
253 type oft:capabilities-v10;
256 type oft:action-type-v10;
262 grouping get-config-request {
263 reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
264 /* Controller/switch message */
267 grouping get-config-reply {
268 reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
269 /* Controller/switch message */
273 type oft:switch-config-flag;
279 grouping set-config {
280 reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec";
281 /* Controller/switch message */
286 type oft:switch-config-flag;
292 /* Asynchronous messages. */
294 reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec";
300 // ID assigned by datapath.
304 // Full length of frame.
308 // Reason packet is being sent (one of OFPR_*)
309 type oft:packet-in-reason;
312 // ID of the table that was looked up
316 // Cookie of the flow entry that was looked up.
319 uses oxm:match-grouping;
330 grouping flow-removed {
331 reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec";
342 type oft:flow-removed-reason;
365 uses oxm:match-grouping;
368 uses oxm:match-v10-grouping;
370 grouping port-status {
371 reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec";
378 type oft:port-reason;
381 /* Controller command messages. */
382 grouping packet-out {
383 reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec";
384 /* Controller/switch message */
388 uses ofaction:actions-grouping;
396 type oft:port-number;
400 reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec";
401 /* Controller/switch message */
415 type oft:flow-mod-command;
430 type oft:port-number;
436 type oft:flow-mod-flags;
438 uses oxm:match-grouping;
440 uses ofinstruction:instructions-grouping;
444 type oft:flow-mod-flags-v10;
446 uses oxm:match-v10-grouping;
447 uses ofaction:actions-grouping;
450 reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec";
451 /* Controller/switch message */
456 type oft:group-mod-command;
465 uses buckets-grouping;
469 reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec";
470 /* Controller/switch message */
475 type oft:port-number;
478 type yang:mac-address;
481 type oft:port-config;
484 type oft:port-config;
487 type oft:port-features;
491 type oft:port-config-v10;
494 type oft:port-config-v10;
497 type oft:port-features-v10;
501 reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec";
502 /* Controller/switch message */
510 type oft:table-config;
514 /* Multipart messages. */
515 grouping multipart-request {
516 reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec";
517 /* Controller/switch message */
522 type oft:multipart-type;
525 type oft:multipart-request-flags;
527 choice multipart-request-body {
528 case multipart-request-desc-case {
529 container multipart-request-desc {
535 case multipart-request-flow-case {
536 container multipart-request-flow {
552 uses oxm:match-grouping;
555 uses oxm:match-v10-grouping;
558 case multipart-request-aggregate-case {
559 container multipart-request-aggregate {
575 uses oxm:match-grouping;
578 uses oxm:match-v10-grouping;
581 case multipart-request-table-case {
582 container multipart-request-table {
588 case multipart-request-port-stats-case {
589 container multipart-request-port-stats {
595 case multipart-request-queue-case {
596 container multipart-request-queue {
605 case multipart-request-group-case {
606 container multipart-request-group {
612 case multipart-request-group-desc-case {
613 container multipart-request-group-desc {
619 case multipart-request-group-features-case {
620 container multipart-request-group-features {
626 case multipart-request-meter-case {
627 container multipart-request-meter {
633 case multipart-request-meter-config-case {
634 container multipart-request-meter-config {
640 case multipart-request-meter-features-case {
641 container multipart-request-meter-features {
647 case multipart-request-table-features-case {
648 container multipart-request-table-features {
649 list table-features {
656 leaf metadata-match {
659 leaf metadata-write {
663 type oft:table-config;
668 uses table-features-properties-grouping;
672 case multipart-request-port-desc-case {
673 container multipart-request-port-desc {
679 case multipart-request-experimenter-case {
680 container multipart-request-experimenter {
681 // empty body - used for experimenter augmentation
686 grouping multipart-reply {
687 reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec";
688 /* Controller/switch message */
693 type oft:multipart-type;
696 type oft:multipart-request-flags;
698 choice multipart-reply-body {
699 case multipart-reply-desc-case {
700 container multipart-reply-desc {
718 case multipart-reply-flow-case {
719 container multipart-reply-flow {
740 type oft:flow-mod-flags;
751 uses oxm:match-grouping;
753 uses ofinstruction:instructions-grouping;
756 uses oxm:match-v10-grouping;
757 uses ofaction:actions-grouping;
761 case multipart-reply-aggregate-case {
762 container multipart-reply-aggregate {
774 case multipart-reply-table-case {
775 container multipart-reply-table {
795 type oft:flow-wildcards-v10;
809 case multipart-reply-port-stats-case {
810 container multipart-reply-port-stats {
860 case multipart-reply-queue-case {
861 container multipart-reply-queue {
887 case multipart-reply-group-case {
888 container multipart-reply-group {
919 case multipart-reply-group-desc-case {
920 container multipart-reply-group-desc {
928 uses buckets-grouping;
932 case multipart-reply-group-features-case {
933 container multipart-reply-group-features {
935 type oft:group-types;
938 type oft:group-capabilities;
940 leaf-list max_groups {
943 leaf-list actions-bitmap {
944 type oft:action-type;
948 case multipart-reply-meter-case {
949 container multipart-reply-meter {
957 leaf packet-in-count {
969 list meter-band-stats {
970 leaf packet-band-count {
973 leaf byte-band-count {
980 case multipart-reply-meter-config-case {
981 container multipart-reply-meter-config {
984 type oft:meter-flags;
990 uses meter-band-header;
995 case multipart-reply-meter-features-case {
996 container multipart-reply-meter-features {
1001 type oft:meter-band-type-bitmap;
1004 type oft:meter-flags;
1014 case multipart-reply-table-features-case {
1015 container multipart-reply-table-features {
1016 list table-features {
1023 leaf metadata-match {
1026 leaf metadata-write {
1030 type oft:table-config;
1035 uses table-features-properties-grouping;
1039 case multipart-reply-port-desc-case {
1040 container multipart-reply-port-desc {
1046 case multipart-reply-experimenter-case {
1047 container multipart-reply-experimenter {
1048 // empty body - used for experimenter augmentation
1053 /* Barrier messages. */
1054 grouping barrier-request {
1055 reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec";
1056 /* Controller/switch message */
1059 grouping barrier-reply {
1060 reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec";
1061 /* Controller/switch message */
1064 /* Queue Configuration messages. */
1065 grouping queue-get-config-request {
1066 reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec";
1067 /* Controller/switch message */
1072 type oft:port-number;
1075 grouping queue-get-config-reply {
1076 reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec";
1077 /* Controller/switch message */
1082 type oft:port-number;
1088 grouping packet-queue {
1093 type oft:port-number;
1095 uses queue-property-header;
1097 container queue-prop-container {
1098 uses queue-property-header;
1100 grouping queue-property-header {
1101 list queue-property {
1104 type oft:queue-properties;
1108 /* Controller role change request messages. */
1109 grouping role-request {
1110 reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec";
1111 /* Controller/switch message */
1116 type oft:controller-role;
1118 leaf generation-id {
1122 grouping role-reply {
1123 reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec";
1124 /* Controller/switch message */
1129 type oft:controller-role;
1131 leaf generation-id {
1135 /* Asynchronous message configuration. */
1136 grouping get-async-request {
1137 reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec";
1138 /* Controller/switch message */
1142 grouping get-async-reply {
1143 reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec";
1144 /* Controller/switch message */
1147 uses async-body-grouping;
1149 grouping set-async {
1150 reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec";
1151 /* Controller/switch message */
1154 uses async-body-grouping;
1157 grouping async-body-grouping {
1158 list packet-in-mask {
1160 type oft:packet-in-reason;
1163 list port-status-mask {
1165 type oft:port-reason;
1168 list flow-removed-mask {
1170 type oft:flow-removed-reason;
1174 /* Meters and rate limiters configuration messages. */
1175 grouping meter-mod {
1176 reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec";
1177 /* Controller/switch message */
1182 type oft:meter-mod-command;
1185 type oft:meter-flags;
1191 uses meter-band-header;
1195 container meter-band-container {
1196 uses meter-band-header;
1198 grouping meter-band-header {
1200 case meter-band-drop-case {
1201 container meter-band-drop {
1202 uses meter-band-commons;
1205 case meter-band-dscp-remark-case {
1206 container meter-band-dscp-remark {
1207 uses meter-band-commons;
1213 case meter-band-experimenter-case {
1214 container meter-band-experimenter {
1215 uses meter-band-commons;
1221 grouping meter-band-commons {
1223 type oft:meter-band-type;
1233 /* Immutable messages. */
1234 notification hello-message {
1236 reference "OFPT_HELLO message in Openflow Switch 1.3 Spec";
1238 /* Symmetric message */
1240 notification error-message {
1242 reference "OFPT_ERROR message in Openflow Switch 1.3 Spec";
1244 /* Symmetric message */
1246 notification echo-request-message {
1248 reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec";
1250 /* Symmetric message */
1252 notification experimenter-message {
1254 reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec";
1255 // TODO:: does switch send this when understood experimenter msg from lib?
1256 /* Symmetric message */
1258 // # Notification and RPCs
1259 /* Symmetric RPC. */
1264 /* Controller/switch message */
1288 /* Switch configuration messages. */
1291 uses features-request;
1293 /* Controller/switch message */
1295 uses features-reply;
1301 uses get-config-request;
1304 uses get-config-reply;
1306 /* Controller/switch message */
1313 /* Controller/switch message */
1315 /* Asynchronous messages. */
1316 notification packet-in-message {
1321 notification flow-removed-message {
1326 notification port-status-message {
1329 } /* Async message */
1331 /* Controller command messages. */
1336 /* Controller/switch message */
1342 /* Controller/switch message */
1348 /* Controller/switch message */
1354 } /* Controller/switch message */
1360 } /* Controller/switch message */
1362 /* Multipart messages. */
1364 rpc multipart-request {
1366 uses multipart-request;
1370 /* Controller/switch message */
1371 notification multipart-reply-message {
1372 uses multipart-reply;
1373 // notification because of multiple following responses
1374 } /* Controller/switch message */
1377 /* Barrier messages. */
1380 uses barrier-request;
1386 /* Queue Configuration messages. */
1387 rpc get-queue-config {
1389 uses queue-get-config-request;
1392 uses queue-get-config-reply;
1396 /* Controller role change request messages. */
1404 } /* Controller/switch message */
1406 /* Asynchronous message configuration. */
1409 uses get-async-request;
1412 uses get-async-reply;
1415 /* Controller/switch message */
1422 /* Meters and rate limiters configuration messages. */
1427 } /* Controller/switch message */