OpenFlow v1.0
v1.0协议消息列表如下:
分为三类消息:Controller-to-switch,asynchronous和symmertric。
v1.0(包含至少一个流表,每个流表包含多个流表项)流表项构成:
| 头字段 | 计数器 | 行动 |
| In Port,Source Address,Destination Address... |
Per Table:Active Entries[0],Packet Lookups[0]... Per Flow:Received Packets[10]... |
Forward/Drop |
| ... | ... | ... |
头字段:
| 内容 | 说明 |
| In port | 入端口 |
| Ethernet source address | 以太网帧的源以太网地址 |
| Ethernet destination address | 以太网帧的目标以太网地址 |
| Ethernet type | 以太网帧的类型字段 |
| Vlan id | Vlan标签的VID |
| Vlan priority | |
| IP source address | IP源地址 |
| IP destination address | IP目的地址 |
| IP protocol | IP头的协议字段 |
| ToS | IP头的ToS字段 |
| Transport source port/ICMP type | TCP/UDP的源端口号;ICMP头的类型 |
| Transport destination port/ICMP code | TCP/UDP的目的端口号;ICMP头的代码 |
计数器:
1.各流表的Per Table计数器:
| 内容 | 比特数 |
| Active Entries | 32 |
| Packet Lookups | 64 |
| Packet Matches | 64 |
2.各物理端口的Per Port计数器:
| 内容 | 比特数 |
| Received Packets | 64 |
| Received Bytes | 64 |
| Duration(msec) | 32 |
| Duration(usec) | 32 |
3.各流表项的Per Flow计数器:
| 内容 | 比特数 |
| Transmit Packets | 64 |
| Transmit Bytes | 64 |
| Transmit Overrun Errors | 64 |
4.各队列的Per Queue计数器:
| 内容 | 比特数 |
| Received Packets | 64 |
| Transmitted Packets | 64 |
| Received Bytes | 64 |
| Transmitted Bytes | 64 |
| Receive Drops | 64 |
| Transmit Drops | 64 |
| Receive Errors | 64 |
| Transmit Errors | 64 |
| Receive Frame Alignment Errors | 64 |
| Receive Overrun Errors | 64 |
| Receive CRC Errors | 64 |
| Collisions | 64 |
行动:
Forward,Drop,Enqueue,Modify-Field。
v1.0数据包只能与一个流表的一个流表项匹配。而v1.1以上数据包可以与多个流表的一个流表项匹配。
v1.1流表项构成:
匹配字段(即v1.0的头字段),计数器,指令。
指令:对与流表项匹配的数据包所执行的命令,提供了执行行动,在之后批量执行的行动集中添加及删除行动、写入元数据等功能,移动到已指定流表的动作等指令。
五种指令如下:
1.Apply-Actions:不变更行动集,仅执行指定的行动列表。用于在2个流表中传递并修改数据包或执行同一类型的多个行动时。
2.Clear-Actions:清楚行动集中的所有行动。
3.Write-Actions:将指定的多个行动合并到当前的行动集中,行动集中已存在同一类型时将其覆盖,不存在同一类型时进行添加。
4.Write-Metadata:写入元数据中。
5.Goto-Table:Goto语句。移动到流水线后方连接的流表中,不能跳转到现有位置前方的流表中。最后的流表中不能包含Goto语句。
v1.3流表项构成:
匹配字段,优先级,计数器,指令,超时,Cookie。
下面是OF1.3的数据包结构:
消息格式:of协议数据包由OF Header 和OF Message两部分组成:
Header结构:
1 struct ofp_header { 2 uint8_t version; /*OFP_VERSION.*/ 3 uint8_t type; /*One of the OFPT_constants.*/ 4 uint16_t length; /*Length including this ofp_header.*/ 5 uint32_t xid; /*Transaction id associated with this packet.*/ 6 };