OpenFlow¶
- class os_ken.lib.packet.openflow.OFPUnparseableMsg(datapath, version, msg_type, msg_len, xid, body)¶
Unparseable OpenFlow message encoder class.
An instance has the following attributes at least.
Attribute
Description
datapath
A os_ken.ofproto.ofproto_protocol.ProtocolDesc instance for this message or None if OpenFlow protocol version is unsupported version.
version
OpenFlow protocol version
msg_type
Type of OpenFlow message
msg_len
Length of the message
xid
Transaction id
body
OpenFlow body data
Note
"datapath" attribute is different from os_ken.controller.controller.Datapath. So you can not use "datapath" attribute to send OpenFlow messages. For example, "datapath" attribute does not have send_msg method.
- class os_ken.lib.packet.openflow.openflow(msg)¶
OpenFlow message encoder/decoder class.
An instance has the following attributes at least.
Attribute
Description
msg
An instance of OpenFlow message (see OpenFlow protocol API Reference) or an instance of OFPUnparseableMsg if failed to parse packet as OpenFlow message.
- classmethod parser(buf)¶
Decode a protocol header.
This method is used only when decoding a packet.
Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.
An object to describe the decoded header.
A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.
The rest of packet.
- serialize(_payload, _prev)¶
Encode a protocol header.
This method is used only when encoding a packet.
Encode a protocol header. Returns a bytearray which contains the header.
payload is the rest of the packet which will immediately follow this header.
prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.