]> git.proxmox.com Git - mirror_ovs.git/blame - tests/system-layer3-tunnels.at
utilities: check datapath exists before conntrack flush
[mirror_ovs.git] / tests / system-layer3-tunnels.at
CommitLineData
3310f781
EG
1AT_BANNER([layer3-tunnels])
2
3AT_SETUP([layer3 - ping over VXLAN-GPE])
4OVS_TRAFFIC_VSWITCHD_START([set Bridge br0 other-config:hwaddr="00:12:34:56:78:bb"])
5OVS_CHECK_VXLAN_GPE()
6OVS_CHECK_IPROUTE_ENCAP()
7
8ADD_BR([br-underlay])
9
10ADD_NAMESPACES(at_ns0)
11
12dnl Set up underlay link from host into the namespace using veth pair.
13ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24")
14AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"])
15AT_CHECK([ip link set dev br-underlay up])
16
17dnl Set up tunnel endpoints on OVS outside the namespace and with a native
18dnl linux device inside the namespace.
19ADD_OVS_TUNNEL([vxlan], [br0], [at_vxlan0], [172.31.1.1], [10.1.1.2/24],
20 [options:packet_type=legacy_l3 options:exts=gpe])
21AT_CHECK([ip neigh add 10.1.1.1 lladdr 00:12:34:56:78:aa dev br0])
22NS_CHECK_EXEC([at_ns0], [ip link add dev at_vxlan1 type vxlan dstport 4789 external gpe])
23NS_CHECK_EXEC([at_ns0], [ip addr add dev at_vxlan1 10.1.1.1/24])
24NS_CHECK_EXEC([at_ns0], [ip link set dev at_vxlan1 mtu 1450 up])
25NS_CHECK_EXEC([at_ns0], [ip route add 10.1.1.2/32 encap ip id 0 dst 172.31.1.100 dev at_vxlan1])
26
27AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"])
28
29dnl Now add rules for OVS to forward to the tunnel and local port
30AT_CHECK([ovs-ofctl add-flow br0 "priority=1 action=drop"])
31AT_CHECK([ovs-ofctl add-flow br0 "priority=100 ip,nw_dst=10.1.1.1 action=output:at_vxlan0"])
32AT_CHECK([ovs-ofctl add-flow br0 "priority=100 ip,nw_dst=10.1.1.2 action=mod_dl_src:00:12:34:56:78:aa,mod_dl_dst:00:12:34:56:78:bb,local"])
33
34OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2])
35
36dnl First, check the underlay
37NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl
383 packets transmitted, 3 received, 0% packet loss, time 0ms
39])
40
41dnl Okay, now check the overlay with different packet sizes
42NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
433 packets transmitted, 3 received, 0% packet loss, time 0ms
44])
45NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
463 packets transmitted, 3 received, 0% packet loss, time 0ms
47])
48
49OVS_TRAFFIC_VSWITCHD_STOP
50AT_CLEANUP
07a45ccc
EG
51
52AT_SETUP([layer3 - ping over GRE])
53OVS_TRAFFIC_VSWITCHD_START([set Bridge br0 other-config:hwaddr="00:12:34:56:78:bb"])
54OVS_CHECK_GRE_L3()
55OVS_CHECK_IPROUTE_ENCAP()
56
57ADD_BR([br-underlay])
58
59ADD_NAMESPACES(at_ns0)
60
61dnl Set up underlay link from host into the namespace using veth pair.
62ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24")
63AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"])
64AT_CHECK([ip link set dev br-underlay up])
65
66dnl Set up tunnel endpoints on OVS outside the namespace and with a native
67dnl linux device inside the namespace.
68ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.2/24],
69 [options:packet_type=legacy_l3])
70AT_CHECK([ip neigh add 10.1.1.1 lladdr 00:12:34:56:78:aa dev br0])
71NS_CHECK_EXEC([at_ns0], [ip link add dev at_gre1 type gre remote 172.31.1.100])
72NS_CHECK_EXEC([at_ns0], [ip addr add dev at_gre1 10.1.1.1/24])
73NS_CHECK_EXEC([at_ns0], [ip link set dev at_gre1 mtu 1450 up])
74NS_CHECK_EXEC([at_ns0], [ip route add 10.1.1.2/32 encap ip id 0 dst 172.31.1.100 dev at_gre1])
75
76AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"])
77
78dnl Now add rules for OVS to forward to the tunnel and local port
79AT_CHECK([ovs-ofctl add-flow br0 "priority=1 action=drop"])
80AT_CHECK([ovs-ofctl add-flow br0 "priority=100 ip,nw_dst=10.1.1.1 action=output:at_gre0"])
81AT_CHECK([ovs-ofctl add-flow br0 "priority=100 ip,nw_dst=10.1.1.2 action=mod_dl_src:00:12:34:56:78:aa,mod_dl_dst:00:12:34:56:78:bb,local"])
82
83OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.1.1.2])
84
85dnl First, check the underlay
86NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | FORMAT_PING], [0], [dnl
873 packets transmitted, 3 received, 0% packet loss, time 0ms
88])
89
90dnl Okay, now check the overlay with different packet sizes
91NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
923 packets transmitted, 3 received, 0% packet loss, time 0ms
93])
94NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl
953 packets transmitted, 3 received, 0% packet loss, time 0ms
96])
97
98OVS_TRAFFIC_VSWITCHD_STOP
99AT_CLEANUP