diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 130ab3aa..ded52399 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -17,9 +17,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- pip install mypy types-setuptools black
+ pip install mypy types-setuptools black pycodestyle pydocstyle
- name: Run linters
run: |
mypy avocado_i2n
black --check --diff --color avocado_i2n
+ # only excluded checks are conflicts with black and within pycodestyle
+ # (in addition E402 is not something we intend to follow)
+ pycodestyle --ignore=E203,E402,E501,W503 avocado_i2n
+ pydocstyle avocado_i2n
diff --git a/avocado_i2n/__init__.py b/avocado_i2n/__init__.py
index e69de29b..101e57b7 100644
--- a/avocado_i2n/__init__.py
+++ b/avocado_i2n/__init__.py
@@ -0,0 +1 @@
+"""Package with the complete Avocado I2N modules and functionality."""
diff --git a/avocado_i2n/cartgraph/__init__.py b/avocado_i2n/cartgraph/__init__.py
index d77dea68..177a7a97 100644
--- a/avocado_i2n/cartgraph/__init__.py
+++ b/avocado_i2n/cartgraph/__init__.py
@@ -1,3 +1,5 @@
+"""Package for the complete Cartesian graph structure."""
+
from .object import TestObject, NetObject, VMObject, ImageObject
from .worker import TestEnvironment, TestSwarm, TestWorker
from .node import PrefixTreeNode, PrefixTree, EdgeRegister, TestNode
diff --git a/avocado_i2n/cartgraph/graph.py b/avocado_i2n/cartgraph/graph.py
index fee7e01f..5a646a7e 100644
--- a/avocado_i2n/cartgraph/graph.py
+++ b/avocado_i2n/cartgraph/graph.py
@@ -14,15 +14,16 @@
# along with avocado-i2n. If not, see .
"""
+Main test suite data structure.
SUMMARY
------------------------------------------------------
-Main test suite data structure containing tests as nodes in a bidirected graph
-with edges to their dependencies (parents) and dependables (children) but also
-with a separate edge for each stateful object.
-Copyright: Intra2net AG
+Data structure containing tests as nodes in a bidirected graph with edges to their
+dependencies (parents) and dependables (children) but also with a separate edge
+for each stateful object.
+Copyright: Intra2net AG
INTERFACE
------------------------------------------------------
@@ -105,6 +106,7 @@ def __init__(self) -> None:
self.runner = None
def __repr__(self) -> str:
+ """Provide a representation of the object."""
dump = "[cartgraph] objects='%s' nodes='%s'" % (
len(self.objects),
len(self.nodes),
@@ -188,8 +190,9 @@ def save_setup_list(self, dump_dir: str, filename: str = "setup_list") -> None:
def report_progress(self) -> None:
"""
- Report the total test run progress as the number and percentage
- of tests that are fully finished (will not be run again).
+ Report the total test run progress.
+
+ The number and percentage of tests that are fully finished will not be run again.
The estimation includes setup tests which might be reused and therefore
provides worst case scenario for the number of remaining tests. It also
@@ -211,8 +214,7 @@ def report_progress(self) -> None:
def visualize(self, dump_dir: str, tag: str = "0") -> None:
"""
- Dump a visual description of the Cartesian graph at
- a given parsing/traversal step.
+ Dump a visual description of the Cartesian graph at a given parsing/traversal step.
:param dump_dir: directory for the dump image
:param tag: tag of the dump, e.g. parsing/traversal step and slot
@@ -1280,8 +1282,10 @@ def parse_composite_nodes(
unique: bool = False,
) -> list[TestNode] | TestNode:
"""
- Parse all user defined tests (leaf nodes) using the nodes restriction string
- and possibly restricting to a single test object for the singleton tests.
+ Parse all user defined tests (leaf nodes).
+
+ Use the nodes restriction string and possibly restricting to a single test object
+ for the singleton tests.
:param restriction: single or multi-line restriction to use
:param test_object: possibly flat test object to compose the node on top of, typically a test net
@@ -2045,8 +2049,9 @@ async def traverse_object_trees(
self, worker: TestWorker, params: Params = None
) -> None:
"""
- Run all user and system defined tests optimizing the setup reuse and
- minimizing the repetition of demanded tests.
+ Run all user and system defined tests.
+
+ Optimize the setup reuse and minimize the repetition of demanded tests.
:param worker: worker traversing the graph
:param params: runtime parameters used for extra customization
diff --git a/avocado_i2n/cartgraph/node.py b/avocado_i2n/cartgraph/node.py
index cafd7633..e80c1e7e 100644
--- a/avocado_i2n/cartgraph/node.py
+++ b/avocado_i2n/cartgraph/node.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility for the main test suite substructures like test nodes.
SUMMARY
------------------------------------------------------
-Utility for the main test suite substructures like test nodes.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -48,35 +47,47 @@
class PrefixTreeNode(object):
+ """A node of a prefix tree."""
+
def __init__(self, variant: str = None, parent: str = None) -> None:
+ """Construct a PrefixTree Node(test) for any test objects (vms)."""
self.variant = variant
self.parent = parent
self.end_test_node = None
self.children = {}
def check_child(self, variant: str) -> bool:
+ """Check child prefix tree node."""
return variant in self.children
def get_child(self, variant: str) -> str:
+ """Get child prefix tree node."""
return self.children[variant]
def set_child(self, variant: str, child: str) -> None:
+ """Set child prefix tree node."""
self.children[variant] = child
def unset_child(self, variant: str) -> None:
+ """Unset child prefix tree node."""
del self.children[variant]
def traverse(self) -> Generator[None, None, None]:
+ """Traverse the current node."""
yield self
for child in self.children.values():
yield from child.traverse()
class PrefixTree(object):
+ """A node of a prefix tree."""
+
def __init__(self) -> None:
+ """Construct a Prefix Tree (test) for any test objects (vms)."""
self.variant_nodes = {}
def __contains__(self, name: str) -> bool:
+ """Check whether the prefix tree contains a given name."""
variants = name.split(".")
if variants[0] not in self.variant_nodes:
return False
@@ -90,6 +101,7 @@ def __contains__(self, name: str) -> bool:
return False
def insert(self, test_node: "TestNode") -> None:
+ """Trie structure used for faster prefix lookup."""
variants = test_node.params["name"].split(".")
if variants[0] not in self.variant_nodes.keys():
self.variant_nodes[variants[0]] = [PrefixTreeNode(variants[0])]
@@ -105,6 +117,7 @@ def insert(self, test_node: "TestNode") -> None:
current.end_test_node = test_node
def get(self, name: str) -> list["TestNode"]:
+ """Get all the names of the prefix tree."""
variants = name.split(".")
if variants[0] not in self.variant_nodes:
return []
@@ -122,11 +135,14 @@ def get(self, name: str) -> list["TestNode"]:
class EdgeRegister:
+ """A register for the Cartesian graph edges allowing counter and worker stats extraction."""
def __init__(self) -> None:
+ """Construct an EdgeRegister (test) for any test objects (vms)."""
self._registry = {}
def __repr__(self) -> str:
+ """Provide a representation of the object."""
return f"[edge] registry='{self._registry}'"
def get_workers(self, node: "TestNode" = None) -> set[str]:
@@ -176,11 +192,15 @@ def register(self, node: "TestNode", worker: TestWorker) -> None:
class TestNode(Runnable):
"""
- A wrapper for all test relevant parts like parameters, parser, used
- objects and dependencies to/from other test nodes (setup/cleanup).
+ A wrapper for all test relevant parts.
+
+ Such test relevant unclude like parameters, parser, used objects and
+ dependencies to/from other test nodes (setup/cleanup).
"""
class ReadOnlyDict(dict[str, str]):
+ """Custom implementation of a read-only attribute of dictionary type."""
+
def _readonly(self, *args: tuple[type, ...], **kwargs: dict[str, type]) -> None:
raise RuntimeError("Cannot modify read-only dictionary")
@@ -343,12 +363,12 @@ def long_prefix(self) -> Params:
@property.get
def id(self) -> Params:
- """Unique ID to identify a test node."""
+ """Use unique ID to identify a test node."""
return self.prefix + "-" + self.params["name"]
@property.get
def id_test(self) -> Params:
- """Unique test ID to identify a test node."""
+ """Use a unique test ID to identify a test node."""
return TestID(self.prefix, self.params["name"])
def __init__(self, prefix: str, recipe: param.Reparsable) -> None:
@@ -386,6 +406,7 @@ def __init__(self, prefix: str, recipe: param.Reparsable) -> None:
self._dropped_cleanup_nodes = EdgeRegister()
def __repr__(self) -> str:
+ """Provide a representation of the object."""
shortname = self.params.get("shortname", "")
return f"[node] longprefix='{self.long_prefix}', shortname='{shortname}'"
@@ -495,7 +516,7 @@ def is_cleanup_ready(self, worker: TestWorker) -> bool:
def is_started(self, worker: TestWorker = None, threshold: int = 1) -> bool:
"""
- The test is currently traversed by at least N (-1 for all) workers of all or some scopes.
+ Test is currently traversed by at least N (-1 for all) workers of all or some scopes.
:param worker: evaluate with respect to an optional worker ID scope or globally if none given
:param threshold: how eagerly the node is considered started in terms of number of
@@ -537,7 +558,7 @@ def is_started(self, worker: TestWorker = None, threshold: int = 1) -> bool:
def is_finished(self, worker: TestWorker = None, threshold: int = 1) -> bool:
"""
- The test was ever traversed by at least N (-1 for all) workers of all or some scopes.
+ Test was ever traversed by at least N (-1 for all) workers of all or some scopes.
:param worker: evaluate with respect to an optional worker ID scope or globally if none given
:param threshold: how eagerly the node is considered started in terms of number of
@@ -770,7 +791,7 @@ def should_rerun(self, worker: TestWorker = None) -> bool:
def default_run_decision(self, worker: TestWorker) -> bool:
"""
- Default decision policy on whether a test node should be run or skipped.
+ Set default decision policy on whether a test node should be run or skipped.
:param worker: worker which makes the run decision
:returns: whether the worker should run the test node
@@ -805,7 +826,7 @@ def default_run_decision(self, worker: TestWorker) -> bool:
def default_clean_decision(self, worker: TestWorker) -> bool:
"""
- Default decision policy on whether a test node should be cleaned or skipped.
+ Set default decision policy on whether a test node should be cleaned or skipped.
:param worker: worker which makes the clean decision
:returns: whether the worker should clean the test node
@@ -1164,9 +1185,7 @@ def regenerate_params(self, verbose: bool = False) -> None:
self.regenerate_vt_parameters()
def regenerate_vt_parameters(self) -> None:
- """
- Regenerate the parameters provided to the VT runner.
- """
+ """Regenerate the parameters provided to the VT runner."""
uri = self.params.get("name")
vt_params = self.params.copy()
# Flatten the vt_params, discarding the attributes that are not
diff --git a/avocado_i2n/cartgraph/object.py b/avocado_i2n/cartgraph/object.py
index 52320001..5bfda804 100644
--- a/avocado_i2n/cartgraph/object.py
+++ b/avocado_i2n/cartgraph/object.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility for the main test suite substructures like test objects.
SUMMARY
------------------------------------------------------
-Utility for the main test suite substructures like test objects.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -46,6 +45,7 @@ def params(self) -> Params:
@property.get
def component_form(self) -> Params:
+ """Component form of the test object name."""
return self.params["name"].replace(self.key + ".", "")
@property.get
@@ -55,7 +55,7 @@ def long_suffix(self) -> str:
@property.get
def id(self) -> str:
- """Unique ID to identify a test object."""
+ """Use unique ID to identify a test object."""
return self.long_suffix + "-" + self.params["name"]
def __init__(self, suffix: str, recipe: param.Reparsable) -> None:
@@ -82,6 +82,7 @@ def __init__(self, suffix: str, recipe: param.Reparsable) -> None:
self.key = "objects"
def __repr__(self) -> str:
+ """Provide a representation of the object."""
shortname = self.params.get("shortname", "")
return f"[object] longsuffix='{self.long_suffix}', shortname='{shortname}'"
@@ -91,8 +92,9 @@ def is_flat(self) -> bool:
def is_permanent(self) -> bool:
"""
- If the test object is permanent, it can only be created manually
- (possibly through the use of manual setup steps).
+ If the test object is permanent, it can only be created manually.
+
+ Thus possibly through the use of manual setup steps.
On states on permanent test object are treated differently than
on states on normal test object since they are preserved through
@@ -147,6 +149,7 @@ class NetObject(TestObject):
"""A Net wrapper for a test object used in one or more test nodes."""
def component_form(self) -> str:
+ """Component form of the test object name."""
# TODO: an unexpected order of joining in the Cartesian config requires us to override base property
return self.params["name"]
@@ -188,6 +191,7 @@ def id(self) -> str:
id = property(fget=id)
def component_form(self) -> str:
+ """Component form of the test object name."""
return self.composites[0].component_form
component_form = property(fget=component_form)
diff --git a/avocado_i2n/cartgraph/worker.py b/avocado_i2n/cartgraph/worker.py
index 7eeed272..50582dcf 100644
--- a/avocado_i2n/cartgraph/worker.py
+++ b/avocado_i2n/cartgraph/worker.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility for the main test suite substructures like test objects.
SUMMARY
------------------------------------------------------
-Utility for the main test suite substructures like test objects.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -41,6 +40,7 @@
class TestEnvironment(object):
+ """Generic environment isolating a given test."""
def __init__(self, id: str) -> None:
"""
@@ -66,6 +66,7 @@ def __init__(self, id: str, workers: str = None) -> None:
self.workers = workers or []
def __repr__(self) -> str:
+ """Provide a representation of the object."""
dump = f"[swarm] id='{self.id}', workers='{len(self.workers)}'"
for worker in self.workers:
dump = f"{dump}\n\t{worker}"
@@ -101,6 +102,7 @@ def __init__(self, id_net: NetObject) -> None:
self.spawner = None
def __repr__(self) -> str:
+ """Provide a representation of the object."""
return f"[worker] id='{self.id}', spawner='{self.params['nets_spawner']}'"
def overwrite_with_slot(self, slot: str) -> None:
diff --git a/avocado_i2n/cmd_parser.py b/avocado_i2n/cmd_parser.py
index 9841b26d..ee717fda 100644
--- a/avocado_i2n/cmd_parser.py
+++ b/avocado_i2n/cmd_parser.py
@@ -13,6 +13,19 @@
# You should have received a copy of the GNU Lesser General Public License
# along with avocado-i2n. If not, see .
+"""
+Need to write something here.
+
+SUMMARY
+------------------------------------------------------
+
+Copyright: Intra2net AG
+
+INTERFACE
+------------------------------------------------------
+
+"""
+
import sys
import os
import re
@@ -30,8 +43,9 @@
def params_from_cmd(config: Params) -> None:
"""
- Take care of command line overwriting, parameter preparation,
- setup and cleanup chains, and paths/utilities for all host controls.
+ Take care of command line overwriting, parameter preparation, setup and cleanup chains.
+
+ This command line also take care paths/utilities for all host controls.
:param config: command line arguments
:raises: :py:class:`ValueError` if a command line selected vm is not available
@@ -261,8 +275,9 @@ def full_tests_params_and_str(
def env_process_hooks() -> None:
"""
- Add env processing hooks to handle on/off state get/set operations
- and vmnet networking setup and instance attachment to environment.
+ Add env processing hooks to handle on/off state get/set operations and vmnet networking setup.
+
+ This addition also inlude instance attachment to environment.
"""
def on_state(fn: Callable[[Any], Any]) -> Any:
diff --git a/avocado_i2n/intertest_setup.py b/avocado_i2n/intertest_setup.py
index c55079b1..2eb127d4 100644
--- a/avocado_i2n/intertest_setup.py
+++ b/avocado_i2n/intertest_setup.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility to manage all needed virtual machines.
SUMMARY
------------------------------------------------------
-Utility to manage all needed virtual machines.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
This utility can be used by any host control to manage one or more virtual machines.
@@ -33,12 +32,11 @@
**IMPORTANT**: If you don't want to perform the given setup with all virtual machines,
defined by your parameters then just overwrite the parameter `vms` as a space
separated list of the selected virtual machine names. The setup then is going to be
-performed only on those machines and not on all. Example is 'vms = vm1 vm2 vm3\n'
-to create only vm1 and vm3 add to the overwrite string 'vms = vm1 vm3\n' in order
+performed only on those machines and not on all. Example is 'vms = vm1 vm2 vm3'
+to create only vm1 and vm3 add to the overwrite string 'vms = vm1 vm3' in order
to overwrite the vms parameter. Of course you can do this with any parameter
to manage other aspects of the virtual environment setup process.
-
INTERFACE
------------------------------------------------------
@@ -210,8 +208,10 @@ def unittest(config: Params, tag: str = "") -> None:
@with_cartesian_graph
def update(config: Params, tag: str = "") -> None:
"""
- Update all states (run all tests) from the state defined as
- ``from_state=`` to the state defined as ``to_state=``.
+ Update all states.
+
+ Run all tests from the state defined as ``from_state=``
+ to the state defined as ``to_state=``.
:param config: command line arguments and run configuration
:param tag: extra name identifier for the test to be run
@@ -280,7 +280,7 @@ def update(config: Params, tag: str = "") -> None:
clean_graph = l.parse_object_trees(
worker=worker,
restriction=setup_str,
- prefix=f"{tag}m{i+1}",
+ prefix=f"{tag}m{i + 1}",
object_restrs=config["available_vms"],
params=setup_dict,
verbose=False,
@@ -633,8 +633,7 @@ def check(config: Params, tag: str = "") -> None:
@with_cartesian_graph
def pop(config: Params, tag: str = "") -> None:
"""
- Get to a state/snapshot disregarding the current changes
- loosing the it afterwards.
+ Get to a state/snapshot disregarding the current changes loosing the it afterwards.
:param config: command line arguments and run configuration
:param tag: extra name identifier for the test to be run
@@ -654,7 +653,7 @@ def pop(config: Params, tag: str = "") -> None:
@with_cartesian_graph
def push(config: Params, tag: str = "") -> None:
"""
- Wrapper for setting state/snapshot, same as :py:func:`set`.
+ Use as wrapper for setting state/snapshot, same as :py:func:`set`.
:param config: command line arguments and run configuration
:param tag: extra name identifier for the test to be run
diff --git a/avocado_i2n/params_parser.py b/avocado_i2n/params_parser.py
index cff628b0..60bd8dd5 100644
--- a/avocado_i2n/params_parser.py
+++ b/avocado_i2n/params_parser.py
@@ -14,15 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for handling all Cartesian config parsing and making it reusable and maximally performant.
SUMMARY
------------------------------------------------------
-Module for handling all Cartesian config parsing and
-making it reusable and maximally performant.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -41,7 +39,7 @@
class EmptyCartesianProduct(Exception):
- """Empty Cartesian product of variants"""
+ """Empty Cartesian product of variants."""
def __init__(self, message: str) -> None:
"""
@@ -75,7 +73,7 @@ def __init__(self, message: str) -> None:
def custom_configs_dir() -> str:
- """Custom directory for all config files."""
+ """Directory customed for all config files."""
suite_path = settings.as_dict().get("i2n.common.suite_path")
return os.path.join(suite_path, "configs")
@@ -145,7 +143,7 @@ def __init__(self, content: str) -> None:
def reportable_form(self) -> str:
"""
- Parsed content representation used in reports of parsing steps.
+ Parse content representation used in reports of parsing steps.
:returns: resulting report-compatible string
:raises: :py:class:`NotImlementedError` as this is an abstract method
@@ -176,7 +174,7 @@ def __init__(self, content: str) -> None:
def reportable_form(self) -> str:
"""
- Parsed file representation used in reports of parsing steps.
+ Parse file representation used in reports of parsing steps.
Arguments are identical to the ones of the parent class.
"""
@@ -196,7 +194,7 @@ class ParsedStr(ParsedContent):
def reportable_form(self) -> str:
"""
- Parsed string representation used in reports of parsing steps.
+ Parse string representation used in reports of parsing steps.
Arguments are identical to the ones of the parent class.
"""
@@ -221,7 +219,7 @@ class ParsedDict(ParsedContent):
def reportable_form(self) -> str:
"""
- Parsed dictionary representation used in reports of parsing steps.
+ Parse dictionary representation used in reports of parsing steps.
Arguments are identical to the ones of the parent class.
"""
@@ -243,8 +241,9 @@ def parsable_form(self) -> str:
class Reparsable:
"""
- Class to represent quickly parsable Cartesian configuration,
- producing both parser and parameters (parser dicts) on demand.
+ Class to represent quickly parsable Cartesian configuration.
+
+ Such producing both parser and parameters (parser dicts) on demand.
"""
def __init__(self) -> None:
@@ -252,6 +251,7 @@ def __init__(self) -> None:
self.steps = []
def __repr__(self) -> str:
+ """Provide a representation of the parsable Cartesian configuration."""
restriction = "Parsing parameters with the following configuration:\n"
for step in self.steps:
restriction += step.reportable_form()
@@ -299,8 +299,10 @@ def parse_next_batch(
ovrwrt_dict: dict[str, str] = None,
) -> None:
"""
- Parse a batch of base file, string, and dictionary, and possibly an
- overwrite file (with custom parameters at the user's home location).
+ Parse a batch of base file, string, and dictionary.
+
+ Possibly also parse a batch of an overwrite file (with custom parameters
+ at the user's home location).
:param base_file: file to be parsed first
:param base_str: string to be parsed first
@@ -520,8 +522,7 @@ def main_vm() -> str | None:
def re_str(variant_str: str, base_str: str = "", tag: str = "") -> str:
"""
- Add a variant restriction to the base string, optionally
- adding a custom tag as well.
+ Add a variant restriction to the base string, optionally adding a custom tag as well.
:param variant_str: variant restriction
:param base_str: string where the variant restriction will be added
@@ -550,7 +551,7 @@ def join_str(variant_strs: dict[str, str], sort_key: str, base_str: str = "") ->
continue
variant = variant_strs[suffix]
subvariant = "".join(
- [" " + l + "\n" for l in variant.rstrip("\n").split("\n")]
+ [" " + line + "\n" for line in variant.rstrip("\n").split("\n")]
)
variant_str += "%s:\n%s" % (suffix, subvariant)
objects += " " + suffix
diff --git a/avocado_i2n/plugins/__init__.py b/avocado_i2n/plugins/__init__.py
index e69de29b..180e958b 100644
--- a/avocado_i2n/plugins/__init__.py
+++ b/avocado_i2n/plugins/__init__.py
@@ -0,0 +1 @@
+"""Package with all actual avocado plugins."""
diff --git a/avocado_i2n/plugins/auto.py b/avocado_i2n/plugins/auto.py
index c2867577..578a9488 100644
--- a/avocado_i2n/plugins/auto.py
+++ b/avocado_i2n/plugins/auto.py
@@ -13,6 +13,17 @@
# You should have received a copy of the GNU Lesser General Public License
# along with avocado-i2n. If not, see .
+"""
+Autotesting.
+
+SUMMARY
+------------------------------------------------------
+
+INTERFACE
+------------------------------------------------------
+
+"""
+
import os
from avocado.core.settings import settings
@@ -23,6 +34,7 @@
class Auto(CLI):
+ """Autotesting......"""
name = "auto"
description = (
@@ -65,8 +77,9 @@ def configure(self, parser: QAArgumentParser) -> None:
def run(self, config: Params) -> None:
"""
- Take care of command line overwriting, parameter preparation,
- setup and cleanup chains, and paths/utilities for all host controls.
+ Take care of command line overwriting and parameter preparationfor all host controls.
+
+ Handle setup and cleanup chains, and paths/utilities for all host controls.
"""
if not config["run.auto"] and not config["list.auto"]:
return
diff --git a/avocado_i2n/plugins/loader.py b/avocado_i2n/plugins/loader.py
index 03e2dd28..388a3ff6 100644
--- a/avocado_i2n/plugins/loader.py
+++ b/avocado_i2n/plugins/loader.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Specialized test loader for the plugin.
SUMMARY
------------------------------------------------------
-Specialized test loader for the plugin.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/plugins/manu.py b/avocado_i2n/plugins/manu.py
index 2efc1814..9c4e8113 100644
--- a/avocado_i2n/plugins/manu.py
+++ b/avocado_i2n/plugins/manu.py
@@ -13,6 +13,19 @@
# You should have received a copy of the GNU Lesser General Public License
# along with avocado-i2n. If not, see .
+"""
+Manual settings for the test run.
+
+SUMMARY
+------------------------------------------------------
+
+Copyright: Intra2net AG
+
+INTERFACE
+------------------------------------------------------
+
+"""
+
import os
import traceback
@@ -26,6 +39,7 @@
class Manu(CLICmd):
+ """Manually setup test run."""
name = "manu"
description = (
@@ -54,8 +68,9 @@ def configure(self, parser: QAArgumentParser) -> None:
def run(self, config: Params) -> int:
"""
- Take care of command line overwriting, parameter preparation,
- setup and cleanup chains, and paths/utilities for all host controls.
+ Take care of command line overwriting, parameter preparation for all host controls.
+
+ Handle setup and cleanup chains, and paths/utilities for all host controls.
"""
log.info("Manual setup chain started.")
# set English environment (command output might be localized, need to be safe)
diff --git a/avocado_i2n/plugins/runner.py b/avocado_i2n/plugins/runner.py
index afa0c69e..9b8ccc98 100644
--- a/avocado_i2n/plugins/runner.py
+++ b/avocado_i2n/plugins/runner.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Specialized test runner for the plugin.
SUMMARY
------------------------------------------------------
-Specialized test runner for the plugin.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -291,7 +290,7 @@ def get_duration(x: dict[str, str]) -> float:
logging.info(f"Finished running test with status {test_status.upper()}")
# no need to log when test was not repeated
if run_times > 0:
- logging.info(f"Finished running test {run_times+1} times")
+ logging.info(f"Finished running test {run_times + 1} times")
# FIX: as VT's retval is broken (always True), we fix its handling here
if test_status in ["error", "fail"]:
diff --git a/avocado_i2n/plugins/settings.py b/avocado_i2n/plugins/settings.py
index 640215bb..98405252 100644
--- a/avocado_i2n/plugins/settings.py
+++ b/avocado_i2n/plugins/settings.py
@@ -16,9 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with avocado-i2n. If not, see .
-"""
-Avocado plugin that extends the settings path of our config paths.
-"""
+"""Avocado plugin that extends the settings path of our config paths."""
import os
from pkg_resources import resource_filename
@@ -28,8 +26,10 @@
class I2NSettings(Settings):
+ """I2NSettings for setting the path."""
def adjust_settings_paths(self, paths: str) -> None:
+ """Adjust the settings of the path."""
base = resource_filename("avocado_i2n", "conf.d")
for path in [
os.path.join(base, conf)
diff --git a/avocado_i2n/states/__init__.py b/avocado_i2n/states/__init__.py
index e69de29b..ce55c2f0 100644
--- a/avocado_i2n/states/__init__.py
+++ b/avocado_i2n/states/__init__.py
@@ -0,0 +1 @@
+"""Package for stateful object management containing all available state backends."""
diff --git a/avocado_i2n/states/btrfs.py b/avocado_i2n/states/btrfs.py
index d2cab7a3..f540bda7 100644
--- a/avocado_i2n/states/btrfs.py
+++ b/avocado_i2n/states/btrfs.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the Btrfs state management backend.
SUMMARY
------------------------------------------------------
-Module for the Btrfs state management backend.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/lvm.py b/avocado_i2n/states/lvm.py
index 83bc723d..88c73ad5 100644
--- a/avocado_i2n/states/lvm.py
+++ b/avocado_i2n/states/lvm.py
@@ -14,10 +14,10 @@
# along with avocado-i2n. If not, see .
"""
+Module for the LVM state management backend.
SUMMARY
------------------------------------------------------
-Module for the LVM state management backend.
Copyright: Intra2net AG
@@ -26,7 +26,6 @@
portability as well as completeness in case there is interest to
revive it by contributors that actually need it.
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/lxc.py b/avocado_i2n/states/lxc.py
index 65b227f3..fcd1f731 100644
--- a/avocado_i2n/states/lxc.py
+++ b/avocado_i2n/states/lxc.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the LXC state management backend.
SUMMARY
------------------------------------------------------
-Module for the LXC state management backend.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/pool.py b/avocado_i2n/states/pool.py
index 44ee9be7..5483debb 100644
--- a/avocado_i2n/states/pool.py
+++ b/avocado_i2n/states/pool.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the QCOW2 pool state management backend.
SUMMARY
------------------------------------------------------
-Module for the QCOW2 pool state management backend.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/qcow2.py b/avocado_i2n/states/qcow2.py
index 7d0be715..dc9e296a 100644
--- a/avocado_i2n/states/qcow2.py
+++ b/avocado_i2n/states/qcow2.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the QCOW2 state management backends.
SUMMARY
------------------------------------------------------
-Module for the QCOW2 state management backends.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/ramfile.py b/avocado_i2n/states/ramfile.py
index 7a7409d2..986dbcd1 100644
--- a/avocado_i2n/states/ramfile.py
+++ b/avocado_i2n/states/ramfile.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the ramfile state management backend.
SUMMARY
------------------------------------------------------
-Module for the ramfile state management backend.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/states/setup.py b/avocado_i2n/states/setup.py
index fb085c6b..fb9eedfe 100644
--- a/avocado_i2n/states/setup.py
+++ b/avocado_i2n/states/setup.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility to manage off and on test object states.
SUMMARY
------------------------------------------------------
-Utility to manage off and on test object states.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
@@ -145,7 +144,7 @@ def _parametric_object_iteration(
params: Params, composites: list[tuple[str, str]] = None
) -> Generator[str, None, None]:
"""
- Iterator over a hierarchy of stateful parametric objects.
+ Iterate over a hierarchy of stateful parametric objects.
:param params: parameters of the parametric object is processed
:param composites: current composite parametric object
diff --git a/avocado_i2n/states/vmnet.py b/avocado_i2n/states/vmnet.py
index 43d50a7a..a0e9a3f4 100644
--- a/avocado_i2n/states/vmnet.py
+++ b/avocado_i2n/states/vmnet.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Module for the VMNet state management backend.
SUMMARY
------------------------------------------------------
-Module for the VMNet state management backend.
Copyright: Intra2net AG
-
INTERFACE
------------------------------------------------------
diff --git a/avocado_i2n/vmnet/__init__.py b/avocado_i2n/vmnet/__init__.py
index 0f742b89..b33af10c 100644
--- a/avocado_i2n/vmnet/__init__.py
+++ b/avocado_i2n/vmnet/__init__.py
@@ -1,3 +1,5 @@
+"""Package for vm network management."""
+
from .network import VMNetwork
from .tunnel import VMTunnel
from .netconfig import VMNetconfig
diff --git a/avocado_i2n/vmnet/interface.py b/avocado_i2n/vmnet/interface.py
index f18dfd3a..d8c3f0e7 100644
--- a/avocado_i2n/vmnet/interface.py
+++ b/avocado_i2n/vmnet/interface.py
@@ -14,21 +14,19 @@
# along with avocado-i2n. If not, see .
"""
+Interface object for the vmnet utility.
SUMMARY
------------------------------------------------------
-Interface object for the vmnet utility.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
This is the basic building block of the vm network. Interfaces are grouped
in nodes (the virtual machines they belong to) and in netconfigs (the
local networks they define together).
-
INTERFACE
------------------------------------------------------
@@ -109,6 +107,7 @@ def __init__(self, name: str, params: Params) -> None:
self._ip = params["ip"]
def __repr__(self) -> str:
+ """Provide a representation of the object."""
vm_name = "none" if self.node is None else self.node.name
net_name = "none" if self.netconfig is None else self.netconfig.net_ip
iface_tuple = (self.name, self.ip, self.mac, vm_name, net_name)
diff --git a/avocado_i2n/vmnet/netconfig.py b/avocado_i2n/vmnet/netconfig.py
index e78a9510..fbf0018a 100644
--- a/avocado_i2n/vmnet/netconfig.py
+++ b/avocado_i2n/vmnet/netconfig.py
@@ -14,21 +14,19 @@
# along with avocado-i2n. If not, see .
"""
+Network configuration object for the VM network.
SUMMARY
------------------------------------------------------
-Network configuration object for the VM network.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
It contains the network configuration, offers network services like
IP address allocation, translation, and validation, and consists
of Interface objects that share this network configuration.
-
INTERFACE
------------------------------------------------------
@@ -44,10 +42,7 @@
class VMNetconfig(object):
- """
- The netconfig class - a collection of interfaces
- sharing the same network configuration.
- """
+ """The netconfig class - a collection of interfaces sharing the same network configuration."""
"""Structural properties"""
@@ -118,10 +113,7 @@ def net_ip(self, value: VMInterface = None) -> VMInterface:
@property
def host_ip(self, value: VMInterface = None) -> VMInterface:
- """
- IP of the host for the virtual machine if it participates in the
- local network (and therefore in the netcofig).
- """
+ """IP of the host for the virtual machine if it participates in the local network (and therefore in the netcofig)."""
if value is not None:
self._host_ip = value
else:
@@ -130,8 +122,7 @@ def host_ip(self, value: VMInterface = None) -> VMInterface:
@property
def range(self, value: VMInterface = None) -> VMInterface:
"""
- IP range of addresses that can be allocated to joining vms
- (new interfaces that join the netconfig).
+ IP range of addresses that can be allocated to joining vms(new interfaces that join the netconfig).
To set a different ip_start and ip_end, i.e. different boundaries,
use the setter of this property.
@@ -210,8 +201,7 @@ def view(self, value: str = None) -> str | None:
@property
def ext_netdst(self, value: str = None) -> str | None:
"""
- External network destination to which we route
- after network translation.
+ External network destination to which we route after network translation.
.. note:: Used for host-based NAT configuration.
"""
@@ -240,6 +230,7 @@ def __init__(self) -> None:
self._ext_netdst = None
def __repr__(self) -> str:
+ """Provide a representation of the object."""
net_tuple = (self.net_ip, self.netmask, self.netdst)
return "[net] addr='%s', netmask='%s', netdst='%s'" % net_tuple
@@ -249,8 +240,9 @@ def _get_network_ip(self, ip: str, bit: int) -> str:
def from_interface(self, interface: VMInterface) -> None:
"""
- Construct all netconfig parameters from the provided interface or reset
- them with respect to that interface if they were already set.
+ Construct all netconfig parameters from the provided interface.
+
+ Alternatively reset them with respect to that interface if they were already set.
:param interface: reference interface for the configuration
"""
@@ -280,8 +272,10 @@ def from_interface(self, interface: VMInterface) -> None:
def add_interface(self, interface: VMInterface) -> None:
"""
- Add an interface to the netconfig, performing the necessary registrations
- and finishing with validation of the interface configuration.
+ Add an interface to the netconfig.
+
+ Performing the necessary registrations and finishing
+ with validation of the interface configuration.
:param interface: interface to add to the netconfig
"""
@@ -291,8 +285,9 @@ def add_interface(self, interface: VMInterface) -> None:
def has_interface(self, interface: VMInterface) -> bool:
"""
- Check whether an interface already belongs to the netconfig through
- both IP and actual attachment (to counter same IP range netconfigs).
+ Check whether an interface already belongs to the netconfig.
+
+ Checking this through both IP and actual attachment (to counter same IP range netconfigs).
:param interface: interface to check in the netconfig
:returns: whether the interface is already present in the netconfig
@@ -304,9 +299,9 @@ def has_interface(self, interface: VMInterface) -> bool:
def can_add_interface(self, interface: VMInterface) -> bool:
"""
- Check if an interface can be added to the netconfig based on its
- desired IP address and throw Exceptions if it is already present
- or the netmask does not coincide (misconfiguration errors).
+ Check if an interface can be added to the netconfig based on its desired IP address.
+
+ Throw Exceptions if it is already present or the netmask does not coincide (misconfiguration errors).
:param interface: interface to add to the netconfig
:returns: whether the interface can be added
@@ -374,10 +369,7 @@ def validate(self) -> None:
)
def get_allocatable_address(self) -> str:
- """
- Return the next IP address in the pool of available IPs that
- can be used by DHCP clients in the network.
- """
+ """Return the next IP address in the pool of available IPs that can be used by DHCP clients in the network."""
for val in self.range:
if self.range[val] is False:
self.range[val] = True
@@ -389,9 +381,9 @@ def get_allocatable_address(self) -> str:
return str(ipaddress.IPv4Address(str(net_ip + new_address)))
def translate_address(self, ip: str, nat_ip: str) -> str:
- """
- Return the NAT translated IP of an interface or alternatively the IP
- of an interface masked by a desired network address.
+ """Return the NAT translated IP of an interface.
+
+ Alternatively the IP of an interface masked by a desired network address.
:param nat_ip: NATed IP to use for reference
:returns: the translated IP of the interface
diff --git a/avocado_i2n/vmnet/network.py b/avocado_i2n/vmnet/network.py
index bc1ea02c..fb25a7bb 100644
--- a/avocado_i2n/vmnet/network.py
+++ b/avocado_i2n/vmnet/network.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Utility to manage local networks of vms and various topologies.
SUMMARY
------------------------------------------------------
-Utility to manage local networks of vms and various topologies.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
The main class is the VMNetwork class and is used to perform all
@@ -75,15 +74,15 @@
class VMNetwork(object):
"""
- Any VMNetwork instance can be used to connect vms in various network topologies
- and to reconfigure, ping, retrieve the session of, as well as spawn clients for
- each of them.
+ Any VMNetwork instance can be used to connect vms in various network topologies.
+
+ It can also be used to reconfigure, ping, retrieve the session of, as well as spawn
+ clients for each of them.
"""
def __init__(self, params: Params, env: Env) -> None:
"""
- Construct a network data structure given the test parameters,
- the `env` and the `test` instance.
+ Construct a network data structure given the test parameters, the `env` and the `test` instance.
.. note:: The params attribute is just a shallow copy to preserve the hierarchy:
network level params = test level params -> node level params = test object params
@@ -131,6 +130,7 @@ def __init__(self, params: Params, env: Env) -> None:
logging.debug("Constructed network configuration:\n%s", self)
def __repr__(self) -> str:
+ """Provide a representation of the object."""
dump = "[vmnet] netconfigs='%s'" % len(self.netconfigs.keys())
for netconfig in self.netconfigs.values():
dump = "%s\n\t%s" % (dump, str(netconfig))
@@ -176,8 +176,7 @@ def get_single_vm_with_session(self) -> tuple[VM, RemoteSession]:
def get_single_vm_with_session_and_params(self) -> tuple[VM, RemoteSession, Params]:
"""
- Get the only vm in the network and its only session
- as well as configuration (to replace the test configuration).
+ Get the only vm in the network and its only session as well as configuration (to replace the test configuration).
:returns: vm, its last session, and its params
:rtype: (:py:class:`virttest.qemu_vm.VM`, Session object, Params object)
@@ -208,8 +207,7 @@ def get_ordered_vms(self, vm_num: int = None) -> tuple[VM, VM]:
def get_vms(self) -> namedtuple:
"""
- Get a named tuple of vms in the network with their parametrically
- defined roles.
+ Get a named tuple of vms in the network with their parametrically defined roles.
:returns: tuple t with t.client = and t.server =
:rtype: named tuple
@@ -240,9 +238,9 @@ def get_vms(self) -> namedtuple:
def integrate_node(self, node: VMNode) -> None:
"""
- Add all interfaces and netconfigs resulting from a new vm node
- into the vm network, thus integrating the configuration into
- the available one.
+ Add all interfaces and netconfigs resulting from a new vm node into the vm network.
+
+ Thus integrate the configuration into the available one.
:param node: vm node to be integrated into the network
:type node: :py:class:`VMNode`
@@ -300,8 +298,7 @@ def reattach_interface(
proxy_nic: str = "",
) -> None:
"""
- Reconfigure a network interface of a vm reattaching it to a different
- interface's network config.
+ Reconfigure a network interface of a vm reattaching it to a different interface's network config.
:param client: vm whose interace will be rattached
:param server: vm whose network will the interface be attached to
@@ -600,10 +597,7 @@ def _configure_local_nat(
process.run("iptables -t nat -I POSTROUTING %s -j MASQUERADE" % post_ops)
def setup_host_services(self) -> None:
- """
- Provide all necessary services like DHCP, DNS and NAT
- to restrict all tests locally.
- """
+ """Provide all necessary services like DHCP, DNS and NAT to restrict all tests locally."""
logging.info("Checking for local DHCP, DNS and NAT service requirements")
dhcp_declarations = {}
dns_declarations = {}
@@ -844,7 +838,7 @@ def _cleanup_bridge_interfaces(self, netdst: str) -> None:
def setup_host_bridges(self) -> None:
"""
- Setup bridges and interfaces needed to create and isolate the network.
+ Build bridges and interfaces needed to create and isolate the network.
The final network topology is derived entirely from the test parameters.
"""
@@ -1068,8 +1062,9 @@ def change_network_address(
self, netconfig: VMNetconfig, new_ip: str, new_mask: str = None
) -> None:
"""
- Change the ip of a netconfig and more specifically of the network interface of
- any vm participating in it.
+ Change the ip of a netconfig.
+
+ More specifically of the network interface of any vm participating in it.
:param netconfig: netconfig to change the IP of
:param new_ip: new IP address for the netconfig
@@ -1178,8 +1173,7 @@ def configure_tunnel_on_vm(
self, name: str, vm: VM, apply_extra_options: dict[str, Any] = None
) -> None:
"""
- Configure a tunnel on a vm, assuming it is manually
- or independently configured on the other end.
+ Configure a tunnel on a vm, assuming it is manually or independently configured on the other end.
:param name: name of the tunnel
:param vm: vm where the tunnel will be configured
@@ -1209,8 +1203,9 @@ def configure_roadwarrior_vpn_on_server(
apply_extra_options: dict[str, Any] = None,
) -> None:
"""
- Configure a VPN connection (tunnel) on a vm to play the role of a VPN
- server for any individual clients to access it from the internet.
+ Configure a VPN connection (tunnel) on a VM to act as a VPN server.
+
+ This will allow individual clients to access it from the Internet
Arguments are similar to the ones from :py:meth:`configure_tunnel_between_vms`
with the exception of:
@@ -1250,8 +1245,7 @@ def configure_vpn_route(
extra_apply_options: dict[str, Any] = None,
) -> None:
"""
- Build a set of VPN connections using VPN forwarding to gain access from
- one vm to another.
+ Build a set of VPN connections using VPN forwarding to gain access from one vm to another.
Arguments are similar to the ones from :py:meth:`configure_tunnel_between_vms`
with the exception of:
@@ -1361,8 +1355,9 @@ def get_tunnel_accessible_ip(
self, src_vm: VM, dst_vm: VM, dst_nic: str = "lan_nic"
) -> str:
"""
- Get an accessible IP from a vm to a vm given using heuristics about
- the tunnels and netconfigs of the entire vm network.
+ Get an accessible IP from a vm to a vm.
+
+ Given using heuristics about the tunnels and netconfigs of the entire vm network.
:param src_vm: source vm whose IPs are starting points
:param dst_vm: destination vm whose IPs are ending points
@@ -1432,8 +1427,9 @@ def get_accessible_ip(
self, src_vm: VM, dst_vm: VM, dst_nic: str = "lan_nic"
) -> str:
"""
- Get an accessible IP from a vm to a vm given using heuristics about
- the tunnels and netconfigs of the entire vm network.
+ Get an accessible IP from a vm to a vm.
+
+ Given using heuristics about the tunnels and netconfigs of the entire vm network.
:param src_vm: source vm whose IPs are starting points
:param dst_vm: destination vm whose IPs are ending points
@@ -2026,8 +2022,7 @@ def ssh_hostname(
self, src_vm: VM, dst_vm: VM, dst_nic: str = "lan_nic", timeout: int = 10
) -> list[str]:
"""
- Get the host name of a vm from any other vm in the vm net
- using the SSH protocol.
+ Get the host name of a vm from any other vm in the vm net using the SSH protocol.
:param src_vm: source vm with the SSH client
:param dst_vm: destination vm with the SSH server
@@ -2178,6 +2173,7 @@ def tftp_connectivity(
) -> tuple[int, str]:
"""
Send file request to an TFTP destination port and address and verify it was received.
+
Arguments are similar to the :py:meth:`port_connectivity` method with the exception of:
:param file: file to retrieve containing the test data or none if sent directly
@@ -2208,6 +2204,7 @@ def tftp_connectivity_validate(
) -> None:
"""
Send file request to an TFTP destination port and address and verify it was received.
+
Arguments are similar to the :py:meth:`port_connectivity` method with the exception of:
:param file: file to retrieve containing the test data or none if sent directly
diff --git a/avocado_i2n/vmnet/node.py b/avocado_i2n/vmnet/node.py
index 6b0d7ef9..b6a9ec74 100644
--- a/avocado_i2n/vmnet/node.py
+++ b/avocado_i2n/vmnet/node.py
@@ -14,20 +14,18 @@
# along with avocado-i2n. If not, see .
"""
+VMNode object for the vmnet utility.
SUMMARY
------------------------------------------------------
-VMNode object for the vmnet utility.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
This class wraps up the functionality shared among the interfaces of
the same platform like session management, etc.
-
INTERFACE
------------------------------------------------------
@@ -39,10 +37,7 @@
class VMNode(object):
- """
- The vmnode class - a collection of interfaces
- sharing the same platform.
- """
+ """The vmnode class - a collection of interfaces sharing the same platform."""
"""Structural properties"""
@@ -56,17 +51,18 @@ def interfaces(self, value: VMInterface = None) -> VMInterface:
@property.get
def ephemeral(self) -> bool:
- """Whether the vm node is ephemeral (spawned in a network)."""
+ """
+ Check if the vm node is ephemeral.
+
+ returns: whether the vm node is ephemeral (spawned in a network).
+ """
return self._ephemeral
"""Platform properties"""
@property
def platform(self, value: VM = None) -> VM:
- """
- A reference to the virtual machine object whose network
- configuration is represented by the vm node.
- """
+ """A reference to the virtual machine object whose network configuration is represented by the vm node."""
if value is not None:
self._platform = value
else:
@@ -130,6 +126,7 @@ def __init__(self, platform: VM, ephemeral: bool = False) -> None:
self._last_session = None
def __repr__(self) -> str:
+ """Provide a representation of the object."""
vm_tuple = (self.name, len(self.remote_sessions))
return "[node] name='%s', sessions='%s'" % vm_tuple
@@ -155,7 +152,7 @@ def get_single_interface(self) -> list[VMInterface]:
def get_session(self, serial: bool = False) -> VM:
"""
- The basic network login - get a session from a vmnode.
+ Obtain a session from a vmnode by performing the basic network login.
:param serial: whether to use serial connection
"""
diff --git a/avocado_i2n/vmnet/tunnel.py b/avocado_i2n/vmnet/tunnel.py
index 635a3de8..db3420db 100644
--- a/avocado_i2n/vmnet/tunnel.py
+++ b/avocado_i2n/vmnet/tunnel.py
@@ -14,14 +14,13 @@
# along with avocado-i2n. If not, see .
"""
+Tunnel object for the vmnet utility.
SUMMARY
------------------------------------------------------
-Tunnel object for the vmnet utility.
Copyright: Intra2net AG
-
CONTENTS
------------------------------------------------------
This class wraps up the utilities for managing tunnels.
@@ -29,7 +28,6 @@
The parameters parsed at each vm are used as overwrite dictionary and
and missing ones are generated for the full configuration of the tunnel.
-
INTERFACE
------------------------------------------------------
@@ -102,17 +100,17 @@ def right_net(self, value: VMNetconfig = None) -> VMNetconfig | None:
@property.get
def left_params(self) -> Params:
- """The tunnel generated left side parameters."""
+ """Tunnel generated left side parameters."""
return self.left.params.object_params(self.name)
@property.get
def right_params(self) -> Params:
- """The tunnel generated right side parameters."""
+ """Tunnel generated right side parameters."""
return self.right.params.object_params(self.name)
@property.get
def params(self) -> Params:
- """The tunnel generated test parameters."""
+ """Tunnel generated test parameters."""
return self._params
"""Connection properties"""
@@ -137,9 +135,9 @@ def __init__(
auth: dict[str, str] = None,
) -> None:
"""
- Construct the full set of required tunnel parameters for a given tunnel left configuration
- that are not already defined in the parameters of the two vms (left `node1` with
- right `node2`).
+ Construct the full set of required tunnel parameters for a given tunnel left configuration.
+
+ That are not already defined in the parameters of the two vms (left 'node1' with right 'node2').
:param name: name of the tunnel
:param node1: left side node of the tunnel
@@ -330,6 +328,7 @@ def __init__(
logging.info("Produced tunnel from parameters is %s", self)
def __repr__(self) -> str:
+ """Provide a representation of the object."""
left_net = "none" if self.left_net is None else self.left_net.net_ip
right_net = "none" if self.right_net is None else self.right_net.net_ip
tunnel_tuple = (
@@ -348,8 +347,10 @@ def __repr__(self) -> str:
def connects_nodes(self, node1: VMNode, node2: VMNode) -> bool:
"""
- Check whether a tunnel connects two vm nodes, i.e. they are in directly connected
- as tunnel peers or indirectly in tunnel connected LANs (netconfigs).
+ Check whether a tunnel connects two vm nodes.
+
+ in other words they are in directly connected as tunnel peers
+ or ndirectly in tunnel connected LANs (netconfigs).
:param node1: one side vm of the tunnel
:param node2: another side vm of the tunnel
@@ -552,8 +553,7 @@ def configure_on_endpoint(
def import_key_params(self, from_node: VMNode, to_node: VMNode) -> None:
"""
- This will generate own key configuration at the source vm
- and foreign key configuration at the destination vm.
+ Generate own key configuration at the source vm and foreign key configuration at the destination vm.
:param from_node: source node to get the key from (and generate own key
configuration on it containing all relevant key information)