1 module openflow-protocol {
\r
2 namespace "urn:opendaylight:openflow:protocol";
\r
6 import ietf-inet-types {prefix inet;}
\r
7 import ietf-yang-types {prefix yang;}
\r
9 import openflow-types {prefix oft;}
\r
10 import openflow-extensible-match { prefix oxm;}
\r
11 import openflow-instruction { prefix ofinstruction;}
\r
12 import openflow-action {prefix ofaction;}
\r
16 revision "2013-07-31" {
\r
17 description "Initial model";
\r
20 // Generic Structures
\r
23 // reference "ofp_port";
\r
25 // reference "ofp_port.port_no";
\r
29 // reference "ofp_port.hw_addr";
\r
30 type yang:mac-address;
\r
33 // reference "ofp_port.name";
\r
37 // reference "ofp_port.config";
\r
38 type oft:port-config;
\r
41 // reference "ofp_port.state";
\r
42 type oft:port-state;
\r
44 leaf current-features {
\r
45 description "Current features.";
\r
46 // reference "ofp_port.curr";
\r
47 type oft:port-features;
\r
49 leaf advertised-features {
\r
50 description "Features being advertised by the port.";
\r
51 // reference "ofp_port.advertised";
\r
52 type oft:port-features;
\r
54 leaf supported-features {
\r
55 description "Features supported by the port.";
\r
56 // reference "ofp_port.supported";
\r
57 type oft:port-features;
\r
59 leaf peer-features {
\r
60 description "Features advertised by peer.";
\r
61 // reference "ofp_port.peer";
\r
62 type oft:port-features;
\r
65 description "Current port bitrate in kbps.";
\r
66 // reference "ofp_port.curr_speed";
\r
71 description "Max port bitrate in kbps";
\r
72 // reference "ofp_port.max_speed";
\r
81 base oft:match-type-base;
\r
84 uses oxm:oxm-fields;
\r
89 // TODO: ofp_packat_queue
\r
91 // # MESSAGE Structures
\r
92 /* Immutable messages. */
\r
94 //reference "ofpt_header struct in Openflow Switch 1.3 Spec"
\r
97 //reference "OpenFlow Header - OFP_VERSION";
\r
101 //reference "OpenFlow Header - transaction id";
\r
104 grouping ofHelloElementHeader {
\r
105 //reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec"
\r
107 type oft:hello-element-type;
\r
108 //reference "OpenFlow Header element type - OFPHET_*";
\r
112 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
113 /* Symmetric message */
\r
117 uses ofHelloElementHeader;
\r
119 leaf-list version-bitmap {
\r
129 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
130 /* Symmetric message */
\r
134 type oft:error-type;
\r
143 grouping echo-request {
\r
144 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
145 /* Symmetric message */
\r
152 grouping echo-reply {
\r
153 // reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
\r
154 /* Symmetric message */
\r
161 grouping experimenter {
\r
162 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
163 /* Symmetric message */
\r
166 leaf experimenter {
\r
176 /* Switch configuration messages. */
\r
177 grouping features-request {
\r
178 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
179 /* Controller/switch message */
\r
182 grouping features-reply {
\r
183 // reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
\r
184 /* Controller/switch message */
\r
199 leaf capabilities {
\r
206 grouping get-config-request {
\r
207 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
208 /* Controller/switch message */
\r
211 grouping get-config-reply {
\r
212 // reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
213 /* Controller/switch message */
\r
217 type oft:switch-config-flag;
\r
219 leaf miss-send-len {
\r
223 grouping set-config {
\r
224 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
225 /* Controller/switch message */
\r
230 type oft:switch-config-flag;
\r
232 leaf miss-send-len {
\r
236 /* Asynchronous messages. */
\r
237 grouping packet-in {
\r
238 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
239 /* Async message */
\r
244 // ID assigned by datapath.
\r
248 // Full length of frame.
\r
252 // Reason packet is being sent (one of OFPR_*)
\r
256 // ID of the table that was looked up
\r
260 // Cookie of the flow entry that was looked up.
\r
267 // struct ofp_match match; /* Packet metadata. Variable size. */
\r
268 // /* The variable size and padded match is always followed by:
\r
269 // * - Exactly 2 all-zero padding bytes, then
\r
270 // * - An Ethernet frame whose length is inferred from header.length.
\r
271 // * The padding bytes preceding the Ethernet frame ensure that the IP
\r
272 // * header (if any) following the Ethernet header is 32-bit aligned.
\r
279 grouping flow-removed {
\r
280 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
281 /* Async message */
\r
291 type oft:flow-removed-reason;
\r
296 leaf duration-sec {
\r
299 leaf duration-nsec {
\r
302 leaf idle-timeout {
\r
305 leaf hard-timeout {
\r
308 leaf packet-count {
\r
318 grouping port-status {
\r
319 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
326 type oft:port-reason;
\r
328 } /* Async message */
\r
329 /* Controller command messages. */
\r
330 grouping packet-out {
\r
331 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
332 /* Controller/switch message */
\r
337 uses ofaction:action-header;
\r
348 type oft:port-number;
\r
351 grouping flow-mod {
\r
352 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
353 /* Controller/switch message */
\r
367 type oft:flow-mod-command;
\r
369 leaf idle-timeout {
\r
372 leaf hard-timeout {
\r
382 type oft:port-number;
\r
388 type oft:flow-mod-flags;
\r
394 grouping group-mod {
\r
395 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
396 /* Controller/switch message */
\r
401 type oft:group-mod-command;
\r
404 type oft:group-type;
\r
419 type oft:port-number;
\r
426 uses ofaction:action-header;
\r
429 grouping port-mod {
\r
430 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
431 /* Controller/switch message */
\r
436 type oft:port-number;
\r
439 type yang:mac-address;
\r
442 type oft:port-config;
\r
445 type oft:port-config;
\r
448 type oft:port-features;
\r
451 grouping table-mod {
\r
452 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
453 /* Controller/switch message */
\r
461 type oft:port-config;
\r
465 /* Multipart messages. */
\r
466 grouping multipart-request {
\r
467 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
\r
468 /* Controller/switch message */
\r
473 type oft:multipart-type;
\r
476 type oft:multipart-request-flags;
\r
478 choice multipart-request-body {
\r
479 case multipart-request-flow {
\r
499 case multipart-request-aggregate {
\r
519 case multipart-request-port-stats {
\r
524 case multipart-request-queue {
\r
532 case multipart-request-group {
\r
537 case multipart-request-meter {
\r
542 case multipart-request-meter-config {
\r
547 case multipart-request-table-features {
\r
548 list table_features {
\r
555 leaf metadata-match {
\r
558 leaf metadata-write {
\r
562 type oft:table-config;
\r
569 case multipart-request-experimenter {
\r
570 leaf experimenter {
\r
579 grouping multipart-reply {
\r
580 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
581 /* Controller/switch message */
\r
586 type oft:multipart-type;
\r
589 type oft:multipart-request-flags;
\r
591 choice multipart-reply-body {
\r
592 case multipart-reply-desc {
\r
609 case multipart-reply-flow {
\r
614 leaf duration-sec {
\r
617 leaf duration-nsec {
\r
623 leaf idle-timeout {
\r
626 leaf hard-timeout {
\r
635 leaf packet-count {
\r
646 case multipart-reply-aggregate {
\r
647 leaf packet-count {
\r
657 case multipart-reply-table {
\r
662 leaf active-count {
\r
665 leaf lookup-count {
\r
668 leaf matched-count {
\r
673 case multipart-reply-port-stats {
\r
702 leaf rx-frame-err {
\r
714 leaf duration-sec {
\r
717 leaf duration-nsec {
\r
722 case multipart-reply-queue {
\r
739 leaf duration-sec {
\r
742 leaf duration-nsec {
\r
747 case multipart-reply-group {
\r
755 leaf packet-count {
\r
761 leaf duration-sec {
\r
764 leaf duration-nsec {
\r
767 list bucket-stats {
\r
768 leaf packet-count {
\r
777 case multipart-reply-group-desc {
\r
790 case multipart-reply-group-features {
\r
792 type oft:group-types;
\r
794 leaf capabilities {
\r
795 type oft:group-capabilities;
\r
797 leaf-list max_groups {
\r
800 //leaf-list actions {
\r
801 // type ofaction:action-type;
\r
804 uses ofaction:action-header;
\r
807 case multipart-reply-meter {
\r
815 leaf packet-in-count {
\r
818 leaf byte-in-count {
\r
821 leaf duration-sec {
\r
824 leaf duration-nsec {
\r
827 list meter-band-stats {
\r
828 leaf packet-band-count {
\r
831 leaf byte-band-count {
\r
837 case multipart-reply-meter-config {
\r
838 list meter-config {
\r
840 type oft:meter-mod-command;
\r
846 uses meter-band-header;
\r
850 case multipart-reply-meter-features {
\r
855 type oft:meter-band-type;
\r
857 leaf capabilities {
\r
858 type oft:meter-flags;
\r
867 case multipart-reply-table-features {
\r
868 list table-features {
\r
875 leaf metadata-match {
\r
878 leaf metadata-write {
\r
882 type oft:port-config;
\r
889 case multipart-reply-port-desc {
\r
894 case multipart-reply-experimenter {
\r
895 leaf experimenter {
\r
904 /* Barrier messages. */
\r
905 grouping barrier-request {
\r
906 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
907 /* Controller/switch message */
\r
910 grouping barrier-reply {
\r
911 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
912 /* Controller/switch message */
\r
915 /* Queue Configuration messages. */
\r
916 grouping queue-get-config-request {
\r
917 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
918 /* Controller/switch message */
\r
923 type oft:port-number;
\r
926 grouping queue-get-config-reply {
\r
927 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
928 /* Controller/switch message */
\r
933 type oft:port-number;
\r
939 grouping packet-queue {
\r
944 type oft:port-number;
\r
947 uses queue-property-header;
\r
950 grouping queue-property-header {
\r
952 type oft:queue-property;
\r
955 /* Controller role change request messages. */
\r
956 grouping role-request {
\r
957 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
958 /* Controller/switch message */
\r
963 type oft:controller-role;
\r
965 leaf generation-id {
\r
969 grouping role-reply {
\r
970 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
971 /* Controller/switch message */
\r
976 type oft:controller-role;
\r
978 leaf generation-id {
\r
982 /* Asynchronous message configuration. */
\r
983 grouping get-async-request {
\r
984 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
985 /* Controller/switch message */
\r
989 grouping get-async-reply {
\r
990 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
991 /* Controller/switch message */
\r
995 list packet-in-mask {
\r
997 type oft:packet-in-reason;
\r
1000 list port-status-mask {
\r
1002 type oft:port-reason;
\r
1005 list flow-removed-mask {
\r
1007 type oft:flow-removed-reason;
\r
1011 grouping set-async {
\r
1012 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1013 /* Controller/switch message */
\r
1017 leaf-list packet-in-mask {
\r
1018 type oft:packet-in-reason;
\r
1020 leaf-list port-status-mask {
\r
1021 type oft:port-reason;
\r
1023 leaf-list flow-removed-mask {
\r
1024 type oft:flow-removed-reason;
\r
1027 /* Meters and rate limiters configuration messages. */
\r
1028 grouping meter-mod {
\r
1029 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1030 /* Controller/switch message */
\r
1035 type oft:meter-mod-command;
\r
1038 type oft:meter-flags;
\r
1041 type oft:meter-id;
\r
1044 uses meter-band-header;
\r
1048 grouping meter-band-header {
\r
1049 choice meter-band {
\r
1050 case meter-band-drop {
\r
1051 uses meter-band-commons;
\r
1053 case meter-band-dscp-remark {
\r
1054 uses meter-band-commons;
\r
1059 case meter-band-experimenter {
\r
1060 uses meter-band-commons;
\r
1061 leaf experimenter {
\r
1068 grouping meter-band-commons {
\r
1070 type oft:meter-band-type;
\r
1081 /* Immutable messages. */
\r
1082 notification hello-message {
\r
1084 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1086 /* Symmetric message */
\r
1088 notification error-message {
\r
1090 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
\r
1092 /* Symmetric message */
\r
1094 notification echo-request-message {
\r
1095 uses echo-request;
\r
1096 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1098 /* Symmetric message */
\r
1100 notification experimenter-message {
\r
1101 uses experimenter;
\r
1102 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1103 // TODO:: does switch send this when understood experimenter msg from lib?
\r
1104 /* Symmetric message */
\r
1106 // # Notification and RPCs
\r
1107 /* Symmetric RPC. */
\r
1109 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1111 uses echo-request;
\r
1113 /* Controller/switch message */
\r
1120 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
\r
1127 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
\r
1133 rpc experimenter {
\r
1134 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
\r
1136 uses experimenter;
\r
1140 /* Switch configuration messages. */
\r
1141 rpc get-features {
\r
1142 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
\r
1144 uses features-request;
\r
1146 /* Controller/switch message */
\r
1148 uses features-reply;
\r
1153 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1155 uses get-config-request;
\r
1158 uses get-config-reply;
\r
1160 /* Controller/switch message */
\r
1164 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
\r
1168 /* Controller/switch message */
\r
1170 /* Asynchronous messages. */
\r
1171 notification packet-in-message {
\r
1173 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
\r
1175 /* Async message */
\r
1177 notification flow-removed-message {
\r
1178 uses flow-removed;
\r
1179 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
\r
1181 /* Async message */
\r
1183 notification port-status-message {
\r
1185 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
\r
1187 } /* Async message */
\r
1189 /* Controller command messages. */
\r
1193 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
\r
1195 /* Controller/switch message */
\r
1200 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
\r
1202 /* Controller/switch message */
\r
1207 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
\r
1209 /* Controller/switch message */
\r
1214 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
\r
1216 } /* Controller/switch message */
\r
1221 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
\r
1223 } /* Controller/switch message */
\r
1225 /* Multipart messages. */
\r
1226 //FIXME: Arent this wire protocol specific?
\r
1228 notification multipart-request-message {
\r
1229 uses multipart-request;
\r
1230 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
\r
1232 } /* Controller/switch message */
\r
1233 notification multipart-reply-message {
\r
1234 uses multipart-reply;
\r
1235 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
\r
1237 } /* Controller/switch message */
\r
1240 /* Barrier messages. */
\r
1243 uses barrier-request;
\r
1244 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
\r
1247 uses barrier-reply;
\r
1248 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
\r
1251 /* Queue Configuration messages. */
\r
1252 rpc get-queue-config {
\r
1254 uses queue-get-config-request;
\r
1255 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
\r
1258 uses queue-get-config-reply;
\r
1259 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
\r
1263 /* Controller role change request messages. */
\r
1264 rpc role-request {
\r
1266 uses role-request;
\r
1267 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
\r
1271 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
\r
1273 } /* Controller/switch message */
\r
1275 /* Asynchronous message configuration. */
\r
1278 uses get-async-request;
\r
1279 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
\r
1282 uses get-async-reply;
\r
1283 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
\r
1286 /* Controller/switch message */
\r
1290 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
\r
1294 /* Meters and rate limiters configuration messages. */
\r
1298 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
\r
1300 } /* Controller/switch message */
\r