On Tue, Aug 21, 2018 at 02:11:07PM +0200, csfakian(a)redhat.com wrote:
From: Christos Sfakianakis <csfakian(a)redhat.com>
Adding ported recipe ActiveBackupDoubleBondRecipe, implementing
old regression_tests/phase1/active_backup_double_bond.xml. Its
structure is based on previously ported SimplePerfRecipe.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
.../ENRT/ActiveBackupDoubleBondRecipe.py | 67 +++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 lnst/Recipes/ENRT/ActiveBackupDoubleBondRecipe.py
diff --git a/lnst/Recipes/ENRT/ActiveBackupDoubleBondRecipe.py
b/lnst/Recipes/ENRT/ActiveBackupDoubleBondRecipe.py
new file mode 100644
index 0000000..172b800
--- /dev/null
+++ b/lnst/Recipes/ENRT/ActiveBackupDoubleBondRecipe.py
@@ -0,0 +1,67 @@
+"""
+Implements scenario similar to regression_tests/phase1/
+(active_backup_double_bond.xml + bonding_test.py).
+"""
+from lnst.Common.Parameters import Param
+from lnst.Common.IpAddress import ipaddress
+from lnst.Controller import HostReq, DeviceReq
+from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration
+from lnst.Devices import BondDevice
+
+class ActiveBackupDoubleBondRecipe(BaseEnrtRecipe):
+ m1 = HostReq()
+ m1.eth0 = DeviceReq(label="net1")
+ m1.eth1 = DeviceReq(label="net1")
+
+ m2 = HostReq()
+ m2.eth0 = DeviceReq(label="net1")
+ m2.eth1 = DeviceReq(label="net1")
+
+ offload_combinations = Param(default=(
+ dict(gro="on", gso="on", tso="on",
tx="on"),
+ dict(gro="off", gso="on", tso="on",
tx="on"),
+ dict(gro="on", gso="off", tso="off",
tx="on"),
+ dict(gro="on", gso="on", tso="off",
tx="off")))
+
+ def test_wide_configuration(self):
+ m1, m2 = self.matched.m1, self.matched.m2
+
+ for i, m in [(1, m1),(2, m2)]:
^^^^
you can just use enumerate(self.matched) or enumarate([m1, m2]) for this.
+ m.bond = BondDevice(mode="active-backup",
name="bond_m"+str(i))
is the name="bond" necessary? doesn't it get autogenerated?
> + m.eth0.down()
> + m.eth1.down()
> + m.bond.slave_add(m.eth0)
> + m.bond.slave_add(m.eth1)
> +
> + configuration = EnrtConfiguration()
> + configuration.endpoint1 = m1.bond
> + configuration.endpoint2 = m2.bond
> +
> + if "mtu" in self.params:
> + m1.bond.mtu = self.params.mtu
> + m2.bond.mtu = self.params.mtu
> +
> + net_addr = "192.168.101"
> + net_addr6 = "fc00:0:0:0"
> + for i, m in [(1, m1),(2, m2)]:
> + m.bond.ip_add(ipaddress(net_addr + "." + str(i) +
"/24"))
> + m.bond.ip_add(ipaddress(net_addr6 + "::" + str(i) +
"/64"))
> + m.eth0.up()
> + m.eth1.up()
> + m.bond.up()
> +
> + #TODO better service handling through HostAPI
> + m1.run("service irqbalance stop")
> + m2.run("service irqbalance stop")
> + for m in self.matched:
> + for dev in m.devices:
> + self._pin_dev_interrupts(dev, self.params.dev_intr_cpu)
> +
> + return configuration
> +
> + def test_wide_deconfiguration(self, config):
> + m1, m2 = self.matched.m1, self.matched.m2
> +
> + #TODO better service handling through HostAPI
> + m1.run("service irqbalance start")
> + m2.run("service irqbalance start")
> --
> 2.17.1
> _______________________________________________
> LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
> Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedoraproject.org/archives/list/lnst-developers@lists.fedor...