《openflow数据结构.ppt》由会员分享,可在线阅读,更多相关《openflow数据结构.ppt(38页珍藏版)》请在优知文库上搜索。
1、openflow数据结构header struct ofp_header uint8_t version; uint8_t type; uint16_t length; uint32_t xid; /* Transaction id associated with this packet. Replies use the same id as was in the request to facilitate pairing. */ ;hello OFPT_HELLO 消息没有消息体,仅有of 消息头 struct ofp_error_msg struct ofp_header header;
2、uint16_t type;高层的错误类型 uint16_t code;错误代码 uint8_t data0;变长 至少包括64 字节的失败请求 代码中将整个错误报文全部发回去 ;echo echo请求消息由一个of 消息头加上任意的消息体组成,用来协助测量延迟、带宽、控制器跟交换机之间是否保持连接等信息。 echo回复消息由一个of 消息头加上对应请求的无修改消息体组成,用来协助测量延迟、带宽、控制器跟交换机之间是否保持连接等信息。 代码中没有附加任何信息,只有协议头。 没有处理OFPT_FEATURES_REQUEST 发送一个仅有消息头的OFPT_FEATURES_REQUEST消息OF
3、PT_FEATURES_REPLY struct ofp_switch_features struct ofp_header header; uint64_t datapath_id; dp标示符 uint32_t n_buffers;最多缓存多少数据报文 uint8_t n_tables;交换机支持的流表个数 uint8_t pad3;64位对齐 uint32_t capabilities;功能 uint32_t actions;标志支持行动的bit 串 struct ofp_phy_port ports0;描绘所有支持of 的交换机端口 ; enum ofp_capabilities OF
4、PC_FLOW_STATS = 1 0, 流统计 OFPC_TABLE_STATS = 1 1,表统计 OFPC_PORT_STATS = 1 2, 端口统计 OFPC_STP = 1 3,802.1d生成树 OFPC_RESERVED = 1 4,保留项,必须为0 OFPC_IP_REASM = 1 5,可以重组IP分段 OFPC_QUEUE_STATS = 1 6,队列统计 OFPC_ARP_MATCH_IP = 1 7 匹配IP地址 in arp pkts ; enum ofp_action_type OFPAT_OUTPUT,输出到sw端口 OFPAT_SET_VLAN_VID, 设定
5、802.1q虚拟网ID OFPAT_SET_VLAN_PCP, 设定虚拟网优先级 OFPAT_STRIP_VLAN, 剥去虚拟网头部 OFPAT_SET_DL_SRC, 设定以太网源地址 OFPAT_SET_DL_DST, 设定以太网目的地址 OFPAT_SET_NW_SRC,设定IP源地址 OFPAT_SET_NW_DST, 设定IP目的地址 OFPAT_SET_NW_TOS,设定IPTOS OFPAT_SET_TP_SRC,设定TCP/UDP source port OFPAT_SET_TP_DST, 设定TCP/UDP destinationport OFPAT_ENQUEUE, 输出到
6、队列中区 OFPAT_VENDOR = 0 xffff ; struct ofp_phy_port uint16_t port_no;标明绑定到物理接口的datapath 值 uint8_t hw_addrOFP_ETH_ALEN;是该物理接口的mac 地址 char nameOFP_MAX_PORT_NAME_LEN; 是该接口的名称字符串,以null 结尾 uint32_t config; 描述了生成树和管理设置 uint32_t state; 生成树状态和某个物理接口是否存在 uint32_t curr; uint32_t advertised; uint32_t supported;
7、uint32_t peer; ; enum ofp_port_config OFPPC_PORT_DOWN = 1 0, 端口被手工down OFPPC_NO_STP = 1 1,无法802.1d生成树 OFPPC_NO_RECV = 1 2, drop所有的报文,除了802.1d生成树的报文 OFPPC_NO_RECV_STP = 1 3, drop已经收到的802.1d的生成树的报文 OFPPC_NO_FLOOD = 1 4, 不计入该端口,当它洪泛的时候 OFPPC_NO_FWD = 1 5, drop被转发到端口的报文 OFPPC_NO_PACKET_IN = 1 6 不要为该端口发送
8、packet-in报文 ; enum ofp_port_state OFPPS_LINK_DOWN = 1 0, 现在没有物理链接 OFPPS_STP_LISTEN = 0 8, 没有learning和relaying的帧 OFPPS_STP_LEARN = 1 8,Learning but not relaying frames OFPPS_STP_FORWARD = 2 8, Learning and relaying frames OFPPS_STP_BLOCK = 3 8, 不是生成树的一部分 OFPPS_STP_MASK = 3 8 /* Bit mask for OFPPS_STP
9、_* values. */ ; curr,advertised,supported 和peer 域标明 链路模式(10M 到10G, 全双工、 半双工),链路类型(铜线/光线)和链路特性 (自动协商和暂停)OFPT_GET_CONFIG_REQUESTOFPT_GET_CONFIG_REPLYOFPT_SET_CONFIG struct ofp_switch_config struct ofp_header header; uint16_t flags;分片怎么处理 uint16_t miss_send_len;不匹配 发给交换机 发的数据长度 ; enum ofp_config_flags
10、OFPC_FRAG_NORMAL = 0, /* No special handling for fragments. */ OFPC_FRAG_DROP = 1, /* Drop fragments. */ OFPC_FRAG_REASM = 2, /* Reassemble (only if OFPC_IP_REASM set). */ OFPC_FRAG_MASK = 3 OFPT_PACKET_IN struct ofp_packet_in struct ofp_header header; uint32_t buffer_id; dp标示缓存中的网包 uint16_t total_l
11、en;帧的长度 uint16_t in_port;帧被交换机接受的入口 uint8_t reason;发给ctl的原因 uint8_t pad; uint8_t data0; ; enum ofp_packet_in_reason OFPR_NO_MATCH, /* No matching flow. */ OFPR_ACTION /* Action explicitly output to controller. */ OFPT_FLOW_REMOVEDstruct ofp_flow_removed struct ofp_header header;struct ofp_match matc
12、h;uint64_t cookie;/* Opaque controller issued identifier. */uint16_t priority;优先级uint8_t reason;删除原因uint8_t pad1;uint32_t duration_sec;生存时间uint32_t duration_nsec;/* Time flow was alive in nanoseconds beyondduration_sec. */uint16_t idle_timeout;/* Idle timeout from original flow mod. */uint8_t pad22;
13、uint64_t packet_count;包信息计数 uint64_t byte_count;流量信息计数; enum ofp_flow_removed_reason OFPRR_IDLE_TIMEOUT, /* Flow idle time exceeded idle_timeout. */ OFPRR_HARD_TIMEOUT, /* Time exceeded hard_timeout. */ OFPRR_DELETE /* Evicted by a DELETE flow mod. */ ;ofp_matchstruct ofp_match uint32_t wildcards;ui
14、nt16_t in_port; 输入的交换机端口uint8_t dl_srcOFP_ETH_ALEN; uint8_t dl_dstOFP_ETH_ALEN; uint16_t dl_vlan; uint8_t dl_vlan_pcp; uint8_t pad11; uint16_t dl_type;uint8_t nw_tos; uint8_t nw_proto;uint8_t pad22; uint32_t nw_src; uint32_t nw_dst; uint16_t tp_src; uint16_t tp_dst; ;OFPT_PORT_STATUS struct ofp_port
15、_status struct ofp_header header; uint8_t reason; uint8_t pad7; struct ofp_phy_port desc; ; enum ofp_port_reason OFPPR_ADD, OFPPR_DELETE, OFPPR_MODIFY ;OFPT_PACKET_OUT struct ofp_packet_out struct ofp_header header; uint32_t buffer_id;跟ofp_packet_in 中给出的一致。如果buffer_id 是-1,则网包内容被包括在data 域中,dp分配 uint1
16、6_t in_port;报文的输入端口 uint16_t actions_len 行为数组的长度 struct ofp_action_header actions0; /* uint8_t data0; */ ; struct ofp_action_header uint16_t type; uint16_t len; uint8_t pad4; ;OFPT_FLOW_MODstruct ofp_flow_mod struct ofp_header header;struct ofp_match match; uint64_t cookie; uint16_t command; 如何处理uint16_t idle_timeout; uint16_t hard_timeout; uint16_t priority; 优先级uint32_t buffer_id; 标志被OFPT_PACKET_IN 消息发出的网包在buffer 中的iduint16_t out_port;out_port 可选的用于进行删除操作时的匹配uint16_t flags; struct ofp_action_he