2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 13:58:14 +00:00
ovs/tests/system-tap.at
William Tu 5f01a9019f tests: Add tests using tap device.
Similar to using veth across namespaces, this patch creates
tap devices, assigns to namespaces, and allows traffic to
go through different test cases.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: William Tu <u9012063@gmail.com>
2020-05-14 07:22:35 -07:00

35 lines
1.2 KiB
Plaintext

AT_SETUP([traffic between namespaces using tap])
AT_KEYWORDS([http_tap])
OVS_TRAFFIC_VSWITCHD_START()
AT_SKIP_IF([test $HAVE_TUNCTL = no])
AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
ADD_NAMESPACES(at_ns0, at_ns1)
AT_CHECK([ip tuntap add tap0 mode tap])
on_exit 'ip tuntap del tap0 mode tap'
AT_CHECK([ip tuntap add tap1 mode tap])
on_exit 'ip tuntap del tap1 mode tap'
AT_CHECK([ovs-vsctl add-port br0 tap0 -- set int tap0 type=tap])
AT_CHECK([ovs-vsctl add-port br0 tap1 -- set int tap1 type=tap])
AT_CHECK([ip link set tap0 netns at_ns0])
AT_CHECK([ip link set tap1 netns at_ns1])
AT_CHECK([ip netns exec at_ns0 ip link set dev tap0 up])
AT_CHECK([ip netns exec at_ns1 ip link set dev tap1 up])
AT_CHECK([ip netns exec at_ns0 ip addr add 10.1.1.1/24 dev tap0])
AT_CHECK([ip netns exec at_ns1 ip addr add 10.1.1.2/24 dev tap1])
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
OVS_START_L7([at_ns1], [http])
NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log])
OVS_TRAFFIC_VSWITCHD_STOP(["/.*ethtool command ETHTOOL_G.*/d"])
AT_CLEANUP