From: Christos Sfakianakis csfakian@redhat.com
Add ported recipe TeamRecipe, implementing old regression_tests/ phase2/{active_backup,round_robin}_team.xml. Its structure is based on previously ported SimplePerfRecipe.
Signed-off-by: Christos Sfakianakis csfakian@redhat.com --- lnst/Recipes/ENRT/TeamRecipe.py | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lnst/Recipes/ENRT/TeamRecipe.py
diff --git a/lnst/Recipes/ENRT/TeamRecipe.py b/lnst/Recipes/ENRT/TeamRecipe.py new file mode 100644 index 0000000..6173ec6 --- /dev/null +++ b/lnst/Recipes/ENRT/TeamRecipe.py @@ -0,0 +1,74 @@ +""" +Implements scenario similar to regression_tests/phase2/ +({active_backup,round_robin}_team.xml + team_test.py) +""" +from lnst.Common.Parameters import Param, IntParam, StrParam +from lnst.Common.IpAddress import ipaddress +from lnst.Controller import HostReq, DeviceReq +from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe, EnrtConfiguration +from lnst.Devices import TeamDevice + +class TeamRecipe(BaseEnrtRecipe): + m1 = HostReq() + m1.eth1 = DeviceReq(label="tnet") + m1.eth2 = DeviceReq(label="tnet") + + m2 = HostReq() + m2.eth1 = DeviceReq(label="tnet") + + 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"))) + + runner_name = StrParam(mandatory=True) + + def test_wide_configuration(self): + m1, m2 = self.matched.m1, self.matched.m2 + + m1.eth1.down() + m1.eth2.down() + #The config argument needs to be used with a team device normally (e.g to specify + #the runner mode), but it is not used here due to a bug in the TeamDevice module + m1.team = TeamDevice() + m1.team.slave_add(m1.eth1) + m1.team.slave_add(m1.eth2) + + #EnrtConfiguration and both-side Netperf config need to be checked + configuration = EnrtConfiguration() + configuration.endpoint1 = m1.team + configuration.endpoint2 = m2.eth1 + + if "mtu" in self.params: + m1.team.mtu = self.params.mtu + m2.eth1.mtu = self.params.mtu + + net_addr_1 = "192.168.10" + net_addr6_1 = "fc00:0:0:1" + + m1.team.ip_add(ipaddress(net_addr_1 + ".1/24")) + m1.team.ip_add(ipaddress(net_addr6_1 + "::1/64")) + m2.eth1.ip_add(ipaddress(net_addr_1 + ".2/24")) + m2.eth1.ip_add(ipaddress(net_addr6_1 + "::2/64")) + + m1.eth1.up() + m1.eth2.up() + m1.team.up() + m2.eth1.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")