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
317 type oft:packet-in-reason;
\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:table-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
547 case multipart-request-flow {
\r
563 uses match-grouping;
\r
565 // OF1.0 structures
\r
566 uses oxm:match-v10-grouping;
\r
568 case multipart-request-aggregate {
\r
584 uses match-grouping;
\r
586 // OF1.0 structures
\r
587 uses oxm:match-v10-grouping;
\r
589 case multipart-request-table {
\r
592 case multipart-request-port-stats {
\r
597 case multipart-request-queue {
\r
605 case multipart-request-group {
\r
610 case multipart-request-group-desc {
\r
613 case multipart-request-group-features {
\r
616 case multipart-request-meter {
\r
621 case multipart-request-meter-config {
\r
626 case multipart-request-meter-features {
\r
629 case multipart-request-table-features {
\r
630 list table-features {
\r
637 leaf metadata-match {
\r
640 leaf metadata-write {
\r
644 type oft:table-config;
\r
649 uses table-features-properties;
\r
652 case multipart-request-port-desc {
\r
655 case multipart-request-experimenter {
\r
656 leaf experimenter {
\r
668 grouping multipart-reply {
\r
669 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
670 /* Controller/switch message */
\r
675 type oft:multipart-type;
\r
678 type oft:multipart-request-flags;
\r
680 choice multipart-reply-body {
\r
681 case multipart-reply-desc {
\r
698 case multipart-reply-flow {
\r
703 leaf duration-sec {
\r
706 leaf duration-nsec {
\r
712 leaf idle-timeout {
\r
715 leaf hard-timeout {
\r
719 type oft:flow-mod-flags;
\r
724 leaf packet-count {
\r
730 uses match-grouping;
\r
732 uses ofinstruction:instructions;
\r
734 // OF1.0 structures
\r
735 uses oxm:match-v10-grouping;
\r
736 uses ofaction:actions;
\r
739 case multipart-reply-aggregate {
\r
740 leaf packet-count {
\r
750 case multipart-reply-table {
\r
755 leaf active-count {
\r
758 leaf lookup-count {
\r
761 leaf matched-count {
\r
765 // OF1.0 structures
\r
771 case multipart-reply-port-stats {
\r
800 leaf rx-frame-err {
\r
812 leaf duration-sec {
\r
815 leaf duration-nsec {
\r
820 case multipart-reply-queue {
\r
837 leaf duration-sec {
\r
840 leaf duration-nsec {
\r
845 case multipart-reply-group {
\r
853 leaf packet-count {
\r
859 leaf duration-sec {
\r
862 leaf duration-nsec {
\r
865 list bucket-stats {
\r
866 leaf packet-count {
\r
875 case multipart-reply-group-desc {
\r
878 type oft:group-type;
\r
886 case multipart-reply-group-features {
\r
888 type oft:group-types;
\r
890 leaf capabilities {
\r
891 type oft:group-capabilities;
\r
893 leaf-list max_groups {
\r
896 leaf-list actions-bitmap {
\r
897 type oft:action-type;
\r
900 case multipart-reply-meter {
\r
908 leaf packet-in-count {
\r
911 leaf byte-in-count {
\r
914 leaf duration-sec {
\r
917 leaf duration-nsec {
\r
920 list meter-band-stats {
\r
921 leaf packet-band-count {
\r
924 leaf byte-band-count {
\r
930 case multipart-reply-meter-config {
\r
931 list meter-config {
\r
933 type oft:meter-flags;
\r
939 uses meter-band-header;
\r
943 case multipart-reply-meter-features {
\r
948 type oft:meter-band-type-bitmap;
\r
950 leaf capabilities {
\r
951 type oft:meter-flags;
\r
960 case multipart-reply-table-features {
\r
961 list table-features {
\r
968 leaf metadata-match {
\r
971 leaf metadata-write {
\r
975 type oft:port-config;
\r
980 uses table-features-properties;
\r
983 case multipart-reply-port-desc {
\r
988 case multipart-reply-experimenter {
\r
989 leaf experimenter {
\r
1001 /* Barrier messages. */
\r
1002 grouping barrier-request {
\r
1003 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1004 /* Controller/switch message */
\r
1007 grouping barrier-reply {
\r
1008 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1009 /* Controller/switch message */
\r
1012 /* Queue Configuration messages. */
\r
1013 grouping queue-get-config-request {
\r
1014 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1015 /* Controller/switch message */
\r
1020 type oft:port-number;
\r
1023 grouping queue-get-config-reply {
\r
1024 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1025 /* Controller/switch message */
\r
1030 type oft:port-number;
\r
1033 uses packet-queue;
\r
1036 grouping packet-queue {
\r
1038 type oft:queue-id;
\r
1041 type oft:port-number;
\r
1043 uses queue-property-header;
\r
1045 container queue-prop-container {
\r
1046 uses queue-property-header;
\r
1048 grouping queue-property-header {
\r
1049 list queue-property {
\r
1051 type oft:queue-properties;
\r
1055 /* Controller role change request messages. */
\r
1056 grouping role-request {
\r
1057 // reference "OFPT_ROLE_REQUEST 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 grouping role-reply {
\r
1070 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1071 /* Controller/switch message */
\r
1076 type oft:controller-role;
\r
1078 leaf generation-id {
\r
1082 /* Asynchronous message configuration. */
\r
1083 grouping get-async-request {
\r
1084 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1085 /* Controller/switch message */
\r
1089 grouping get-async-reply {
\r
1090 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1091 /* Controller/switch message */
\r
1094 uses async-body-grouping;
\r
1096 grouping set-async {
\r
1097 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1098 /* Controller/switch message */
\r
1101 uses async-body-grouping;
\r
1104 grouping async-body-grouping {
\r
1105 list packet-in-mask {
\r
1107 type oft:packet-in-reason;
\r
1110 list port-status-mask {
\r
1112 type oft:port-reason;
\r
1115 list flow-removed-mask {
\r
1117 type oft:flow-removed-reason;
\r
1121 /* Meters and rate limiters configuration messages. */
\r
1122 grouping meter-mod {
\r
1123 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1124 /* Controller/switch message */
\r
1129 type oft:meter-mod-command;
\r
1132 type oft:meter-flags;
\r
1135 type oft:meter-id;
\r
1138 uses meter-band-header;
\r
1142 grouping meter-band-header {
\r
1143 choice meter-band {
\r
1144 case meter-band-drop {
\r
1145 uses meter-band-commons;
\r
1147 case meter-band-dscp-remark {
\r
1148 uses meter-band-commons;
\r
1153 case meter-band-experimenter {
\r
1154 uses meter-band-commons;
\r
1155 leaf experimenter {
\r
1162 grouping meter-band-commons {
\r
1164 type oft:meter-band-type;
\r
1174 /* Immutable messages. */
\r
1175 notification hello-message {
\r
1177 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1179 /* Symmetric message */
\r
1181 notification error-message {
\r
1183 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
1185 /* Symmetric message */
\r
1187 notification echo-request-message {
\r
1188 uses echo-request;
\r
1189 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1191 /* Symmetric message */
\r
1193 notification experimenter-message {
\r
1194 uses experimenter;
\r
1195 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1196 // TODO:: does switch send this when understood experimenter msg from lib?
\r
1197 /* Symmetric message */
\r
1199 // # Notification and RPCs
\r
1200 /* Symmetric RPC. */
\r
1202 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1204 uses echo-request;
\r
1206 /* Controller/switch message */
\r
1213 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1220 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1226 rpc experimenter {
\r
1227 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1229 uses experimenter;
\r
1233 /* Switch configuration messages. */
\r
1234 rpc get-features {
\r
1235 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
1237 uses features-request;
\r
1239 /* Controller/switch message */
\r
1241 uses features-reply;
\r
1246 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1248 uses get-config-request;
\r
1251 uses get-config-reply;
\r
1253 /* Controller/switch message */
\r
1257 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
1261 /* Controller/switch message */
\r
1263 /* Asynchronous messages. */
\r
1264 notification packet-in-message {
\r
1266 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
1268 /* Async message */
\r
1270 notification flow-removed-message {
\r
1271 uses flow-removed;
\r
1272 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
1274 /* Async message */
\r
1276 notification port-status-message {
\r
1278 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
1280 } /* Async message */
\r
1282 /* Controller command messages. */
\r
1286 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
1288 /* Controller/switch message */
\r
1293 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
1295 /* Controller/switch message */
\r
1300 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
1302 /* Controller/switch message */
\r
1307 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
1309 } /* Controller/switch message */
\r
1314 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
1316 } /* Controller/switch message */
\r
1318 /* Multipart messages. */
\r
1320 rpc multipart-request {
\r
1322 uses multipart-request;
\r
1326 /* Controller/switch message */
\r
1327 notification multipart-reply-message {
\r
1328 uses multipart-reply;
\r
1329 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
1330 // notification because of multiple following responses
\r
1331 } /* Controller/switch message */
\r
1334 /* Barrier messages. */
\r
1337 uses barrier-request;
\r
1338 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1341 uses barrier-reply;
\r
1342 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1345 /* Queue Configuration messages. */
\r
1346 rpc get-queue-config {
\r
1348 uses queue-get-config-request;
\r
1349 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1352 uses queue-get-config-reply;
\r
1353 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1357 /* Controller role change request messages. */
\r
1358 rpc role-request {
\r
1360 uses role-request;
\r
1361 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1365 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1367 } /* Controller/switch message */
\r
1369 /* Asynchronous message configuration. */
\r
1372 uses get-async-request;
\r
1373 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1376 uses get-async-reply;
\r
1377 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1380 /* Controller/switch message */
\r
1384 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1388 /* Meters and rate limiters configuration messages. */
\r
1392 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1394 } /* Controller/switch message */
\r