1 module openflow-protocol {
2 namespace "urn:opendaylight:openflow:protocol";
6 import ietf-inet-types {prefix inet;}
7 import ietf-yang-types {prefix yang;}
9 import openflow-types {prefix oft;}
10 import openflow-extensible-match { prefix oxm;}
11 import openflow-instruction { prefix ofinstruction;}
12 import openflow-action {prefix ofaction;}
16 revision "2013-07-31" {
17 description "Initial model";
23 // reference "ofp_port";
25 // reference "ofp_port.port_no";
29 // reference "ofp_port.hw_addr";
30 type yang:mac-address;
33 // reference "ofp_port.name";
37 // reference "ofp_port.config";
41 // reference "ofp_port.state";
44 leaf current-features {
45 description "Current features.";
46 // reference "ofp_port.curr";
47 type oft:port-features;
49 leaf advertised-features {
50 description "Features being advertised by the port.";
51 // reference "ofp_port.advertised";
52 type oft:port-features;
54 leaf supported-features {
55 description "Features supported by the port.";
56 // reference "ofp_port.supported";
57 type oft:port-features;
60 description "Features advertised by peer.";
61 // reference "ofp_port.peer";
62 type oft:port-features;
65 description "Current port bitrate in kbps.";
66 // reference "ofp_port.curr_speed";
71 description "Max port bitrate in kbps";
72 // reference "ofp_port.max_speed";
78 // TODO: ofp_packat_queue
80 // # MESSAGE Structures
81 /* Immutable messages. */
83 //reference "ofpt_header struct in Openflow Switch 1.3 Spec"
86 //reference "OpenFlow Header - OFP_VERSION";
90 //reference "OpenFlow Header - transaction id";
93 grouping ofHelloElementHeader {
94 //reference "ofpt_hello_elem_header struct in Openflow Switch 1.3 Spec"
96 type oft:hello-element-type;
97 //reference "OpenFlow Header element type - OFPHET_*";
101 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
102 /* Symmetric message */
106 uses ofHelloElementHeader;
114 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
115 /* Symmetric message */
128 grouping echo-request {
129 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
130 /* Symmetric message */
137 grouping echo-reply {
138 // reference "OFPT_ECHO_REPLY message in Openflow Switch 1.3 Spec"
139 /* Symmetric message */
146 grouping experimenter {
147 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
148 /* Symmetric message */
158 /* Switch configuration messages. */
159 grouping features-request {
160 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
161 /* Controller/switch message */
164 grouping features-reply {
165 // reference "OFPT_FEATURES_REPLY message in Openflow Switch 1.3 Spec"
166 /* Controller/switch message */
188 grouping get-config-request {
189 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
190 /* Controller/switch message */
193 grouping get-config-reply {
194 // reference "OFPT_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
195 /* Controller/switch message */
199 type oft:switch-config-flag;
205 grouping set-config {
206 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
207 /* Controller/switch message */
212 type oft:switch-config-flag;
218 /* Asynchronous messages. */
220 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
226 // ID assigned by datapath.
230 // Full length of frame.
234 // Reason packet is being sent (one of OFPR_*)
238 // ID of the table that was looked up
242 // Cookie of the flow entry that was looked up.
246 //TODO:: add match leaf
251 // struct ofp_match match; /* Packet metadata. Variable size. */
252 // /* The variable size and padded match is always followed by:
253 // * - Exactly 2 all-zero padding bytes, then
254 // * - An Ethernet frame whose length is inferred from header.length.
255 // * The padding bytes preceding the Ethernet frame ensure that the IP
256 // * header (if any) following the Ethernet header is 32-bit aligned.
263 grouping flow-removed {
264 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
275 type oft:flow-removed-reason;
298 //TODO:: add match leaf
303 grouping port-status {
304 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
311 type oft:port-reason;
313 } /* Async message */
314 /* Controller command messages. */
315 grouping packet-out {
316 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
317 /* Controller/switch message */
322 uses ofaction:action-header;
333 type oft:port-number;
337 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
338 /* Controller/switch message */
352 type oft:flow-mod-command;
367 type oft:port-number;
375 //TODO:: add match leaf
378 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
379 /* Controller/switch message */
384 type oft:group-mod-command;
402 type oft:port-number;
409 uses ofaction:action-header;
413 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
414 /* Controller/switch message */
419 type oft:port-number;
422 type yang:mac-address;
425 type oft:port-config;
428 type oft:port-config;
431 type oft:port-config;
435 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
436 /* Controller/switch message */
444 type oft:port-config;
448 /* Multipart messages. */
449 grouping multipart-request {
450 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
451 /* Controller/switch message */
456 type oft:multipart-type;
459 type oft:multipart-request-flags;
461 choice multipart-request-body {
462 case multipart-request-flow {
480 base oft:match-type-base;
484 case multipart-request-aggregate {
502 base oft:match-type-base;
506 case multipart-request-port-stats {
511 case multipart-request-queue {
519 case multipart-request-group {
524 case multipart-request-meter {
529 case multipart-request-meter-config {
534 case multipart-request-table-features {
535 list table_features {
542 leaf metadata-match {
545 leaf metadata-write {
549 type oft:table-config;
556 case multipart-request-experimenter {
566 grouping multipart-reply {
567 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
568 /* Controller/switch message */
573 type oft:multipart-type;
576 type oft:multipart-request-flags;
578 choice multipart-reply-body {
579 case multipart-reply-desc {
596 case multipart-reply-flow {
633 case multipart-reply-aggregate {
644 case multipart-reply-table {
660 case multipart-reply-port-stats {
709 case multipart-reply-queue {
734 case multipart-reply-group {
764 case multipart-reply-group-desc {
777 case multipart-reply-group-features {
779 type oft:group-types;
782 type oft:group-capabilities;
784 leaf-list max_groups {
788 type ofaction:action-type;
791 case multipart-reply-meter {
799 leaf packet-in-count {
811 list meter-band-stats {
812 leaf packet-band-count {
815 leaf byte-band-count {
821 case multipart-reply-meter-config {
824 type oft:meter-mod-command;
830 uses meter-band-header;
834 case multipart-reply-meter-features {
839 type oft:meter-band-type;
842 type oft:meter-flags;
851 case multipart-reply-table-features {
852 list table-features {
859 leaf metadata-match {
862 leaf metadata-write {
866 type oft:port-config;
873 case multipart-reply-port-desc {
878 case multipart-reply-experimenter {
888 /* Barrier messages. */
889 grouping barrier-request {
890 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
891 /* Controller/switch message */
894 grouping barrier-reply {
895 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
896 /* Controller/switch message */
899 /* Queue Configuration messages. */
900 grouping queue-get-config-request {
901 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
902 /* Controller/switch message */
907 type oft:port-number;
910 grouping queue-get-config-reply {
911 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
912 /* Controller/switch message */
917 type oft:port-number;
923 grouping packet-queue {
928 type oft:port-number;
931 uses queue-property-header;
934 grouping queue-property-header {
936 type oft:queue-property;
939 /* Controller role change request messages. */
940 grouping role-request {
941 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
942 /* Controller/switch message */
947 type oft:controller-role;
953 grouping role-reply {
954 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
955 /* Controller/switch message */
960 type oft:controller-role;
966 /* Asynchronous message configuration. */
967 grouping get-async-request {
968 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
969 /* Controller/switch message */
973 grouping get-async-reply {
974 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
975 /* Controller/switch message */
979 list packet-in-mask {
981 type oft:packet-in-reason;
984 list port-status-mask {
986 type oft:port-reason;
989 list flow-removed-mask {
991 type oft:flow-removed-reason;
996 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
997 /* Controller/switch message */
1001 leaf-list packet-in-mask {
1002 type oft:packet-in-reason;
1004 leaf-list port-status-mask {
1005 type oft:port-reason;
1007 leaf-list flow-removed-mask {
1008 type oft:flow-removed-reason;
1011 /* Meters and rate limiters configuration messages. */
1012 grouping meter-mod {
1013 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
1014 /* Controller/switch message */
1019 type oft:meter-mod-command;
1022 type oft:meter-flags;
1028 uses meter-band-header;
1032 grouping meter-band-header {
1034 type oft:meter-band-type;
1046 /* Immutable messages. */
1047 notification hello-message {
1049 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
1051 /* Symmetric message */
1053 notification error-message {
1055 // reference "OFPT_ERROR message in Openflow Switch 1.3 Spec"
1057 /* Symmetric message */
1059 notification echo-request-message {
1061 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
1063 /* Symmetric message */
1065 notification experimenter-message {
1067 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
1068 // TODO:: does switch send this when understood experimenter msg from lib?
1069 /* Symmetric message */
1071 // # Notification and RPCs
1072 /* Symmetric RPC. */
1074 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
1078 /* Controller/switch message */
1085 // reference "OFPT_ECHO_REQUEST message in Openflow Switch 1.3 Spec"
1092 // reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"
1099 // reference "OFPT_EXPERIMENTER message in Openflow Switch 1.3 Spec"
1105 /* Switch configuration messages. */
1107 // reference "OFPT_FEATURES_REQUEST message in Openflow Switch 1.3 Spec"
1109 uses features-request;
1111 /* Controller/switch message */
1113 uses features-reply;
1118 // reference "OFPT_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
1120 uses get-config-request;
1123 uses get-config-reply;
1125 /* Controller/switch message */
1129 // reference "OFPT_SET_CONFIG message in Openflow Switch 1.3 Spec"
1133 /* Controller/switch message */
1135 /* Asynchronous messages. */
1136 notification packet-in-message {
1138 // reference "OFPT_PACKET_IN message in Openflow Switch 1.3 Spec"
1142 notification flow-removed-message {
1144 // reference "OFPT_FLOW_REMOVED message in Openflow Switch 1.3 Spec"
1148 notification port-status-message {
1150 // reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"
1152 } /* Async message */
1154 /* Controller command messages. */
1158 // reference "OFPT_PACKET_OUT message in Openflow Switch 1.3 Spec"
1160 /* Controller/switch message */
1165 // reference "OFPT_FLOW_MOD message in Openflow Switch 1.3 Spec"
1167 /* Controller/switch message */
1172 // reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"
1174 /* Controller/switch message */
1179 // reference "OFPT_PORT_MOD message in Openflow Switch 1.3 Spec"
1181 } /* Controller/switch message */
1186 // reference "OFPT_TABLE_MOD message in Openflow Switch 1.3 Spec"
1188 } /* Controller/switch message */
1190 /* Multipart messages. */
1191 //FIXME: Arent this wire protocol specific?
1193 notification multipart-request-message {
1194 uses multipart-request;
1195 // reference "OFPT_MULTIPART_REQUEST message in Openflow Switch 1.3 Spec"
1197 } /* Controller/switch message */
1198 notification multipart-reply-message {
1199 uses multipart-reply;
1200 // reference "OFPT_MULTIPART_REPLY message in Openflow Switch 1.3 Spec"
1202 } /* Controller/switch message */
1205 /* Barrier messages. */
1208 uses barrier-request;
1209 // reference "OFPT_BARRIER_REQUEST message in Openflow Switch 1.3 Spec"
1213 // reference "OFPT_BARRIER_REPLY message in Openflow Switch 1.3 Spec"
1216 /* Queue Configuration messages. */
1217 rpc get-queue-config {
1219 uses queue-get-config-request;
1220 // reference "OFPT_QUEUE_GET_CONFIG_REQUEST message in Openflow Switch 1.3 Spec"
1223 uses queue-get-config-reply;
1224 // reference "OFPT_QUEUE_GET_CONFIG_REPLY message in Openflow Switch 1.3 Spec"
1228 /* Controller role change request messages. */
1232 // reference "OFPT_ROLE_REQUEST message in Openflow Switch 1.3 Spec"
1236 // reference "OFPT_ROLE_REPLY message in Openflow Switch 1.3 Spec"
1238 } /* Controller/switch message */
1240 /* Asynchronous message configuration. */
1243 uses get-async-request;
1244 // reference "OFPT_GET_ASYNC_REQUEST message in Openflow Switch 1.3 Spec"
1247 uses get-async-reply;
1248 // reference "OFPT_GET_ASYNC_REPLY message in Openflow Switch 1.3 Spec"
1251 /* Controller/switch message */
1255 // reference "OFPT_SET_ASYNC message in Openflow Switch 1.3 Spec"
1259 /* Meters and rate limiters configuration messages. */
1263 // reference "OFPT_METER_MOD message in Openflow Switch 1.3 Spec"
1265 } /* Controller/switch message */