關於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
