From: Ido Schimmel <idosch(a)mellanox.com>
Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
Signed-off-by: Yuval Mintz <yuvalm(a)mellanox.com>
---
recipes/switchdev/ecmp_common.py | 10 ++++++++++
recipes/switchdev/l3-000-minimal.py | 6 ++++++
recipes/switchdev/l3-001-router-port.py | 6 ++++++
recipes/switchdev/l3-002-vlan-interface.py | 6 ++++++
recipes/switchdev/l3-003-bond-interface.py | 6 ++++++
recipes/switchdev/l3-004-team-interface.py | 6 ++++++
recipes/switchdev/l3-005-ecmp-basic.py | 10 +---------
recipes/switchdev/l3-007-ecmp-maxsize.py | 10 +---------
recipes/switchdev/l3-009-1q_bridge_rif.py | 7 +++++++
recipes/switchdev/l3-010-1d_bridge_rif.py | 7 +++++++
10 files changed, 56 insertions(+), 18 deletions(-)
diff --git a/recipes/switchdev/ecmp_common.py b/recipes/switchdev/ecmp_common.py
index 8d7bccb..f05ec86 100644
--- a/recipes/switchdev/ecmp_common.py
+++ b/recipes/switchdev/ecmp_common.py
@@ -14,6 +14,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def test_traffic(tl, from_if, to_if, ecmp_in_if, ecmp_ifaces, expected = 1.,
errmsg = "ecmp traffic"):
reciever_thresh = 0.9 * PKTGEN_ROUNDS * PKTGEN_COUNT * expected
@@ -105,3 +108,10 @@ def create_topology(from_if, ecmp_in_if, ecmp_tx_ifaces,
ecmp_rx_ifaces,
ecmp_out_if.add_nhs_route(ipv4(test_ip(1,0)),
[str(i.get_ip(0)) for i in ecmp_tx_ifaces])
to_if.add_nhs_route(ipv4(test_ip(1,0)), [str(ecmp_out_if.get_ip(0))])
+
+ from_if.add_nhs_route(ipv6(test_ip(2,0)), [str(ecmp_in_if.get_ip(1))])
+ ecmp_in_if.add_nhs_route(ipv6(test_ip(2,0)),
+ [str(ipv6(nh_addr)) for nh_addr in nh_addrs])
+ ecmp_out_if.add_nhs_route(ipv6(test_ip(1,0)),
+ [str(i.get_ip(1)) for i in ecmp_tx_ifaces])
+ to_if.add_nhs_route(ipv6(test_ip(1,0)), [str(ecmp_out_if.get_ip(1))])
diff --git a/recipes/switchdev/l3-000-minimal.py b/recipes/switchdev/l3-000-minimal.py
index f2a9b2c..c56eff8 100644
--- a/recipes/switchdev/l3-000-minimal.py
+++ b/recipes/switchdev/l3-000-minimal.py
@@ -21,6 +21,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
@@ -34,6 +37,9 @@ def do_task(ctl, hosts, ifaces, aliases):
m1_if1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
m2_if1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);
+ m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
+ m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);
+
sleep(30)
tl = TestLib(ctl, aliases)
diff --git a/recipes/switchdev/l3-001-router-port.py
b/recipes/switchdev/l3-001-router-port.py
index 18038c4..021cb13 100644
--- a/recipes/switchdev/l3-001-router-port.py
+++ b/recipes/switchdev/l3-001-router-port.py
@@ -21,6 +21,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
@@ -34,6 +37,9 @@ def do_task(ctl, hosts, ifaces, aliases):
m1_if1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
m2_if1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);
+ m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
+ m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);
+
sleep(30)
tl = TestLib(ctl, aliases)
diff --git a/recipes/switchdev/l3-002-vlan-interface.py
b/recipes/switchdev/l3-002-vlan-interface.py
index 3fb6398..d52dee2 100644
--- a/recipes/switchdev/l3-002-vlan-interface.py
+++ b/recipes/switchdev/l3-002-vlan-interface.py
@@ -21,6 +21,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
@@ -37,6 +40,9 @@ def do_task(ctl, hosts, ifaces, aliases):
m1_if1_10.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
m2_if1_10.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);
+ m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
+ m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);
+
sleep(30)
tl = TestLib(ctl, aliases)
diff --git a/recipes/switchdev/l3-003-bond-interface.py
b/recipes/switchdev/l3-003-bond-interface.py
index 9538897..edf87ff 100644
--- a/recipes/switchdev/l3-003-bond-interface.py
+++ b/recipes/switchdev/l3-003-bond-interface.py
@@ -21,6 +21,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
@@ -34,6 +37,9 @@ def do_task(ctl, hosts, ifaces, aliases):
m1_lag1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
m2_lag1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);
+ m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
+ m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);
+
sw_lag1 = sw.create_bond(slaves=[sw_if1, sw_if2], options=bond_options,
ip=test_ip(1,2))
sw_lag2 = sw.create_bond(slaves=[sw_if3, sw_if4], options=bond_options,
diff --git a/recipes/switchdev/l3-004-team-interface.py
b/recipes/switchdev/l3-004-team-interface.py
index efc255d..77605d3 100644
--- a/recipes/switchdev/l3-004-team-interface.py
+++ b/recipes/switchdev/l3-004-team-interface.py
@@ -21,6 +21,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
@@ -34,6 +37,9 @@ def do_task(ctl, hosts, ifaces, aliases):
m1_lag1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
m2_lag1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);
+ m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
+ m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);
+
sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config,
ip=test_ip(1,2))
sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config,
diff --git a/recipes/switchdev/l3-005-ecmp-basic.py
b/recipes/switchdev/l3-005-ecmp-basic.py
index 2ccce1a..bcccfc5 100644
--- a/recipes/switchdev/l3-005-ecmp-basic.py
+++ b/recipes/switchdev/l3-005-ecmp-basic.py
@@ -13,15 +13,6 @@ from TestLib import TestLib
from time import sleep
import ecmp_common
-def test_ip(major, minor, prefix=[24,64]):
- return ["192.168.1%d.%d%s" % (major, minor,
- "/" + str(prefix[0]) if len(prefix) > 0 else ""),
- "2002:%d::%d%s" % (major, minor,
- "/" + str(prefix[1]) if len(prefix) > 1 else "")]
-
-def ipv4(test_ip):
- return test_ip[0]
-
def do_task(ctl, hosts, ifaces, aliases):
m1, sw, m2 = hosts
m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces
@@ -30,6 +21,7 @@ def do_task(ctl, hosts, ifaces, aliases):
ecmp_m_ifaces = [m2_if1, m2_if2]
m2.config("/proc/sys/net/ipv4/ip_forward", "1")
+ m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")
ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
m2_if3, m3_if1)
diff --git a/recipes/switchdev/l3-007-ecmp-maxsize.py
b/recipes/switchdev/l3-007-ecmp-maxsize.py
index 5936c5e..794030e 100644
--- a/recipes/switchdev/l3-007-ecmp-maxsize.py
+++ b/recipes/switchdev/l3-007-ecmp-maxsize.py
@@ -16,15 +16,6 @@ import ecmp_common
MAX_NEXTHOPS = 32
-def test_ip(major, minor, prefix=[24,64]):
- return ["192.168.1%d.%d%s" % (major, minor,
- "/" + str(prefix[0]) if len(prefix) > 0 else ""),
- "2002:%d::%d%s" % (major, minor,
- "/" + str(prefix[1]) if len(prefix) > 1 else "")]
-
-def ipv4(test_ip):
- return test_ip[0]
-
def do_task(ctl, hosts, ifaces, aliases):
m1, sw, m2 = hosts
m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces
@@ -33,6 +24,7 @@ def do_task(ctl, hosts, ifaces, aliases):
ecmp_m_ifaces = [m2_if1, m2_if2]
m2.config("/proc/sys/net/ipv4/ip_forward", "1")
+ m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")
ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
m2_if3, m3_if1, num_nexthops = MAX_NEXTHOPS)
diff --git a/recipes/switchdev/l3-009-1q_bridge_rif.py
b/recipes/switchdev/l3-009-1q_bridge_rif.py
index 5acff45..4d44fe2 100644
--- a/recipes/switchdev/l3-009-1q_bridge_rif.py
+++ b/recipes/switchdev/l3-009-1q_bridge_rif.py
@@ -29,6 +29,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
"""
Create the following topology:
@@ -85,6 +88,10 @@ def do_task(ctl, hosts, ifaces, aliases):
m2_if1.add_nhs_route(ipv4(test_ip(2, 0)), [str(sw_br_v10.get_ip(0))])
m3_if1.add_nhs_route(ipv4(test_ip(1, 0)), [str(sw_if2.get_ip(0))])
+ m1_if1.add_nhs_route(ipv6(test_ip(2, 0)), [str(sw_br_v10.get_ip(1))], ipv6=True)
+ m2_if1.add_nhs_route(ipv6(test_ip(2, 0)), [str(sw_br_v10.get_ip(1))], ipv6=True)
+ m3_if1.add_nhs_route(ipv6(test_ip(1, 0)), [str(sw_if2.get_ip(1))], ipv6=True)
+
sleep(30)
tl = TestLib(ctl, aliases)
tl.ping_simple(m2_if1_v10, m1_if1_v10)
diff --git a/recipes/switchdev/l3-010-1d_bridge_rif.py
b/recipes/switchdev/l3-010-1d_bridge_rif.py
index 38c3d9e..1894ffb 100644
--- a/recipes/switchdev/l3-010-1d_bridge_rif.py
+++ b/recipes/switchdev/l3-010-1d_bridge_rif.py
@@ -29,6 +29,9 @@ def test_ip(major, minor, prefix=[24,64]):
def ipv4(test_ip):
return test_ip[0]
+def ipv6(test_ip):
+ return test_ip[1]
+
def do_task(ctl, hosts, ifaces, aliases):
"""
Create the following topology:
@@ -84,6 +87,10 @@ def do_task(ctl, hosts, ifaces, aliases):
m2_if1.add_nhs_route(ipv4(test_ip(2, 0)), [str(sw_br.get_ip(0))])
m3_if1.add_nhs_route(ipv4(test_ip(1, 0)), [str(sw_if2.get_ip(0))])
+ m1_if1.add_nhs_route(ipv6(test_ip(2, 0)), [str(sw_br.get_ip(1))])
+ m2_if1.add_nhs_route(ipv6(test_ip(2, 0)), [str(sw_br.get_ip(1))])
+ m3_if1.add_nhs_route(ipv6(test_ip(1, 0)), [str(sw_if2.get_ip(1))])
+
sleep(30)
tl = TestLib(ctl, aliases)
tl.ping_simple(m2_if1_v10, m1_if1_v10)
--
2.4.3