Skip to content

Commit

Permalink
Recipes/ENRT/VlansOverBondRecipe.py: use BondingMixin
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Tluka <[email protected]>
  • Loading branch information
jtluka committed Sep 30, 2024
1 parent ea9c4c5 commit afbd29c
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions lnst/Recipes/ENRT/VlansOverBondRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from lnst.Common.Parameters import (
Param,
IntParam,
StrParam,
IPv4NetworkParam,
IPv6NetworkParam,
)
Expand All @@ -18,14 +17,14 @@
CommonHWSubConfigMixin)
from lnst.Recipes.ENRT.ConfigMixins.PerfReversibleFlowMixin import (
PerfReversibleFlowMixin)
from lnst.Recipes.ENRT.BondingMixin import BondingMixin
from lnst.Devices import VlanDevice
from lnst.Devices.VlanDevice import VlanDevice as Vlan
from lnst.Devices import BondDevice
from lnst.Devices import RemoteDevice
from lnst.Recipes.ENRT.PingMixins import VlanPingEvaluatorMixin
from lnst.RecipeCommon.Ping.PingEndpoints import PingEndpoints

class VlansOverBondRecipe(PerfReversibleFlowMixin, VlanPingEvaluatorMixin,
class VlansOverBondRecipe(BondingMixin, PerfReversibleFlowMixin, VlanPingEvaluatorMixin,
CommonHWSubConfigMixin, OffloadSubConfigMixin,
BaremetalEnrtRecipe):
r"""
Expand All @@ -51,16 +50,9 @@ class VlansOverBondRecipe(PerfReversibleFlowMixin, VlanPingEvaluatorMixin,
| host1 | | host2 |
'------------------------' '---------------------'
The recipe provides additional recipe parameters to configure the bonding
Refer to :any:`BondingMixin` for parameters to configure the bonding
device.
:param bonding_mode:
(mandatory test parameter) the bonding mode to be configured on
the bond0 device
:param miimon_value:
(mandatory test parameter) the miimon interval to be configured
on the bond0 device
All sub configurations are included via Mixin classes.
The actual test machinery is implemented in the :any:`BaseEnrtRecipe` class.
Expand Down Expand Up @@ -91,9 +83,6 @@ class VlansOverBondRecipe(PerfReversibleFlowMixin, VlanPingEvaluatorMixin,
vlan2_ipv4 = IPv4NetworkParam(default="192.168.30.0/24")
vlan2_ipv6 = IPv6NetworkParam(default="fc00:0:0:3::/64")

bonding_mode = StrParam(mandatory=True)
miimon_value = IntParam(mandatory=True)

def test_wide_configuration(self):
"""
Test wide configuration for this recipe involves creating one bonding
Expand All @@ -118,11 +107,14 @@ def test_wide_configuration(self):
host1, host2 = self.matched.host1, self.matched.host2
config = super().test_wide_configuration()

host1.bond0 = BondDevice(mode=self.params.bonding_mode,
miimon=self.params.miimon_value)
for dev in [host1.eth0, host1.eth1]:
dev.down()
host1.bond0.slave_add(dev)
self.create_bond_devices(
{
"host1":
{
"bond0": [host1.eth0, host1.eth1]
}
}
)

host1.vlan0 = VlanDevice(realdev=host1.bond0, vlan_id=self.params.vlan0_id)
host1.vlan1 = VlanDevice(realdev=host1.bond0, vlan_id=self.params.vlan1_id)
Expand Down Expand Up @@ -201,6 +193,12 @@ def generate_test_wide_description(self, config: EnrtConfiguration):
host1.bond0.miimon
)
]

if self.params.bonding_mode in ["active-backup", "1"]:
desc += ["Configured {}.{}.fail_over_mac = {}".format(
host1.hostid, host1.bond0.name,
host1.bond0.fail_over_mac
)]
return desc

def generate_ping_endpoints(self, config):
Expand Down

0 comments on commit afbd29c

Please sign in to comment.