From a64f8b5cfbbb1714468e2ef441afb07aa9a75135 Mon Sep 17 00:00:00 2001 From: MariusBaldovin Date: Mon, 13 Jan 2025 09:18:24 +0000 Subject: [PATCH 1/4] made wifi interface available --- framework/python/src/api/api.py | 2 +- framework/python/src/net_orc/ip_control.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index 2bba5e62f..b8ff01db5 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -202,7 +202,7 @@ async def get_sys_interfaces(self): nic = addrs[key] # Ignore any interfaces that are not ethernet - if not (key.startswith("en") or key.startswith("eth")): + if not (key.startswith("en") or key.startswith("eth") or key.startswith("wl")): continue ifaces[key] = nic[0].address diff --git a/framework/python/src/net_orc/ip_control.py b/framework/python/src/net_orc/ip_control.py index 73a6aceeb..cb49d392d 100644 --- a/framework/python/src/net_orc/ip_control.py +++ b/framework/python/src/net_orc/ip_control.py @@ -276,7 +276,7 @@ def get_sys_interfaces() -> t.Dict[str, t.Dict[str, str]]: for key in addrs: nic = addrs[key] # Ignore any interfaces that are not ethernet - if not (key.startswith('en') or key.startswith('eth')): + if not (key.startswith('en') or key.startswith('eth') or key.startswith("wl")): continue ifaces[key] = nic[0].address From a91ed7258c4c99d3aacb92f522ff4543b69081cc Mon Sep 17 00:00:00 2001 From: MariusBaldovin Date: Wed, 29 Jan 2025 12:54:27 +0000 Subject: [PATCH 2/4] added error handling if the ui or ws containers are started without auto-remove flag --- framework/python/src/core/testrun.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index f4ce62c0f..7d88851db 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -22,6 +22,8 @@ import signal import sys import time + +import docker.errors from common import logger, util, mqtt from common.device import Device from common.testreport import TestReport @@ -532,6 +534,11 @@ def _stop_ui(self): container = client.containers.get('tr-ui') if container is not None: container.kill() + # If the container has been started without auto-remove flag remove it + try: + container.remove() + except docker.errors.APIError: + pass except docker.errors.NotFound: pass @@ -565,5 +572,11 @@ def _stop_ws(self): container = client.containers.get('tr-ws') if container is not None: container.kill() + # If the container has been started without auto-remove flag remove it + try: + container.remove() + except docker.errors.APIError: + pass + except docker.errors.NotFound: pass From 882bba5bca397e2149f36d30138fdc0b6f2306f2 Mon Sep 17 00:00:00 2001 From: MariusBaldovin Date: Wed, 29 Jan 2025 13:10:39 +0000 Subject: [PATCH 3/4] corrections --- framework/python/src/api/api.py | 2 +- framework/python/src/core/testrun.py | 8 +++----- framework/python/src/net_orc/ip_control.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index 97555682c..2f994437a 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -202,7 +202,7 @@ async def get_sys_interfaces(self): nic = addrs[key] # Ignore any interfaces that are not ethernet - if not (key.startswith("en") or key.startswith("eth") or key.startswith("wl")): + if not key.startswith("en") or key.startswith("eth"): continue ifaces[key] = nic[0].address diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index 7d88851db..428df8474 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -22,8 +22,8 @@ import signal import sys import time - import docker.errors + from common import logger, util, mqtt from common.device import Device from common.testreport import TestReport @@ -34,8 +34,6 @@ from net_orc import network_orchestrator as net_orc from test_orc import test_orchestrator as test_orc -from docker.errors import ImageNotFound - LOGGER = logger.get_logger('testrun') DEFAULT_CONFIG_FILE = 'local/system.json' @@ -518,7 +516,7 @@ def start_ui(self): hostname='testrun.io', detach=True, ports={'80': 8080}) - except ImageNotFound as ie: + except docker.errors.ImageNotFound as ie: LOGGER.error('An error occured whilst starting the UI. ' + 'Please investigate and try again.') LOGGER.error(ie) @@ -559,7 +557,7 @@ def start_ws(self): '9001': 9001, '1883': 1883 }) - except ImageNotFound as ie: + except docker.errors.ImageNotFound as ie: LOGGER.error('An error occured whilst starting the websockets server. ' + 'Please investigate and try again.') LOGGER.error(ie) diff --git a/framework/python/src/net_orc/ip_control.py b/framework/python/src/net_orc/ip_control.py index cb49d392d..d1a3293ce 100644 --- a/framework/python/src/net_orc/ip_control.py +++ b/framework/python/src/net_orc/ip_control.py @@ -276,7 +276,7 @@ def get_sys_interfaces() -> t.Dict[str, t.Dict[str, str]]: for key in addrs: nic = addrs[key] # Ignore any interfaces that are not ethernet - if not (key.startswith('en') or key.startswith('eth') or key.startswith("wl")): + if not key.startswith('en') or key.startswith('eth'): continue ifaces[key] = nic[0].address From 277845cf02fb4c3e6c0661ed80fcd91e8c778658 Mon Sep 17 00:00:00 2001 From: MariusBaldovin Date: Wed, 29 Jan 2025 13:13:12 +0000 Subject: [PATCH 4/4] corrections --- framework/python/src/api/api.py | 2 +- framework/python/src/net_orc/ip_control.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index a6e814e1c..8e36120d7 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -206,7 +206,7 @@ async def get_sys_interfaces(self): nic = addrs[key] # Ignore any interfaces that are not ethernet - if not key.startswith("en") or key.startswith("eth"): + if not (key.startswith("en") or key.startswith("eth")): continue ifaces[key] = nic[0].address diff --git a/framework/python/src/net_orc/ip_control.py b/framework/python/src/net_orc/ip_control.py index d1a3293ce..73a6aceeb 100644 --- a/framework/python/src/net_orc/ip_control.py +++ b/framework/python/src/net_orc/ip_control.py @@ -276,7 +276,7 @@ def get_sys_interfaces() -> t.Dict[str, t.Dict[str, str]]: for key in addrs: nic = addrs[key] # Ignore any interfaces that are not ethernet - if not key.startswith('en') or key.startswith('eth'): + if not (key.startswith('en') or key.startswith('eth')): continue ifaces[key] = nic[0].address