ovs 流表机制(三)--group表
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 dump-group-stats vswitch0 OFPST_GROUP reply (OF1.3) (xid=0x6):
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 dump-group-stats vswitch0
OFPST_GROUP reply (OF1.3) (xid=0x6):
1、清空所有流表
[root@kunpeng82 devuser]# ovs-ofctl del-flows vswitch0
[root@kunpeng82 devuser]#
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 dump-groups vswitch0
OFPST_GROUP_DESC reply (OF1.3) (xid=0x2):
2、 添加group表
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 add-group vswitch0 "group_id=1,type=select,bucket=resubmit(,1)"
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 dump-group-stats vswitch0
OFPST_GROUP reply (OF1.3) (xid=0x6):
group_id=1,duration=5.397s,ref_count=0,packet_count=0,byte_count=0,bucket0:packet_count=0,byte_count=0
3、在table 0添加两条flow
[root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 add-flow vswitch0 "table=0,in_port=1,actions=group:1" [root@kunpeng82 devuser]# ovs-ofctl -O OpenFlow13 add-flow vswitch0 "table=0,in_port=2,actions=group:1"
无法ping通
[root@kunpeng82 devuser]# ip netns exec ns1 ping 192.168.1.200 PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data. ^C --- 192.168.1.200 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3098ms
4、 向table1中增加两条flow [root@kunpeng82 devuser]# ovs-ofctl add-flow vswitch0 "table=1,priority=1,in_port=1,actions=output:2" [root@kunpeng82 devuser]# ovs-ofctl add-flow vswitch0 "table=1,priority=1,in_port=2,actions=output:1"
ping通
[root@kunpeng82 devuser]# ip netns exec ns1 ping 192.168.1.200 PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data. 64 bytes from 192.168.1.200: icmp_seq=1 ttl=64 time=1.18 ms 64 bytes from 192.168.1.200: icmp_seq=2 ttl=64 time=0.034 ms 64 bytes from 192.168.1.200: icmp_seq=3 ttl=64 time=0.022 ms ^C --- 192.168.1.200 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2018ms rtt min/avg/max/mdev = 0.022/0.412/1.182/0.544 ms
[root@kunpeng82 devuser]# ovs-ofctl dump-flows vswitch0 table=0 cookie=0x0, duration=672.800s, table=0, n_packets=12, n_bytes=896, in_port="tap0_br" actions=group:1 cookie=0x0, duration=668.170s, table=0, n_packets=5, n_bytes=378, in_port="tap3_br" actions=group:1 [root@kunpeng82 devuser]# ovs-ofctl dump-flows vswitch0 table=1 cookie=0x0, duration=506.543s, table=1, n_packets=5, n_bytes=378, priority=1,in_port="tap0_br" actions=output:"tap3_br" cookie=0x0, duration=496.200s, table=1, n_packets=5, n_bytes=378, priority=1,in_port="tap3_br" actions=output:"tap0_br"