From: Ido Schimmel <idosch(a)mellanox.com>
We should only specify two interfaces for the link negotiation recipe.
We can use 'multi-match' to test all possible matches.
Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
---
recipes/switchdev/basic-001-links.py | 23 ++++-------------------
recipes/switchdev/basic-001-links.xml | 6 ------
2 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/recipes/switchdev/basic-001-links.py b/recipes/switchdev/basic-001-links.py
index 924fdaf..4cf9726 100644
--- a/recipes/switchdev/basic-001-links.py
+++ b/recipes/switchdev/basic-001-links.py
@@ -31,35 +31,20 @@ def linkneg(tl, if1, if2):
tl.ping_simple(if1, if2)
def do_task(ctl, hosts, ifaces, aliases):
- m1, sw = hosts
- m1_if1, m1_if2, m1_if3, m1_if4, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
+ m1_if1, sw_if1 = ifaces
m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
- m1_if2.reset(ip=["192.168.102.10/24", "2003::1/64"])
- m1_if3.reset(ip=["192.168.103.10/24", "2004::1/64"])
- m1_if4.reset(ip=["192.168.104.10/24", "2005::1/64"])
sw_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])
- sw_if2.reset(ip=["192.168.102.11/24", "2003::2/64"])
- sw_if3.reset(ip=["192.168.103.11/24", "2004::2/64"])
- sw_if4.reset(ip=["192.168.104.11/24", "2005::2/64"])
sleep(30)
tl = TestLib(ctl, aliases)
- for (if1, if2) in [(sw_if1, m1_if1), (sw_if2, m1_if2), (sw_if3, m1_if3),
- (sw_if4, m1_if4)]:
- linkneg(tl, if1, if2)
- linkneg(tl, if2, if1)
+ linkneg(tl, sw_if1, m1_if1)
+ linkneg(tl, m1_if1, sw_if1)
do_task(ctl, [ctl.get_host("machine1"),
ctl.get_host("switch")],
[ctl.get_host("machine1").get_interface("if1"),
- ctl.get_host("machine1").get_interface("if2"),
- ctl.get_host("machine1").get_interface("if3"),
- ctl.get_host("machine1").get_interface("if4"),
- ctl.get_host("switch").get_interface("if1"),
- ctl.get_host("switch").get_interface("if2"),
- ctl.get_host("switch").get_interface("if3"),
- ctl.get_host("switch").get_interface("if4")],
+ ctl.get_host("switch").get_interface("if1")],
ctl.get_aliases())
diff --git a/recipes/switchdev/basic-001-links.xml
b/recipes/switchdev/basic-001-links.xml
index 1663299..79d25db 100644
--- a/recipes/switchdev/basic-001-links.xml
+++ b/recipes/switchdev/basic-001-links.xml
@@ -5,17 +5,11 @@
<params/>
<interfaces>
<eth id="if1" label="A" />
- <eth id="if2" label="B" />
- <eth id="if3" label="C" />
- <eth id="if4" label="D" />
</interfaces>
</host>
<host id="switch">
<interfaces>
<eth id="if1" label="A" />
- <eth id="if2" label="B" />
- <eth id="if3" label="C" />
- <eth id="if4" label="D" />
</interfaces>
</host>
</network>
--
2.7.4