Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions framework/python/src/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def __init__(self, test_run):
self._router.add_api_route("/device/edit",
self.edit_device,
methods=["POST"])

self._router.add_api_route("/system/modules",
self.get_test_modules)

# Allow all origins to access the API
origins = ["*"]
Expand Down Expand Up @@ -545,6 +548,20 @@ async def get_results(self, response: Response,
response.status_code = 404
return self._generate_msg(False, "Test results could not be found")

async def get_test_modules(self):

LOGGER.debug("Received request to list test modules")

test_modules = []

for test_module in self._get_test_run().get_test_orc().get_test_modules():

# Only add module if it is an actual, enabled test module
if (test_module.enabled and test_module.enable_container):
test_modules.append(test_module.display_name)

return test_modules

def _validate_device_json(self, json_obj):

# Check all required properties are present
Expand All @@ -569,3 +586,6 @@ def _validate_device_json(self, json_obj):
return False

return True

def _get_test_run(self):
return self._test_run
13 changes: 9 additions & 4 deletions framework/python/src/core/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,18 @@ def __init__(self,
if validate:
self._session.add_runtime_param('validate')

self.load_all_devices()

self._net_orc = net_orc.NetworkOrchestrator(
session=self._session)
self._test_orc = test_orc.TestOrchestrator(
self._session,
self._net_orc)

# Load device repository
self.load_all_devices()

# Load test modules
self._test_orc.start()

if self._no_ui:

# Check Testrun is able to start
Expand Down Expand Up @@ -311,8 +315,6 @@ def start(self):
if self._net_only:
LOGGER.info('Network only option configured, no tests will be run')
else:
self._test_orc.start()

self.get_net_orc().get_listener().register_callback(
self._device_stable,
[NetworkEvent.DEVICE_STABLE]
Expand Down Expand Up @@ -369,6 +371,9 @@ def get_config_file(self):
def get_net_orc(self):
return self._net_orc

def get_test_orc(self):
return self._test_orc

def _start_network(self):
# Start the network orchestrator
if not self.get_net_orc().start():
Expand Down