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
201 grouping echo-request {
\r
202 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
203 /* Symmetric message */
\r
210 grouping echo-reply {
\r
211 // reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
\r
212 /* Symmetric message */
\r
219 grouping experimenter {
\r
220 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
221 /* Symmetric message */
\r
224 leaf experimenter {
\r
234 /* Switch configuration messages. */
\r
235 grouping features-request {
\r
236 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
237 /* Controller/switch message */
\r
240 grouping features-reply {
\r
241 // reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
\r
242 /* Controller/switch message */
\r
257 leaf capabilities {
\r
258 type oft:capabilities;
\r
263 // OF1.0 structures
\r
264 leaf capabilities-v10 {
\r
265 type oft:capabilities-v10;
\r
268 type oft:action-type-v10;
\r
272 grouping get-config-request {
\r
273 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
274 /* Controller/switch message */
\r
277 grouping get-config-reply {
\r
278 // reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
279 /* Controller/switch message */
\r
283 type oft:switch-config-flag;
\r
285 leaf miss-send-len {
\r
289 grouping set-config {
\r
290 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
291 /* Controller/switch message */
\r
296 type oft:switch-config-flag;
\r
298 leaf miss-send-len {
\r
302 /* Asynchronous messages. */
\r
303 grouping packet-in {
\r
304 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
305 /* Async message */
\r
310 // ID assigned by datapath.
\r
314 // Full length of frame.
\r
318 // Reason packet is being sent (one of OFPR_*)
\r
319 type oft:packet-in-reason;
\r
322 // ID of the table that was looked up
\r
326 // Cookie of the flow entry that was looked up.
\r
329 uses match-grouping;
\r
331 // struct ofp_match match; /* Packet metadata. Variable size. */
\r
332 // /* The variable size and padded match is always followed by:
\r
333 // * - Exactly 2 all-zero padding bytes, then
\r
334 // * - An Ethernet frame whose length is inferred from header.length.
\r
335 // * The padding bytes preceding the Ethernet frame ensure that the IP
\r
336 // * header (if any) following the Ethernet header is 32-bit aligned.
\r
342 // OF1.0 structures
\r
347 grouping flow-removed {
\r
348 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
349 /* Async message */
\r
359 type oft:flow-removed-reason;
\r
364 leaf duration-sec {
\r
367 leaf duration-nsec {
\r
370 leaf idle-timeout {
\r
373 leaf hard-timeout {
\r
376 leaf packet-count {
\r
382 uses match-grouping;
\r
384 // OF1.0 structures
\r
385 uses oxm:match-v10-grouping;
\r
387 grouping port-status {
\r
388 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
395 type oft:port-reason;
\r
397 } /* Async message */
\r
398 /* Controller command messages. */
\r
399 grouping packet-out {
\r
400 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
401 /* Controller/switch message */
\r
405 uses ofaction:actions;
\r
414 type oft:port-number;
\r
417 grouping flow-mod {
\r
418 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
419 /* Controller/switch message */
\r
433 type oft:flow-mod-command;
\r
435 leaf idle-timeout {
\r
438 leaf hard-timeout {
\r
448 type oft:port-number;
\r
454 type oft:flow-mod-flags;
\r
456 uses match-grouping;
\r
458 uses ofinstruction:instructions;
\r
460 // OF1.0 structures
\r
462 type oft:flow-mod-flags-v10;
\r
464 uses oxm:match-v10-grouping;
\r
465 uses ofaction:actions;
\r
467 grouping group-mod {
\r
468 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
469 /* Controller/switch message */
\r
474 type oft:group-mod-command;
\r
477 type oft:group-type;
\r
486 grouping port-mod {
\r
487 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
488 /* Controller/switch message */
\r
493 type oft:port-number;
\r
496 type yang:mac-address;
\r
499 type oft:port-config;
\r
502 type oft:port-config;
\r
505 type oft:port-features;
\r
507 // OF1.0 structures
\r
509 type oft:port-config-v10;
\r
512 type oft:port-config-v10;
\r
514 leaf advertise-v10 {
\r
515 type oft:port-features-v10;
\r
518 grouping table-mod {
\r
519 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
520 /* Controller/switch message */
\r
528 type oft:table-config;
\r
532 /* Multipart messages. */
\r
533 grouping multipart-request {
\r
534 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
\r
535 /* Controller/switch message */
\r
540 type oft:multipart-type;
\r
543 type oft:multipart-request-flags;
\r
545 choice multipart-request-body {
\r
546 case multipart-request-desc {
\r
551 case multipart-request-flow {
\r
567 uses match-grouping;
\r
569 // OF1.0 structures
\r
570 uses oxm:match-v10-grouping;
\r
572 case multipart-request-aggregate {
\r
588 uses match-grouping;
\r
590 // OF1.0 structures
\r
591 uses oxm:match-v10-grouping;
\r
593 case multipart-request-table {
\r
598 case multipart-request-port-stats {
\r
603 case multipart-request-queue {
\r
611 case multipart-request-group {
\r
616 case multipart-request-group-desc {
\r
621 case multipart-request-group-features {
\r
626 case multipart-request-meter {
\r
631 case multipart-request-meter-config {
\r
636 case multipart-request-meter-features {
\r
641 case multipart-request-table-features {
\r
642 list table-features {
\r
649 leaf metadata-match {
\r
652 leaf metadata-write {
\r
656 type oft:table-config;
\r
661 uses table-features-properties;
\r
664 case multipart-request-port-desc {
\r
669 case multipart-request-experimenter {
\r
670 leaf experimenter {
\r
682 grouping multipart-reply {
\r
683 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
684 /* Controller/switch message */
\r
689 type oft:multipart-type;
\r
692 type oft:multipart-request-flags;
\r
694 choice multipart-reply-body {
\r
695 case multipart-reply-desc {
\r
712 case multipart-reply-flow {
\r
717 leaf duration-sec {
\r
720 leaf duration-nsec {
\r
726 leaf idle-timeout {
\r
729 leaf hard-timeout {
\r
733 type oft:flow-mod-flags;
\r
738 leaf packet-count {
\r
744 uses match-grouping;
\r
746 uses ofinstruction:instructions;
\r
748 // OF1.0 structures
\r
749 uses oxm:match-v10-grouping;
\r
750 uses ofaction:actions;
\r
753 case multipart-reply-aggregate {
\r
754 leaf packet-count {
\r
764 case multipart-reply-table {
\r
769 leaf active-count {
\r
772 leaf lookup-count {
\r
775 leaf matched-count {
\r
779 // OF1.0 structures
\r
785 case multipart-reply-port-stats {
\r
814 leaf rx-frame-err {
\r
826 leaf duration-sec {
\r
829 leaf duration-nsec {
\r
834 case multipart-reply-queue {
\r
851 leaf duration-sec {
\r
854 leaf duration-nsec {
\r
859 case multipart-reply-group {
\r
867 leaf packet-count {
\r
873 leaf duration-sec {
\r
876 leaf duration-nsec {
\r
879 list bucket-stats {
\r
880 leaf packet-count {
\r
889 case multipart-reply-group-desc {
\r
892 type oft:group-type;
\r
900 case multipart-reply-group-features {
\r
902 type oft:group-types;
\r
904 leaf capabilities {
\r
905 type oft:group-capabilities;
\r
907 leaf-list max_groups {
\r
910 leaf-list actions-bitmap {
\r
911 type oft:action-type;
\r
914 case multipart-reply-meter {
\r
922 leaf packet-in-count {
\r
925 leaf byte-in-count {
\r
928 leaf duration-sec {
\r
931 leaf duration-nsec {
\r
934 list meter-band-stats {
\r
935 leaf packet-band-count {
\r
938 leaf byte-band-count {
\r
944 case multipart-reply-meter-config {
\r
945 list meter-config {
\r
947 type oft:meter-flags;
\r
953 uses meter-band-header;
\r
957 case multipart-reply-meter-features {
\r
962 type oft:meter-band-type-bitmap;
\r
964 leaf capabilities {
\r
965 type oft:meter-flags;
\r
974 case multipart-reply-table-features {
\r
975 list table-features {
\r
982 leaf metadata-match {
\r
985 leaf metadata-write {
\r
989 type oft:table-config;
\r
994 uses table-features-properties;
\r
997 case multipart-reply-port-desc {
\r
1002 case multipart-reply-experimenter {
\r
1003 leaf experimenter {
\r
1015 /* Barrier messages. */
\r
1016 grouping barrier-request {
\r
1017 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1018 /* Controller/switch message */
\r
1021 grouping barrier-reply {
\r
1022 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1023 /* Controller/switch message */
\r
1026 /* Queue Configuration messages. */
\r
1027 grouping queue-get-config-request {
\r
1028 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1029 /* Controller/switch message */
\r
1034 type oft:port-number;
\r
1037 grouping queue-get-config-reply {
\r
1038 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1039 /* Controller/switch message */
\r
1044 type oft:port-number;
\r
1047 uses packet-queue;
\r
1050 grouping packet-queue {
\r
1052 type oft:queue-id;
\r
1055 type oft:port-number;
\r
1057 uses queue-property-header;
\r
1059 container queue-prop-container {
\r
1060 uses queue-property-header;
\r
1062 grouping queue-property-header {
\r
1063 list queue-property {
\r
1065 type oft:queue-properties;
\r
1069 /* Controller role change request messages. */
\r
1070 grouping role-request {
\r
1071 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1072 /* Controller/switch message */
\r
1077 type oft:controller-role;
\r
1079 leaf generation-id {
\r
1083 grouping role-reply {
\r
1084 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1085 /* Controller/switch message */
\r
1090 type oft:controller-role;
\r
1092 leaf generation-id {
\r
1096 /* Asynchronous message configuration. */
\r
1097 grouping get-async-request {
\r
1098 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1099 /* Controller/switch message */
\r
1103 grouping get-async-reply {
\r
1104 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1105 /* Controller/switch message */
\r
1108 uses async-body-grouping;
\r
1110 grouping set-async {
\r
1111 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1112 /* Controller/switch message */
\r
1115 uses async-body-grouping;
\r
1118 grouping async-body-grouping {
\r
1119 list packet-in-mask {
\r
1121 type oft:packet-in-reason;
\r
1124 list port-status-mask {
\r
1126 type oft:port-reason;
\r
1129 list flow-removed-mask {
\r
1131 type oft:flow-removed-reason;
\r
1135 /* Meters and rate limiters configuration messages. */
\r
1136 grouping meter-mod {
\r
1137 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1138 /* Controller/switch message */
\r
1143 type oft:meter-mod-command;
\r
1146 type oft:meter-flags;
\r
1149 type oft:meter-id;
\r
1152 uses meter-band-header;
\r
1156 grouping meter-band-header {
\r
1157 choice meter-band {
\r
1158 case meter-band-drop {
\r
1159 uses meter-band-commons;
\r
1161 case meter-band-dscp-remark {
\r
1162 uses meter-band-commons;
\r
1167 case meter-band-experimenter {
\r
1168 uses meter-band-commons;
\r
1169 leaf experimenter {
\r
1176 grouping meter-band-commons {
\r
1178 type oft:meter-band-type;
\r
1188 /* Immutable messages. */
\r
1189 notification hello-message {
\r
1191 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1193 /* Symmetric message */
\r
1195 notification error-message {
\r
1197 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
1199 /* Symmetric message */
\r
1201 notification echo-request-message {
\r
1202 uses echo-request;
\r
1203 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1205 /* Symmetric message */
\r
1207 notification experimenter-message {
\r
1208 uses experimenter;
\r
1209 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1210 // TODO:: does switch send this when understood experimenter msg from lib?
\r
1211 /* Symmetric message */
\r
1213 // # Notification and RPCs
\r
1214 /* Symmetric RPC. */
\r
1216 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1218 uses echo-request;
\r
1220 /* Controller/switch message */
\r
1227 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1234 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1240 rpc experimenter {
\r
1241 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1243 uses experimenter;
\r
1247 /* Switch configuration messages. */
\r
1248 rpc get-features {
\r
1249 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
1251 uses features-request;
\r
1253 /* Controller/switch message */
\r
1255 uses features-reply;
\r
1260 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1262 uses get-config-request;
\r
1265 uses get-config-reply;
\r
1267 /* Controller/switch message */
\r
1271 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
1275 /* Controller/switch message */
\r
1277 /* Asynchronous messages. */
\r
1278 notification packet-in-message {
\r
1280 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
1282 /* Async message */
\r
1284 notification flow-removed-message {
\r
1285 uses flow-removed;
\r
1286 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
1288 /* Async message */
\r
1290 notification port-status-message {
\r
1292 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
1294 } /* Async message */
\r
1296 /* Controller command messages. */
\r
1300 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
1302 /* Controller/switch message */
\r
1307 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
1309 /* Controller/switch message */
\r
1314 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
1316 /* Controller/switch message */
\r
1321 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
1323 } /* Controller/switch message */
\r
1328 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
1330 } /* Controller/switch message */
\r
1332 /* Multipart messages. */
\r
1334 rpc multipart-request {
\r
1336 uses multipart-request;
\r
1340 /* Controller/switch message */
\r
1341 notification multipart-reply-message {
\r
1342 uses multipart-reply;
\r
1343 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
1344 // notification because of multiple following responses
\r
1345 } /* Controller/switch message */
\r
1348 /* Barrier messages. */
\r
1351 uses barrier-request;
\r
1352 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1355 uses barrier-reply;
\r
1356 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1359 /* Queue Configuration messages. */
\r
1360 rpc get-queue-config {
\r
1362 uses queue-get-config-request;
\r
1363 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1366 uses queue-get-config-reply;
\r
1367 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1371 /* Controller role change request messages. */
\r
1372 rpc role-request {
\r
1374 uses role-request;
\r
1375 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1379 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1381 } /* Controller/switch message */
\r
1383 /* Asynchronous message configuration. */
\r
1386 uses get-async-request;
\r
1387 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1390 uses get-async-reply;
\r
1391 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1394 /* Controller/switch message */
\r
1398 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1402 /* Meters and rate limiters configuration messages. */
\r
1406 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1408 } /* Controller/switch message */
\r