Acked-by: Jeremy Spewock <jspew...@iol.unh.edu>

On Thu, Apr 20, 2023 at 5:51 AM Juraj Linkeš <juraj.lin...@pantheon.tech>
wrote:

> Initialize the TG node and do basic verification.
>
> Signed-off-by: Juraj Linkeš <juraj.lin...@pantheon.tech>
> ---
>  dts/framework/dts.py                    | 42 ++++++++++++++++---------
>  dts/framework/testbed_model/__init__.py |  1 +
>  2 files changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/dts/framework/dts.py b/dts/framework/dts.py
> index 0502284580..9c82bfe1f4 100644
> --- a/dts/framework/dts.py
> +++ b/dts/framework/dts.py
> @@ -9,7 +9,7 @@
>  from .logger import DTSLOG, getLogger
>  from .test_result import BuildTargetResult, DTSResult, ExecutionResult,
> Result
>  from .test_suite import get_test_suites
> -from .testbed_model import SutNode
> +from .testbed_model import SutNode, TGNode, Node
>  from .utils import check_dts_python_version
>
>  dts_logger: DTSLOG = getLogger("DTSRunner")
> @@ -27,28 +27,40 @@ def run_all() -> None:
>      # check the python version of the server that run dts
>      check_dts_python_version()
>
> -    nodes: dict[str, SutNode] = {}
> +    nodes: dict[str, Node] = {}
>      try:
>          # for all Execution sections
>          for execution in CONFIGURATION.executions:
>              sut_node = None
> +            tg_node = None
>              if execution.system_under_test.name in nodes:
>                  # a Node with the same name already exists
>                  sut_node = nodes[execution.system_under_test.name]
> -            else:
> -                # the SUT has not been initialized yet
> -                try:
> +
> +            if execution.traffic_generator_system.name in nodes:
> +                # a Node with the same name already exists
> +                tg_node = nodes[execution.traffic_generator_system.name]
> +
> +            try:
> +                if not sut_node:
>                      sut_node = SutNode(execution.system_under_test)
> -                    result.update_setup(Result.PASS)
> -                except Exception as e:
> -                    dts_logger.exception(
> -                        f"Connection to node
> {execution.system_under_test} failed."
> -                    )
> -                    result.update_setup(Result.FAIL, e)
> -                else:
> -                    nodes[sut_node.name] = sut_node
> -
> -            if sut_node:
> +                if not tg_node:
> +                    tg_node = TGNode(execution.traffic_generator_system)
> +                    tg_node.verify()
> +                result.update_setup(Result.PASS)
> +            except Exception as e:
> +                failed_node = execution.system_under_test.name
> +                if sut_node:
> +                    failed_node = execution.traffic_generator_system.name
> +                dts_logger.exception(
> +                    f"Creation of node {failed_node} failed."
> +                )
> +                result.update_setup(Result.FAIL, e)
> +            else:
> +                nodes[sut_node.name] = sut_node
> +                nodes[tg_node.name] = tg_node
> +
> +            if sut_node and tg_node:
>                  _run_execution(sut_node, execution, result)
>
>      except Exception as e:
> diff --git a/dts/framework/testbed_model/__init__.py
> b/dts/framework/testbed_model/__init__.py
> index f54a947051..5cbb859e47 100644
> --- a/dts/framework/testbed_model/__init__.py
> +++ b/dts/framework/testbed_model/__init__.py
> @@ -20,3 +20,4 @@
>  )
>  from .node import Node
>  from .sut_node import SutNode
> +from .tg_node import TGNode
> --
> 2.30.2
>
>

Reply via email to