From 3c0438ef9880b99aad8528b1063acc76c2abf16a Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Tue, 14 Nov 2023 17:15:59 +0000 Subject: [PATCH] Forecaster component: - Extended tests/Tools to allow setting client endpoints in test descriptors - Minor code cleanup --- src/forecaster/tests/Tools.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/forecaster/tests/Tools.py b/src/forecaster/tests/Tools.py index 9968eaea9..d55d1e5de 100644 --- a/src/forecaster/tests/Tools.py +++ b/src/forecaster/tests/Tools.py @@ -56,7 +56,7 @@ def read_csv(csv_file : str) -> pandas.DataFrame: return df -def compose_descriptors(df : pandas.DataFrame) -> Dict: +def compose_descriptors(df : pandas.DataFrame, num_client_endpoints : int = 0) -> Dict: devices = dict() links = dict() @@ -72,11 +72,17 @@ def compose_descriptors(df : pandas.DataFrame) -> Dict: dst_port_uuid = row.source if src_device_uuid not in devices: - devices[src_device_uuid] = {'id': src_device_uuid, 'endpoints': set()} + endpoints = set() + for num_client_endpoint in range(num_client_endpoints): + endpoints.add('client:{:d}'.format(num_client_endpoint)) + devices[src_device_uuid] = {'id': src_device_uuid, 'endpoints': endpoints} devices[src_device_uuid]['endpoints'].add(src_port_uuid) if dst_device_uuid not in devices: - devices[dst_device_uuid] = {'id': dst_device_uuid, 'endpoints': set()} + endpoints = set() + for num_client_endpoint in range(num_client_endpoints): + endpoints.add('client:{:d}'.format(num_client_endpoint)) + devices[dst_device_uuid] = {'id': dst_device_uuid, 'endpoints': endpoints} devices[dst_device_uuid]['endpoints'].add(dst_port_uuid) if link_uuid not in links: -- GitLab