验证是否能从端口 p0 发送数据包到 p1
# ip netns exec ns0 ping -c4 192.168.1.101 PING 192.168.1.101 (192.168.1.101) 56(84) bytes of data. 64 bytes from 192.168.1.101: icmp_seq=1 ttl=64 time=0.625 ms 64 bytes from 192.168.1.101: icmp_seq=2 ttl=64 time=0.088 ms 64 bytes from 192.168.1.101: icmp_seq=3 ttl=64 time=0.082 ms 64 bytes from 192.168.1.101: icmp_seq=4 ttl=64 time=0.048 ms在 OVS 端也可以看到,流表规则已经被 OVS 同步到本地。
# ovs-ofctl dump-flows ovs-switch NXST_FLOW reply (xid=0x4): cookie=0xa00000626d6af5, duration=111.468s, table=0, n_packets=7, n_bytes=630, idle_age=2, in_port=100 actions=FLOOD cookie=0xa00000626d6af6, duration=83.717s, table=0, n_packets=7, n_bytes=630, idle_age=1, in_port=101 actions=FLOOD通过 Floodlight 的 RestAPI,查看交换机上的流表规则
curl :8080/wm/staticflowentrypusher/list/00:00:d2:3b:94:ce:41:46/json | python -mjson.tool采用python的输出,好看很多的
# curl http://10.250.3.10:8080/wm/staticflowentrypusher/list/00:00:d2:3b:94:ce:41:46/json | python -mjson.tool % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1435 0 1435 0 0 109k 0 --:--:-- --:--:-- --:--:-- 116k { "00:00:d2:3b:94:ce:41:46": { "my-flow1": { "actions": [ { "length": 8, "lengthU": 8, "maxLength": 32767, "port": -5, "type": "OUTPUT" } ], "bufferId": -1, "command": 0, "cookie": 45035997925042933, "flags": 0, "hardTimeout": 0, "idleTimeout": 0, "length": 80, "lengthU": 80, "match": { "dataLayerDestination": "00:00:00:00:00:00", "dataLayerSource": "00:00:00:00:00:00", "dataLayerType": "0x0000", "dataLayerVirtualLan": -1, "dataLayerVirtualLanPriorityCodePoint": 0, "inputPort": 100, "networkDestination": "0.0.0.0", "networkDestinationMaskLen": 0, "networkProtocol": 0, "networkSource": "0.0.0.0", "networkSourceMaskLen": 0, "networkTypeOfService": 0, "transportDestination": 0, "transportSource": 0, "wildcards": 4194302 }, "outPort": -1, "priority": -32768, "type": "FLOW_MOD", "version": 1, "xid": 0 }, "my-flow2": { "actions": [ { "length": 8, "lengthU": 8, "maxLength": 32767, "port": -5, "type": "OUTPUT" } ], "bufferId": -1, "command": 0, "cookie": 45035997925042934, "flags": 0, "hardTimeout": 0, "idleTimeout": 0, "length": 80, "lengthU": 80, "match": { "dataLayerDestination": "00:00:00:00:00:00", "dataLayerSource": "00:00:00:00:00:00", "dataLayerType": "0x0000", "dataLayerVirtualLan": -1, "dataLayerVirtualLanPriorityCodePoint": 0, "inputPort": 101, "networkDestination": "0.0.0.0", "networkDestinationMaskLen": 0, "networkProtocol": 0, "networkSource": "0.0.0.0", "networkSourceMaskLen": 0, "networkTypeOfService": 0, "transportDestination": 0, "transportSource": 0, "wildcards": 4194302 }, "outPort": -1, "priority": -32768, "type": "FLOW_MOD", "version": 1, "xid": 0 } } }通过 Floodlight 的 RestAPI,删除交换机上的流表规则