Skip to content

Commit

Permalink
TeamRecipe.py: Add docs
Browse files Browse the repository at this point in the history
Added docstrings and sphinx configs.

Signed-off-by: Perry Gagne <pgagne@redhat.com>
Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
  • Loading branch information
pgagne authored and olichtne committed Sep 23, 2020
1 parent fa4b247 commit d84cdd6
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/specific_scenarios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ Specific ENRT scenarios

.. toctree::
simple_network_recipe
team_recipe
vlans_recipe
vlans_over_bond_recipe
6 changes: 6 additions & 0 deletions docs/source/team_recipe.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TeamRecipe
^^^^^^^^^^^^^^^^^^^

.. autoclass:: lnst.Recipes.ENRT.TeamRecipe.TeamRecipe
:members:
:show-inheritance:
125 changes: 125 additions & 0 deletions lnst/Recipes/ENRT/TeamRecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,38 @@

class TeamRecipe(PerfReversibleFlowMixin, CommonHWSubConfigMixin, OffloadSubConfigMixin,
BaseEnrtRecipe):
"""
This recipe implements Enrt testing for a network scenario that looks
as follows
.. code-block:: none
.--------.
.----------------+ |
| .-------+ switch +-------.
| | '--------' |
.-------------------. |
| | team0 | | |
| .---'--. .---'--. | .---'--.
.----|-| eth0 |-| eth1 |-|----. .----| eth0 |----.
| | '------' '------' | | | '------' |
| '-------------------' | | |
| | | |
| host1 | | host2 |
'-----------------------------' '----------------'
The recipe provides additional recipe parameters to configure the teaming
device.
:param runner_name:
(mandatory test parameter) the teamd runner to be use on
the team0 device (ex. `activebackup`, `roundrobin`, etc)
All sub configurations are included via Mixin classes.
The actual test machinery is implemented in the :any:`BaseEnrtRecipe` class.
"""
host1 = HostReq()
host1.eth0 = DeviceReq(label="tnet", driver=RecipeParam("driver"))
host1.eth1 = DeviceReq(label="tnet", driver=RecipeParam("driver"))
Expand All @@ -30,6 +62,16 @@ class TeamRecipe(PerfReversibleFlowMixin, CommonHWSubConfigMixin, OffloadSubConf
runner_name = StrParam(mandatory=True)

def test_wide_configuration(self):
"""
Test wide configuration for this recipe involves creating a team
device using the two matched physical devices as ports on host1.
The `teamd` daemon is configured with the `runner_name` according
to the recipe parameters. IPv4 and IPv6 addresses are added to
the teaming device and to the matched ethernet device on host2.
| host1.team0 = 192.168.10.1/24 and fc00:0:0:1::1/64
| host2.eth0 = 192.168.10.2/24 and fc00:0:0:1::2/64
"""
host1, host2 = self.matched.host1, self.matched.host2

teamd_config = {'runner': {'name': self.params.runner_name}}
Expand All @@ -56,6 +98,10 @@ def test_wide_configuration(self):
return configuration

def generate_test_wide_description(self, config):
"""
Test wide description is extended with the configured IP addresses, the
configured team device ports, and runner name.
"""
host1, host2 = self.matched.host1, self.matched.host2
desc = super().generate_test_wide_description(config)
desc += [
Expand Down Expand Up @@ -83,33 +129,112 @@ def test_wide_deconfiguration(self, config):
super().test_wide_deconfiguration(config)

def generate_ping_endpoints(self, config):
"""
The ping endpoints for this recipe are the configured team device on
host1 and the matched ethernet device on host2.
Returned as::
[PingEndpoints(self.matched.host1.team0, self.matched.host2.eth0),
PingEndpoints(self.matched.host2.eth0, self.matched.host1.team0)]
"""
return [
PingEndpoints(self.matched.host1.team0, self.matched.host2.eth0),
PingEndpoints(self.matched.host2.eth0, self.matched.host1.team0)
]

def generate_perf_endpoints(self, config):
"""
The perf endpoints for this recipe are the configured team device on
host1 and the matched ethernet device on host2. The traffic egresses
the team device.
| host1.team0
| host2.eth0
Returned as::
[(self.matched.host1.team0, self.matched.host2.eth0)]
"""
return [(self.matched.host1.team0, self.matched.host2.eth0)]

@property
def offload_nics(self):
"""
The `offload_nics` property value for this scenario is a list containing
the configured team device on host1 and the matched ethernet device
on host2.
| host1.team0
| host2.eth0
For detailed explanation of this property see :any:`OffloadSubConfigMixin`
class and :any:`OffloadSubConfigMixin.offload_nics`.
"""
return [self.matched.host1.team0, self.matched.host2.eth0]

@property
def mtu_hw_config_dev_list(self):
"""
The `mtu_hw_config_dev_list` property value for this scenario is a list
containing the configured teaming device on host1 and the matched ethernet
device on host2.
| host1.team0
| host2.eth0
For detailed explanation of this property see :any:`MTUHWConfigMixin`
class and :any:`MTUHWConfigMixin.mtu_hw_config_dev_list`.
"""
return [self.matched.host1.team0, self.matched.host2.eth0]

@property
def coalescing_hw_config_dev_list(self):
"""
The `coalescing_hw_config_dev_list` property value for this scenario is a
list containing the matched physical devices used to create the teaming
device on host1 and the matched ethernet device on host2.
| host1.eth0, host.eth1
| host2.eth0
For detailed explanation of this property see :any:`CoalescingHWConfigMixin`
class and :any:`CoalescingHWConfigMixin.coalescing_hw_config_dev_list`.
"""
host1, host2 = self.matched.host1, self.matched.host2
return [host1.eth0, host1.eth1, host2.eth0]

@property
def dev_interrupt_hw_config_dev_list(self):
"""
The `dev_interrupt_hw_config_dev_list` property value for this scenario
is a list containing the matched physical devices used to create the
teaming device on host1 and the matched ethernet device on host2.
| host1.eth0, host1.eth1
| host2.eth0
For detailed explanation of this property see
:any:`DevInterruptHWConfigMixin` class and
:any:`DevInterruptHWConfigMixin.dev_interrupt_hw_config_dev_list`.
"""
host1, host2 = self.matched.host1, self.matched.host2
return [host1.eth0, host1.eth1, host2.eth0]

@property
def parallel_stream_qdisc_hw_config_dev_list(self):
"""
The `parallel_stream_qdisc_hw_config_dev_list` property value for this
scenario is a list containing the matched physical devices used to create
the teaming device on host1 and the matched ethernet device on host2.
| host1.eth0, host.eth1
| host2.eth0
For detailed explanation of this property see
:any:`ParallelStreamQDiscHWConfigMixin` class and
:any:`ParallelStreamQDiscHWConfigMixin.parallel_stream_qdisc_hw_config_dev_list`.
"""
host1, host2 = self.matched.host1, self.matched.host2
return [host1.eth0, host1.eth1, host2.eth0]

0 comments on commit d84cdd6

Please sign in to comment.