From: Christos Sfakianakis <csfakian(a)redhat.com>
Adding ported recipe VirtualBridgeVlanInGuestRecipe, implementing
old regression_tests/phase1/virtual_bridge_vlan_in_guest.xml. Its
structure is based on previously ported SimplePerfRecipe. Due to
limitations in the current EnrtConfiguration class, a single vlan
test pair is chosen.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
.../ENRT/VirtualBridgeVlanInGuestRecipe.py | 90 +++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 lnst/Recipes/ENRT/VirtualBridgeVlanInGuestRecipe.py
diff --git a/lnst/Recipes/ENRT/VirtualBridgeVlanInGuestRecipe.py
b/lnst/Recipes/ENRT/VirtualBridgeVlanInGuestRecipe.py
new file mode 100644
index 0000000..0403d50
--- /dev/null
+++ b/lnst/Recipes/ENRT/VirtualBridgeVlanInGuestRecipe.py
@@ -0,0 +1,90 @@
+"""
+Implements scenario similar to regression_tests/phase1/
+(virtual_bridge_vlan_in_guest.xml + virtual_bridge_vlan_in_guest.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 VlanDevice
+from lnst.Devices import BridgeDevice
+
+class VirtualBridgeVlanInGuestRecipe(BaseEnrtRecipe):
+ m1 = HostReq()
+ m1.nic = DeviceReq(label="to_switch")
+ m1.tap = DeviceReq(label="to_guest")
+
+ m2 = HostReq()
+ m2.nic = DeviceReq(label="to_switch")
+
+ m3 = HostReq()
+ m3.guestnic = DeviceReq(label="to_guest")
+
+ offload_combinations = Param(default=(
+ dict(gro="on", gso="on", tso="on",
tx="on", rx="on"),
+ dict(gro="off", gso="on", tso="on",
tx="on", rx="on"),
+ dict(gro="on", gso="off", tso="off",
tx="on", rx="on"),
+ dict(gro="on", gso="on", tso="off",
tx="off", rx="on"),
+ dict(gro="on", gso="on", tso="on",
tx="on", rx="off")))
+
+ def test_wide_configuration(self):
+ m1, m2, m3 = self.matched.m1, self.matched.m2, self.matched.m3
+
+ m1.nic.down()
+ m1.tap.down()
+ m1.br0 = BridgeDevice()
+ m1.br0.slave_add(m1.nic)
+ m1.br0.slave_add(m1.tap)
+
+ m2.nic.down()
+ m2.vlan1 = VlanDevice(realdev=m2.nic, vlan_id=10)
+
+ m3.guestnic.down()
+ m3.vlan1 = VlanDevice(realdev=m3.guestnic, vlan_id=10)
+
+ #Due to limitations in the current EnrtConfiguration
+ #class, a single vlan test pair is chosen
+ configuration = EnrtConfiguration()
+ configuration.endpoint1 = m3.vlan1
+ configuration.endpoint2 = m2.vlan1
+
+ if "mtu" in self.params:
+ m1.br0.mtu = self.params.mtu
+ m2.vlan1.mtu = self.params.mtu
+ m3.vlan1.mtu = self.params.mtu
+
+ net_addr_1 = "192.168.10"
+ net_addr6_1 = "fc00:0:0:1"
+
+ m1.br0.ip_add(ipaddress(net_addr_1 + ".1/24"))
+ m2.vlan1.ip_add(ipaddress(net_addr_1 + ".2/24"))
+ m2.vlan1.ip_add(ipaddress(net_addr6_1 + "::2/64"))
+ m3.vlan1.ip_add(ipaddress(net_addr_1 + ".3/24"))
+ m3.vlan1.ip_add(ipaddress(net_addr6_1 + "::3/64"))
+
+ m1.nic.up()
+ m1.tap.up()
+ m1.br0.up()
+ m2.nic.up()
+ m2.vlan1.up()
+ m3.guestnic.up()
+ m3.vlan1.up()
+
+ #TODO better service handling through HostAPI
+ m1.run("service irqbalance stop")
+ m2.run("service irqbalance stop")
+ m3.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, m3 = self.matched.m1, self.matched.m2, self.matched.m3
+
+ #TODO better service handling through HostAPI
+ m1.run("service irqbalance start")
+ m2.run("service irqbalance start")
+ m3.run("service irqbalance start")
--
2.17.1