From: Christos Sfakianakis <csfakian(a)redhat.com>
Add ported recipe VirtualBridgeVlanInHostRecipe, implementing old
regression_tests/phase1/virtual_bridge_vlan_in_host.xml. Its
structure is based on previously ported SimplePerfRecipe.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
.../ENRT/VirtualBridgeVlanInHostRecipe.py | 88 +++++++++++++++++++
1 file changed, 88 insertions(+)
create mode 100644 lnst/Recipes/ENRT/VirtualBridgeVlanInHostRecipe.py
diff --git a/lnst/Recipes/ENRT/VirtualBridgeVlanInHostRecipe.py
b/lnst/Recipes/ENRT/VirtualBridgeVlanInHostRecipe.py
new file mode 100644
index 0000000..ada9408
--- /dev/null
+++ b/lnst/Recipes/ENRT/VirtualBridgeVlanInHostRecipe.py
@@ -0,0 +1,88 @@
+"""
+Implements scenario similar to regression_tests/phase1/
+(virtual_bridge_vlan_in_host.xml + virtual_bridge_vlan_in_host.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 VirtualBridgeVlanInHostRecipe(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.vlan1 = VlanDevice(realdev=m1.nic, vlan_id=10)
+ m1.br0 = BridgeDevice()
+ m1.br0.slave_add(m1.vlan1)
+ m1.br0.slave_add(m1.tap)
+
+ m2.nic.down()
+ m2.vlan1 = VlanDevice(realdev=m2.nic, vlan_id=10)
+
+ m3.guestnic.down()
+
+ configuration = EnrtConfiguration()
+ configuration.endpoint1 = m3.guestnic
+ configuration.endpoint2 = m2.vlan1
+
+ if "mtu" in self.params:
+ m1.br0.mtu = self.params.mtu
+ m2.vlan1.mtu = self.params.mtu
+ m3.guestnic.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.guestnic.ip_add(ipaddress(net_addr_1 + ".3/24"))
+ m3.guestnic.ip_add(ipaddress(net_addr6_1 + "::3/64"))
+
+ m1.nic.up()
+ m1.tap.up()
+ m1.vlan1.up()
+ m1.br0.up()
+ m2.nic.up()
+ m2.vlan1.up()
+ m3.guestnic.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
_______________________________________________
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...
These VirtualBridge* are ok except for the naming used. It directly
follows the ids that we've used in the old xmls but here I think it
could be improved.
Instead of having m1, m2, m3, m4. host1, guest1, host2, guest2 would be
easier to understand.
Also the guestnic/nic/tap should just be replaced with eth0 to be
consistent with the previous recipes. It should be obvious which eth is
using which driver based on either a driver parameter that we'll add
later or based on the topology described by the "label" attributes.
-Ondrej