关于OpenFlow组表Fast Failover的实践
0.前言
继昨天的对一些meter表、组表的实践之后,又来一波实践。没错为了xxx,不得不做的一个小demo,由于这个demo,也发现了OpenFlow机制上的一些神奇之处,也是很有意思的吧。
1.关于组表Fast Failover的理论介绍
OpenFlow规范原文:
Optional: fast failover: Execute the first live bucket. Each action bucket is associated with
a specific port and/or group that controls its liveness. The buckets are evaluated in the order
defined by the group, and the first bucket which is associated with a live port/group is selected.
This group type enables the switch to change forwarding without requiring a round trip to the
controller. If no buckets are live, packets are dropped. This group type must implement a liveness
mechanism
翻译,摘自OpenFlow Switch学习笔记(五)——Group Table、Meter Table
fast failover:执行第一个live的Action Bucket,每一个Action Bucket都关联了一个指定的port或者group来控制它的存活状态。Buckets会依照Group顺序依次被评估,并且第一个关联了一个live的port或者group的Action Bucket会被筛选出来。这种Group类型能够自行改变Switch的转发行为而不用事先请求Remote Controller。如果当前没有Buckets是live的,那么数据包就被丢弃,因此这种Group必须要实现一个管理存活状态的机制。
2.实践
建立一个简单拓扑:
在S1上实现简单的group fast failover操作
//加入组表
sudo ovs-ofctl -O OpenFlow13 add-group s1 group_id=1,type=ff,bucket=watch_port:2,output:2,bucket=watch_port:3,output:3
sudo ovs-ofctl -O OpenFlow13 add-flow s1 in_port=1,actions=group:1
使用
h1 ping h2
1)查看group上的匹配数
kaola@kaola:~$ sudo ovs-ofctl -O OpenFlow13 dump-group-stats s1
[sudo] kaola 的密码:
OFPST_GROUP reply (OF1.3) (xid=0x4):
group_id=1,duration=302.118s,ref_count=1,packet_count=55,byte_count=2338,bucket0:packet_count=55,byte_count=2338,bucket1:packet_count=0,byte_count=0
将2号端口断开
sudo ovs-ofctl -O OpenFlow13 mod-port s1 2 down
2)查看group上的匹配数
kaola@kaola:~$ sudo ovs-ofctl -O OpenFlow13 dump-group-stats s1
OFPST_GROUP reply (OF1.3) (xid=0x4):
group_id=1,duration=438.854s,ref_count=1,packet_count=77,byte_count=3262,bucket0:packet_count=55,byte_count=2338,bucket1:packet_count=22,byte_count=924
由1) 2)可以明显看出,由于2号口的失败,直接进行了切换为3号口进行转发
结论
没什么结论,已经有的功能做着玩吧。
参考链接
- http://www.cnblogs.com/CasonChan/p/4623931.html
- http://xueshu.baidu.com/s?wd=paperuri%3A(93de7783eaf1a26272cf062935dd1792)&filter=sc_long_sign&tn=SE_xueshusource_2kduw22v&sc_vurl=http%3A%2F%2Fcdmd.cnki.com.cn%2FArticle%2FCDMD-10269-1015351439.htm&ie=utf-8&sc_us=14496121870279750724
- https://github.com/peiqiaoWang/The-Road-to-SDN/blob/master/OVS/ovs-commands-reference.pdf