Add two test, one to test a change in local address as such, and another
that test resolution of a conflict that results from such change.
Signed-off-by: Petr Machata <petrm(a)mellanox.com>
---
recipes/switchdev/ipip-010-gre-hier-change.py | 58 +++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/recipes/switchdev/ipip-010-gre-hier-change.py
b/recipes/switchdev/ipip-010-gre-hier-change.py
index 63bb9a4..751fc61 100644
--- a/recipes/switchdev/ipip-010-gre-hier-change.py
+++ b/recipes/switchdev/ipip-010-gre-hier-change.py
@@ -38,6 +38,64 @@ def do_task(ctl, hosts, ifaces, aliases):
sw_if2.reset()
add_forward_route(sw, vrf_u, "1.2.3.5")
+ logging.info("--- local change")
+ with encap_route(m2, vrf_None, 1, "gre1", ip=ipv4), \
+ encap_route(m2, vrf_None, 1, "gre1", ip=ipv6), \
+ gre(sw, d, vrf_o,
+ tos="inherit",
+ local_ip="1.2.3.6",
+ remote_ip="1.2.3.5") as g, \
+ encap_route(sw, vrf_o, 2, g, ip=ipv4), \
+ encap_route(sw, vrf_o, 2, g, ip=ipv6):
+
+ sleep(15)
+ ping_test(tl, m1, sw, ipv6(test_ip(2, 33, [])), m1_if1, g,
+ count=25, fail_expected=True, ipv6=True)
+ ping_test(tl, m1, sw, ipv4(test_ip(2, 33, [])), m1_if1, g,
+ count=25, fail_expected=True)
+
+ sw.run("ip t change name %s local 1.2.3.4" % g.get_devname())
+
+ sleep(5)
+ ping_test(tl, m1, sw, ipv6(test_ip(2, 33, [])), m1_if1, g,
+ ipv6=True)
+ ping_test(tl, m1, sw, ipv4(test_ip(2, 33, [])), m1_if1, g)
+
+ # IPv4 should go through g1, IPv6 through g2, but g2 starts out
+ # misconfigured. Thus both g1 and g2 are offloaded. When the
+ # configuration of g2 is fixed, both tunnels are forced to slow path,
+ # but now they both work.
+ logging.info("--- local change conflict")
+ with encap_route(m2, vrf_None, 1, "gre1", ip=ipv4), \
+ dummy(sw, vrf_u, ip=["1.2.3.6/32"]) as d4, \
+ gre(sw, d4, vrf_o,
+ tos="inherit",
+ local_ip="1.2.3.6",
+ remote_ip="1.2.3.5") as g4, \
+ encap_route(sw, vrf_o, 2, g4, ip=ipv4), \
+ \
+ encap_route(m2, vrf_None, 1, "gre2", ip=ipv6), \
+ gre(sw, d, vrf_o,
+ tos="inherit",
+ local_ip="1.2.3.4",
+ remote_ip="1.2.3.5",
+ ikey=2222, okey=1111) as g6, \
+ encap_route(sw, vrf_o, 2, g6, ip=ipv6):
+
+ sleep(15)
+ ping_test(tl, m1, sw, ipv6(test_ip(2, 33, [])), m1_if1, g6,
+ count=25, ipv6=True)
+ ping_test(tl, m1, sw, ipv4(test_ip(2, 33, [])), m1_if1, g4,
+ count=25, fail_expected=True)
+
+ sw.run("ip t change name %s local 1.2.3.4" % g4.get_devname())
+
+ sleep(5)
+ ping_test(tl, m1, sw, ipv6(test_ip(2, 33, [])), m1_if1, g6,
+ ipv6=True, require_fastpath=False)
+ ping_test(tl, m1, sw, ipv4(test_ip(2, 33, [])), m1_if1, g4,
+ require_fastpath=False)
+
logging.info("--- ikey change")
with encap_route(m2, vrf_None, 1, "gre2", ip=ipv4), \
encap_route(m2, vrf_None, 1, "gre2", ip=ipv6), \
--
2.4.11