Skip to content

Commit

Permalink
Recipes/ENRT: call test_wide_configuration before creating devices
Browse files Browse the repository at this point in the history
To properly use the UseVfsMixin, the test_wide_configuration must be
called before creating any devices, otherwise the PFs could be used as
parent device for e.g. Bond or VlanDevice instead of VFs.

Signed-off-by: Jan Tluka <[email protected]>
  • Loading branch information
jtluka committed Sep 3, 2024
1 parent a87cb8a commit 0abffb6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lnst/Recipes/ENRT/BondRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ 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)
config = super().test_wide_configuration()

for dev in [host1.eth0, host1.eth1]:
dev.down()
Expand Down
3 changes: 1 addition & 2 deletions lnst/Recipes/ENRT/TeamRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ def test_wide_configuration(self):
| host2.eth0 = 192.168.10.2/24 and fc00:0:0:1::2/64
"""
host1, host2 = self.matched.host1, self.matched.host2
config = super().test_wide_configuration()

teamd_config = {'runner': {'name': self.params.runner_name}}
host1.team0 = TeamDevice(config=teamd_config)

config = super().test_wide_configuration()

for dev in [host1.eth0, host1.eth1]:
dev.down()
host1.team0.slave_add(dev)
Expand Down
3 changes: 1 addition & 2 deletions lnst/Recipes/ENRT/TeamVsBondRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ class TeamVsBondRecipe(PerfReversibleFlowMixin, CommonHWSubConfigMixin,

def test_wide_configuration(self):
host1, host2 = self.matched.host1, self.matched.host2
config = super().test_wide_configuration()

host1.team0 = TeamDevice(config={'runner': {'name': self.params.runner_name}})

host2.bond0 = BondDevice(mode=self.params.bonding_mode,
miimon=self.params.miimon_value)

config = super().test_wide_configuration()
ipv4_addr = interface_addresses(self.params.net_ipv4)
ipv6_addr = interface_addresses(self.params.net_ipv6)

Expand Down
2 changes: 1 addition & 1 deletion lnst/Recipes/ENRT/VlansOverBondRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_wide_configuration(self):
| host2.vlan2 = 192.168.30.2/24 and fc00:0:0:3::2/64
"""
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)
Expand All @@ -129,7 +130,6 @@ def test_wide_configuration(self):
host2.vlan1 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan1_id)
host2.vlan2 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan2_id)

config = super().test_wide_configuration()
config.track_device(host1.bond0)

vlan0_ipv4_addr = interface_addresses(self.params.vlan0_ipv4)
Expand Down
2 changes: 1 addition & 1 deletion lnst/Recipes/ENRT/VlansOverTeamRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class VlansOverTeamRecipe(PerfReversibleFlowMixin, VlanPingEvaluatorMixin,

def test_wide_configuration(self):
host1, host2 = self.matched.host1, self.matched.host2
config = super().test_wide_configuration()

host1.team0 = TeamDevice(config={'runner': {'name': self.params.runner_name}})
for dev in [host1.eth0, host1.eth1]:
Expand All @@ -71,7 +72,6 @@ def test_wide_configuration(self):
host2.vlan1 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan1_id)
host2.vlan2 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan2_id)

config = super().test_wide_configuration()
config.track_device(host1.team0)

vlan0_ipv4_addr = interface_addresses(self.params.vlan0_ipv4)
Expand Down
3 changes: 1 addition & 2 deletions lnst/Recipes/ENRT/VlansRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def test_wide_configuration(self):
"""
host1, host2 = self.matched.host1, self.matched.host2
config = super().test_wide_configuration()

host1.eth0.down()
host2.eth0.down()
Expand All @@ -96,8 +97,6 @@ def test_wide_configuration(self):
host2.vlan1 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan1_id)
host2.vlan2 = VlanDevice(realdev=host2.eth0, vlan_id=self.params.vlan2_id)

config = super().test_wide_configuration()

vlan0_ipv4_addr = interface_addresses(self.params.vlan0_ipv4)
vlan0_ipv6_addr = interface_addresses(self.params.vlan0_ipv6)
vlan1_ipv4_addr = interface_addresses(self.params.vlan1_ipv4)
Expand Down
4 changes: 2 additions & 2 deletions lnst/Recipes/ENRT/VxlanMulticastRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class VxlanMulticastRecipe(CommonHWSubConfigMixin, VirtualEnrtRecipe):
vxlan_group_ip = IpParam(default="239.1.1.1", multicast=True, family=AF_INET)

def test_wide_configuration(self):
config = super().test_wide_configuration()

host1, host2, guest1 = (self.matched.host1, self.matched.host2,
self.matched.guest1)

Expand All @@ -46,8 +48,6 @@ def test_wide_configuration(self):
for machine in [guest1, host2]:
machine.vxlan0 = VxlanDevice(vxlan_id=1, realdev=machine.eth0, group=self.params.vxlan_group_ip)

config = super().test_wide_configuration()

for i, (machine, dev) in enumerate([(host1, host1.br0),
(guest1, guest1.eth0), (host2, host2.eth0)], 1):
config.configure_and_track_ip(dev, next(ipv4_addr))
Expand Down

0 comments on commit 0abffb6

Please sign in to comment.