7.3 Controller-to-Switch Messages
7.3.10 Set Asynchronous Configuration Message
The switch manages a per-controller asynchronous configuration, which defines the asynchronous messages that it wants to receive (other than error messages) on a given OpenFlow channel. The controller is able to set and query its asynchronous configuration with the OFPT_SET_ASYNC and OFPT_GET_ASYNC_REQUESTmessages, respectively. The switch responds to a OFPT_GET_ASYNC_REQUEST message with an OFPT_GET_ASYNC_REPLY message; it does not reply to a request to set the configura- tion.
The OFPT_SET_ASYNC message sets whether a controller should receive a given asynchronous message that is generated by the switch. Other OpenFlow features control whether a given message is gen- erated; for example, the OFPFF_SEND_FLOW_REM flag in each flow entry controls whether the switch generates a OFPT_FLOW_REMOVED message when a flow entry is removed. The asynchronous configura- tion acts as an additional per-controller filter; for example it defines if a specific controller receives those OFPT_FLOW_REMOVEDmessages.
The configuration set with the OFPT_SET_ASYNC message is specific to a particular OpenFlow channel. It does not affect any other OpenFlow channels, whether currently established or to be established in the future. The configuration set with OFPT_SET_ASYNC does not filter or otherwise affect error messages. A switch configuration, for example using the OpenFlow Configuration Protocol, may set the initial configuration of asynchronous messages when an OpenFlow connection is established. In the absence of such switch configuration, the initial configuration shall be:
• In the “master” or “equal” role, enable all OFPT_PACKET_IN messages, except those with reason OFPR_INVALID_TTL, enable all OFPT_PORT_STATUS, OFPT_FLOW_REMOVED, OFPT_CONTROLLER_STATUS messages, and disable all OFPT_ROLE_STATUS and OFPT_REQUESTFORWARDmessages.
• In the “slave” role, enable all OFPT_PORT_STATUS and OPFT_CONTROLLER_STATUS messages and disable all OFPT_PACKET_IN, OFPT_FLOW_REMOVED, OFPT_ROLE_STATUS and OFPT_REQUESTFORWARD messages.
There is no body for OFPT_GET_ASYNC_REQUEST beyond the OpenFlow header. The OFPT_SET_ASYNC and OFPT_GET_ASYNC_REPLY messages have the following format:
/* Asynchronous message configuration. */ struct ofp_async_config {
struct ofp_header header; /* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */
/* Async config Property list - 0 or more */ struct ofp_async_config_prop_header properties[0]; };
The properties field is a list of asynchronous configuration properties, describing if various set of asynchronous messages are enabled or not. In a OFPT_SET_ASYNC, only the properties that shall be changed need to be included, properties that are omitted from the message are unchanged. In a OFPT_GET_ASYNC_REPLYmessage, all properties must be included.
The asynchronous configuration types currently defined are:
/* Async Config property types.
* Low order bit cleared indicates a property for the slave role. * Low order bit set indicates a property for the master/equal role. */
enum ofp_async_config_prop_type {
OFPACPT_PACKET_IN_SLAVE = 0, /* Packet-in mask for slave. */
OFPACPT_PACKET_IN_MASTER = 1, /* Packet-in mask for master. */
OFPACPT_PORT_STATUS_SLAVE = 2, /* Port-status mask for slave. */
OFPACPT_PORT_STATUS_MASTER = 3, /* Port-status mask for master. */
OFPACPT_FLOW_REMOVED_SLAVE = 4, /* Flow removed mask for slave. */
OFPACPT_FLOW_REMOVED_MASTER = 5, /* Flow removed mask for master. */
OFPACPT_ROLE_STATUS_SLAVE = 6, /* Role status mask for slave. */
OFPACPT_ROLE_STATUS_MASTER = 7, /* Role status mask for master. */
OFPACPT_TABLE_STATUS_SLAVE = 8, /* Table status mask for slave. */
OFPACPT_TABLE_STATUS_MASTER = 9, /* Table status mask for master. */
OFPACPT_REQUESTFORWARD_SLAVE = 10, /* RequestForward mask for slave. */ OFPACPT_REQUESTFORWARD_MASTER = 11, /* RequestForward mask for master. */
OFPACPT_FLOW_STATS_SLAVE = 12, /* Flow stats mask for slave. */
OFPACPT_FLOW_STATS_MASTER = 13, /* Flow stats mask for master. */
OFPACPT_CONT_STATUS_SLAVE = 14, /* Controller status mask for slave. */
OFPACPT_CONT_STATUS_MASTER = 15, /* Controller status mask for master. */
OFPACPT_EXPERIMENTER_SLAVE = 0xFFFE, /* Experimenter for slave. */
OFPACPT_EXPERIMENTER_MASTER = 0xFFFF, /* Experimenter for master. */ };
Each property type control whether the controller receives asynchronous messages with a specific enum ofp_type. The properties with the _MASTER suffix specifies messages of interest when the con- troller has a OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER role (see ). The properties with the _SLAVE suffix specifies messages of interest when the controller has a OFPCR_ROLE_SLAVE role.
A property definition contains the property type, length, and any associated data:
/* Common header for all async config Properties */ struct ofp_async_config_prop_header {
uint16_t type; /* One of OFPACPT_*. */
uint16_t length; /* Length in bytes of this property. */
};
OFP_ASSERT(sizeof(struct ofp_async_config_prop_header) == 4);
The OFPACPT_PACKET_IN_SLAVE, OFPACPT_PACKET_IN_MASTER, OFPACPT_PORT_STATUS_SLAVE, OFPACPT_PORT_STATUS_MASTER, OFPACPT_FLOW_REMOVED_SLAVE, OFPACPT_FLOW_REMOVED_MASTER, OFPACPT_ROLE_STATUS_SLAVE and OFPACPT_ROLE_STATUS_MASTER, OFPACPT_TABLE_STATUS_SLAVE, OFPACPT_TABLE_STATUS_MASTER, OFPACPT_REQUESTFORWARD_SLAVE, OFPACPT_REQUESTFORWARD_MASTER, OFPACPT_FLOW_STATS_SLAVE, OFPACPT_FLOW_STATS_MASTER, OPFT_CONT_STATUS_SLAVE and OPFT_CONT_STATUS_MASTERproperties use the following structure and fields:
/* Various reason based properties */ struct ofp_async_config_prop_reasons {
uint16_t type; /* One of OFPACPT_PACKET_IN_*,
OFPACPT_PORT_STATUS_*, OFPACPT_FLOW_REMOVED_*, OFPACPT_ROLE_STATUS_*, OFPACPT_TABLE_STATUS_*, OFPACPT_REQUESTFORWARD_*, OFPACPT_FLOW_STATS_*, OFPACPT_CONT_STATUS_*. */
uint16_t length; /* Length in bytes of this property. */
uint32_t mask; /* Bitmasks of reason values. */
};
OFP_ASSERT(sizeof(struct ofp_async_config_prop_reasons) == 8);
The mask field is a bit-mask in which a 0-bit disables receiving a message sent with the reason code corresponding to the bit index and a 1-bit enables receiving it. For example, if the property type is OFPACPT_PORT_STATUS_SLAVE, the bit with value 22= 4 in mask determines whether the controller will receive OFPT_PORT_STATUS messages with reason OFPPR_MODIFY (value 2) when the controller has role OFPCR_ROLE_SLAVE.
The OFPACPT_EXPERIMENTER_SLAVE and OFPACPT_EXPERIMENTER_MASTER properties uses the following structure and fields:
/* Experimenter async config property */ struct ofp_async_config_prop_experimenter {
uint16_t type; /* One of OFPTFPT_EXPERIMENTER_SLAVE,
OFPTFPT_EXPERIMENTER_MASTER. */
uint16_t length; /* Length in bytes of this property. */
uint32_t experimenter; /* Experimenter ID which takes the same
form as in struct
ofp_experimenter_header. */
uint32_t exp_type; /* Experimenter defined. */
/* Followed by:
* - Exactly (length - 12) bytes containing the experimenter data, then
* - Exactly (length + 7)/8*8 - (length) (between 0 and 7)
* bytes of all-zero bytes */
uint32_t experimenter_data[0];
};
OFP_ASSERT(sizeof(struct ofp_async_config_prop_experimenter) == 12);
The experimenter field is the Experimenter ID, which takes the same form as in the typical experi- menter structure (see 7.2.8).