1 module openflow-protocol {
\r
2 namespace "urn:opendaylight:openflow:protocol";
\r
5 import ietf-inet-types {prefix inet;}
\r
6 import ietf-yang-types {prefix yang;}
\r
8 import openflow-types {prefix oft;}
\r
9 import openflow-extensible-match { prefix oxm;}
\r
10 import openflow-instruction { prefix ofinstruction;}
\r
11 import openflow-action {prefix ofaction;}
\r
13 revision "2013-07-31" {
\r
14 description "OpenFlow 1.3 - protocol objects model";
\r
17 // Generic Structures
\r
19 // reference "ofp_port";
\r
21 // reference "ofp_port.port_no";
\r
25 // reference "ofp_port.hw_addr";
\r
26 type yang:mac-address;
\r
29 // reference "ofp_port.name";
\r
33 // reference "ofp_port.config";
\r
34 type oft:port-config;
\r
37 // reference "ofp_port.state";
\r
38 type oft:port-state;
\r
40 leaf current-features {
\r
41 description "Current features.";
\r
42 // reference "ofp_port.curr";
\r
43 type oft:port-features;
\r
45 leaf advertised-features {
\r
46 description "Features being advertised by the port.";
\r
47 // reference "ofp_port.advertised";
\r
48 type oft:port-features;
\r
50 leaf supported-features {
\r
51 description "Features supported by the port.";
\r
52 // reference "ofp_port.supported";
\r
53 type oft:port-features;
\r
55 leaf peer-features {
\r
56 description "Features advertised by peer.";
\r
57 // reference "ofp_port.peer";
\r
58 type oft:port-features;
\r
61 description "Current port bitrate in kbps.";
\r
62 // reference "ofp_port.curr_speed";
\r
67 description "Max port bitrate in kbps";
\r
68 // reference "ofp_port.max_speed";
\r
75 // reference "ofp_port.config";
\r
76 type oft:port-config-v10;
\r
79 // reference "ofp_port.state";
\r
80 type oft:port-state-v10;
\r
82 leaf current-features-v10 {
\r
83 description "Current features.";
\r
84 // reference "ofp_port.curr";
\r
85 type oft:port-features-v10;
\r
87 leaf advertised-features-v10 {
\r
88 description "Features being advertised by the port.";
\r
89 // reference "ofp_port.advertised";
\r
90 type oft:port-features-v10;
\r
92 leaf supported-features-v10 {
\r
93 description "Features supported by the port.";
\r
94 // reference "ofp_port.supported";
\r
95 type oft:port-features-v10;
\r
97 leaf peer-features-v10 {
\r
98 description "Features advertised by peer.";
\r
99 // reference "ofp_port.peer";
\r
100 type oft:port-features-v10;
\r
104 grouping match-grouping {
\r
108 base oft:match-type-base;
\r
111 uses oxm:oxm-fields;
\r
116 list buckets-list {
\r
126 type oft:port-number;
\r
132 uses ofaction:actions;
\r
135 container table-features-properties-container {
\r
136 uses table-features-properties;
\r
139 grouping table-features-properties {
\r
140 list table-feature-properties {
\r
142 type oft:table-features-prop-type;
\r
147 // # MESSAGE Structures
\r
148 /* Immutable messages. */
\r
149 grouping ofHeader {
\r
150 //reference "ofpt_header struct in Openflow Switch 1.3 Spec"
\r
153 //reference "OpenFlow Header - OFP_VERSION";
\r
157 //reference "OpenFlow Header - transaction id";
\r
160 grouping ofHelloElementHeader {
\r
161 //reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec"
\r
163 type oft:hello-element-type;
\r
164 //reference "OpenFlow Header element type - OFPHET_*";
\r
168 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
169 /* Symmetric message */
\r
173 uses ofHelloElementHeader;
\r
175 leaf-list version-bitmap {
\r
181 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
182 /* Symmetric message */
\r
186 type oft:error-type;
\r
194 // OF1.0 structures
\r
196 type oft:error-type-v10;
\r
199 grouping echo-request {
\r
200 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
201 /* Symmetric message */
\r
208 grouping echo-reply {
\r
209 // reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
\r
210 /* Symmetric message */
\r
217 grouping experimenter {
\r
218 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
219 /* Symmetric message */
\r
222 leaf experimenter {
\r
232 /* Switch configuration messages. */
\r
233 grouping features-request {
\r
234 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
235 /* Controller/switch message */
\r
238 grouping features-reply {
\r
239 // reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
\r
240 /* Controller/switch message */
\r
255 leaf capabilities {
\r
256 type oft:capabilities;
\r
261 // OF1.0 structures
\r
262 leaf capabilities-v10 {
\r
263 type oft:capabilities-v10;
\r
266 type oft:action-type-v10;
\r
270 grouping get-config-request {
\r
271 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
272 /* Controller/switch message */
\r
275 grouping get-config-reply {
\r
276 // reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
277 /* Controller/switch message */
\r
281 type oft:switch-config-flag;
\r
283 leaf miss-send-len {
\r
287 grouping set-config {
\r
288 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
289 /* Controller/switch message */
\r
294 type oft:switch-config-flag;
\r
296 leaf miss-send-len {
\r
300 /* Asynchronous messages. */
\r
301 grouping packet-in {
\r
302 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
303 /* Async message */
\r
308 // ID assigned by datapath.
\r
312 // Full length of frame.
\r
316 // Reason packet is being sent (one of OFPR_*)
\r
320 // ID of the table that was looked up
\r
324 // Cookie of the flow entry that was looked up.
\r
327 uses match-grouping;
\r
329 // struct ofp_match match; /* Packet metadata. Variable size. */
\r
330 // /* The variable size and padded match is always followed by:
\r
331 // * - Exactly 2 all-zero padding bytes, then
\r
332 // * - An Ethernet frame whose length is inferred from header.length.
\r
333 // * The padding bytes preceding the Ethernet frame ensure that the IP
\r
334 // * header (if any) following the Ethernet header is 32-bit aligned.
\r
340 // OF1.0 structures
\r
345 grouping flow-removed {
\r
346 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
347 /* Async message */
\r
357 type oft:flow-removed-reason;
\r
362 leaf duration-sec {
\r
365 leaf duration-nsec {
\r
368 leaf idle-timeout {
\r
371 leaf hard-timeout {
\r
374 leaf packet-count {
\r
380 uses match-grouping;
\r
382 // OF1.0 structures
\r
383 uses oxm:match-v10-grouping;
\r
385 grouping port-status {
\r
386 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
393 type oft:port-reason;
\r
395 } /* Async message */
\r
396 /* Controller command messages. */
\r
397 grouping packet-out {
\r
398 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
399 /* Controller/switch message */
\r
403 uses ofaction:actions;
\r
412 type oft:port-number;
\r
415 grouping flow-mod {
\r
416 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
417 /* Controller/switch message */
\r
431 type oft:flow-mod-command;
\r
433 leaf idle-timeout {
\r
436 leaf hard-timeout {
\r
446 type oft:port-number;
\r
452 type oft:flow-mod-flags;
\r
454 uses match-grouping;
\r
456 uses ofinstruction:instructions;
\r
458 // OF1.0 structures
\r
460 type oft:flow-mod-flags-v10;
\r
462 uses oxm:match-v10-grouping;
\r
463 uses ofaction:actions;
\r
465 grouping group-mod {
\r
466 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
467 /* Controller/switch message */
\r
472 type oft:group-mod-command;
\r
475 type oft:group-type;
\r
484 grouping port-mod {
\r
485 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
486 /* Controller/switch message */
\r
491 type oft:port-number;
\r
494 type yang:mac-address;
\r
497 type oft:port-config;
\r
500 type oft:port-config;
\r
503 type oft:port-features;
\r
505 // OF1.0 structures
\r
507 type oft:port-config-v10;
\r
510 type oft:port-config-v10;
\r
512 leaf advertise-v10 {
\r
513 type oft:port-features-v10;
\r
516 grouping table-mod {
\r
517 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
518 /* Controller/switch message */
\r
526 type oft:port-config;
\r
530 /* Multipart messages. */
\r
531 grouping multipart-request {
\r
532 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
\r
533 /* Controller/switch message */
\r
538 type oft:multipart-type;
\r
541 type oft:multipart-request-flags;
\r
543 choice multipart-request-body {
\r
544 case multipart-request-desc {
\r
549 case multipart-request-flow {
\r
565 uses match-grouping;
\r
567 // OF1.0 structures
\r
568 uses oxm:match-v10-grouping;
\r
570 case multipart-request-aggregate {
\r
586 uses match-grouping;
\r
588 // OF1.0 structures
\r
589 uses oxm:match-v10-grouping;
\r
591 case multipart-request-port-stats {
\r
596 case multipart-request-queue {
\r
604 case multipart-request-group {
\r
609 case multipart-request-meter {
\r
614 case multipart-request-meter-config {
\r
619 case multipart-request-table-features {
\r
620 list table-features {
\r
627 leaf metadata-match {
\r
630 leaf metadata-write {
\r
634 type oft:table-config;
\r
639 uses table-features-properties;
\r
642 case multipart-request-experimenter {
\r
643 leaf experimenter {
\r
655 grouping multipart-reply {
\r
656 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
657 /* Controller/switch message */
\r
662 type oft:multipart-type;
\r
665 type oft:multipart-request-flags;
\r
667 choice multipart-reply-body {
\r
668 case multipart-reply-desc {
\r
685 case multipart-reply-flow {
\r
690 leaf duration-sec {
\r
693 leaf duration-nsec {
\r
699 leaf idle-timeout {
\r
702 leaf hard-timeout {
\r
706 type oft:flow-mod-flags;
\r
711 leaf packet-count {
\r
717 uses match-grouping;
\r
719 uses ofinstruction:instructions;
\r
721 // OF1.0 structures
\r
722 uses oxm:match-v10-grouping;
\r
723 uses ofaction:actions;
\r
726 case multipart-reply-aggregate {
\r
727 leaf packet-count {
\r
737 case multipart-reply-table {
\r
742 leaf active-count {
\r
745 leaf lookup-count {
\r
748 leaf matched-count {
\r
752 // OF1.0 structures
\r
758 case multipart-reply-port-stats {
\r
787 leaf rx-frame-err {
\r
799 leaf duration-sec {
\r
802 leaf duration-nsec {
\r
807 case multipart-reply-queue {
\r
824 leaf duration-sec {
\r
827 leaf duration-nsec {
\r
832 case multipart-reply-group {
\r
840 leaf packet-count {
\r
846 leaf duration-sec {
\r
849 leaf duration-nsec {
\r
852 list bucket-stats {
\r
853 leaf packet-count {
\r
862 case multipart-reply-group-desc {
\r
865 type oft:group-type;
\r
873 case multipart-reply-group-features {
\r
875 type oft:group-types;
\r
877 leaf capabilities {
\r
878 type oft:group-capabilities;
\r
880 leaf-list max_groups {
\r
883 leaf-list actions-bitmap {
\r
884 type oft:action-type;
\r
887 case multipart-reply-meter {
\r
895 leaf packet-in-count {
\r
898 leaf byte-in-count {
\r
901 leaf duration-sec {
\r
904 leaf duration-nsec {
\r
907 list meter-band-stats {
\r
908 leaf packet-band-count {
\r
911 leaf byte-band-count {
\r
917 case multipart-reply-meter-config {
\r
918 list meter-config {
\r
920 type oft:meter-mod-command;
\r
926 uses meter-band-header;
\r
930 case multipart-reply-meter-features {
\r
935 type oft:meter-band-type;
\r
937 leaf capabilities {
\r
938 type oft:meter-flags;
\r
947 case multipart-reply-table-features {
\r
948 list table-features {
\r
955 leaf metadata-match {
\r
958 leaf metadata-write {
\r
962 type oft:port-config;
\r
967 uses table-features-properties;
\r
970 case multipart-reply-port-desc {
\r
975 case multipart-reply-experimenter {
\r
976 leaf experimenter {
\r
988 /* Barrier messages. */
\r
989 grouping barrier-request {
\r
990 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
991 /* Controller/switch message */
\r
994 grouping barrier-reply {
\r
995 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
996 /* Controller/switch message */
\r
999 /* Queue Configuration messages. */
\r
1000 grouping queue-get-config-request {
\r
1001 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1002 /* Controller/switch message */
\r
1007 type oft:port-number;
\r
1010 grouping queue-get-config-reply {
\r
1011 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1012 /* Controller/switch message */
\r
1017 type oft:port-number;
\r
1020 uses packet-queue;
\r
1023 grouping packet-queue {
\r
1025 type oft:queue-id;
\r
1028 type oft:port-number;
\r
1030 uses queue-property-header;
\r
1032 container queue-prop-container {
\r
1033 uses queue-property-header;
\r
1035 grouping queue-property-header {
\r
1036 list queue-property {
\r
1038 type oft:queue-properties;
\r
1042 /* Controller role change request messages. */
\r
1043 grouping role-request {
\r
1044 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1045 /* Controller/switch message */
\r
1050 type oft:controller-role;
\r
1052 leaf generation-id {
\r
1056 grouping role-reply {
\r
1057 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1058 /* Controller/switch message */
\r
1063 type oft:controller-role;
\r
1065 leaf generation-id {
\r
1069 /* Asynchronous message configuration. */
\r
1070 grouping get-async-request {
\r
1071 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1072 /* Controller/switch message */
\r
1076 grouping get-async-reply {
\r
1077 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1078 /* Controller/switch message */
\r
1082 list packet-in-mask {
\r
1084 type oft:packet-in-reason;
\r
1087 list port-status-mask {
\r
1089 type oft:port-reason;
\r
1092 list flow-removed-mask {
\r
1094 type oft:flow-removed-reason;
\r
1098 grouping set-async {
\r
1099 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1100 /* Controller/switch message */
\r
1104 leaf-list packet-in-mask {
\r
1105 type oft:packet-in-reason;
\r
1107 leaf-list port-status-mask {
\r
1108 type oft:port-reason;
\r
1110 leaf-list flow-removed-mask {
\r
1111 type oft:flow-removed-reason;
\r
1114 /* Meters and rate limiters configuration messages. */
\r
1115 grouping meter-mod {
\r
1116 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1117 /* Controller/switch message */
\r
1122 type oft:meter-mod-command;
\r
1125 type oft:meter-flags;
\r
1128 type oft:meter-id;
\r
1131 uses meter-band-header;
\r
1135 grouping meter-band-header {
\r
1136 choice meter-band {
\r
1137 case meter-band-drop {
\r
1138 uses meter-band-commons;
\r
1140 case meter-band-dscp-remark {
\r
1141 uses meter-band-commons;
\r
1146 case meter-band-experimenter {
\r
1147 uses meter-band-commons;
\r
1148 leaf experimenter {
\r
1155 grouping meter-band-commons {
\r
1157 type oft:meter-band-type;
\r
1167 /* Immutable messages. */
\r
1168 notification hello-message {
\r
1170 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1172 /* Symmetric message */
\r
1174 notification error-message {
\r
1176 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
1178 /* Symmetric message */
\r
1180 notification echo-request-message {
\r
1181 uses echo-request;
\r
1182 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1184 /* Symmetric message */
\r
1186 notification experimenter-message {
\r
1187 uses experimenter;
\r
1188 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1189 // TODO:: does switch send this when understood experimenter msg from lib?
\r
1190 /* Symmetric message */
\r
1192 // # Notification and RPCs
\r
1193 /* Symmetric RPC. */
\r
1195 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1197 uses echo-request;
\r
1199 /* Controller/switch message */
\r
1206 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1213 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1219 rpc experimenter {
\r
1220 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1222 uses experimenter;
\r
1226 /* Switch configuration messages. */
\r
1227 rpc get-features {
\r
1228 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
1230 uses features-request;
\r
1232 /* Controller/switch message */
\r
1234 uses features-reply;
\r
1239 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1241 uses get-config-request;
\r
1244 uses get-config-reply;
\r
1246 /* Controller/switch message */
\r
1250 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
1254 /* Controller/switch message */
\r
1256 /* Asynchronous messages. */
\r
1257 notification packet-in-message {
\r
1259 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
1261 /* Async message */
\r
1263 notification flow-removed-message {
\r
1264 uses flow-removed;
\r
1265 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
1267 /* Async message */
\r
1269 notification port-status-message {
\r
1271 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
1273 } /* Async message */
\r
1275 /* Controller command messages. */
\r
1279 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
1281 /* Controller/switch message */
\r
1286 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
1288 /* Controller/switch message */
\r
1293 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
1295 /* Controller/switch message */
\r
1300 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
1302 } /* Controller/switch message */
\r
1307 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
1309 } /* Controller/switch message */
\r
1311 /* Multipart messages. */
\r
1312 //FIXME: Arent this wire protocol specific?
\r
1314 rpc send-multipart-request-message {
\r
1316 uses multipart-request;
\r
1320 notification multipart-request-message {
\r
1321 uses multipart-request;
\r
1322 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
\r
1323 // TODO: This should probably be deprecated as I think it should have been an rpc - eaw@cisco.com
\r
1325 } /* Controller/switch message */
\r
1326 notification multipart-reply-message {
\r
1327 uses multipart-reply;
\r
1328 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
1330 } /* Controller/switch message */
\r
1333 /* Barrier messages. */
\r
1336 uses barrier-request;
\r
1337 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1340 uses barrier-reply;
\r
1341 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1344 /* Queue Configuration messages. */
\r
1345 rpc get-queue-config {
\r
1347 uses queue-get-config-request;
\r
1348 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1351 uses queue-get-config-reply;
\r
1352 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1356 /* Controller role change request messages. */
\r
1357 rpc role-request {
\r
1359 uses role-request;
\r
1360 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1364 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1366 } /* Controller/switch message */
\r
1368 /* Asynchronous message configuration. */
\r
1371 uses get-async-request;
\r
1372 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1375 uses get-async-reply;
\r
1376 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1379 /* Controller/switch message */
\r
1383 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1387 /* Meters and rate limiters configuration messages. */
\r
1391 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1393 } /* Controller/switch message */
\r