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
5 changes: 3 additions & 2 deletions framework/python/src/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ async def delete_device(self, request: Request, response: Response):
mac_addr = device_json.get("mac_addr").lower()

# Check that device exists
device = self._sesison.get_device(mac_addr)
device = self._test_run.get_session().get_device(mac_addr)

if device is None:
response.status_code = 404
Expand All @@ -280,7 +280,8 @@ async def delete_device(self, request: Request, response: Response):
return self._generate_msg(True, "Successfully deleted the device")

# TODO: Find specific exception to catch
except Exception:
except Exception as e:
LOGGER.error(e)
response.status_code = 500
return self._generate_msg(False, "An error occured whilst deleting " +
"the device")
Expand Down
5 changes: 2 additions & 3 deletions framework/python/src/core/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,8 @@ def delete_device(self, device: Device):
LOCAL_DEVICES_DIR,
device.device_folder)

# TODO: Remove associated testrun reports from session

# Delete the device directory
os.rmdir(device_folder)
shutil.rmtree(device_folder)

# Remove the device from the current session device repository
self.get_session().remove_device(device)
Expand Down Expand Up @@ -409,6 +407,7 @@ def _device_stable(self, mac_addr):
LOGGER.info(f'Device with mac address {mac_addr} is ready for testing.')
result = self._test_orc.run_test_modules()
self._set_status(result)
self._stop_network()

def get_session(self):
return self._session
Expand Down
4 changes: 3 additions & 1 deletion framework/python/src/net_orc/network_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self,
os.path.dirname(os.path.dirname(os.path.realpath(__file__))))))

self.validator = NetworkValidator()
shutil.rmtree(os.path.join(os.getcwd(), NET_DIR), ignore_errors=True)
self.network_config = NetworkConfig()
self._ovs = OVSControl(self._session)
self._ip_ctrl = IPControl()
Expand All @@ -71,6 +70,9 @@ def start(self):

LOGGER.debug('Starting network orchestrator')

# Delete the runtime/network directory
shutil.rmtree(os.path.join(os.getcwd(), NET_DIR), ignore_errors=True)

# Get all components ready
self.load_network_modules()

Expand Down
6 changes: 3 additions & 3 deletions framework/python/src/test_orc/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _timestamp_results(self, device):
# Copy the results to the timestamp directory
# leave current copy in place for quick reference to
# most recent test
shutil.copytree(cur_results_dir, completed_results_dir)
shutil.copytree(cur_results_dir, completed_results_dir, dirs_exist_ok=True)
util.run_command(f"chown -R {self._host_user} '{completed_results_dir}'")

def test_in_progress(self):
Expand Down Expand Up @@ -366,8 +366,8 @@ def _run_test_module(self, module):
except (FileNotFoundError, PermissionError,
json.JSONDecodeError) as results_error:
LOGGER.error(
f"Error occured whilst obbtaining results for module {module.name}")
LOGGER.debug(results_error)
f"Error occurred whilst obtaining results for module {module.name}")
LOGGER.error(results_error)

LOGGER.info(f"Test module {module.name} has finished")

Expand Down
2 changes: 1 addition & 1 deletion modules/test/conn/python/src/connection_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _connection_single_ip(self):
# message-type, option 3 = DHCPREQUEST
if 'message-type' in option and option[1] == 3:
mac_address = packet[Ether].src
LOGGER.info('DHCPREQUEST detected MAC addres: ' + mac_address)
LOGGER.info('DHCPREQUEST detected MAC address: ' + mac_address)
if not mac_address.startswith(TR_CONTAINER_MAC_PREFIX):
mac_addresses.add(mac_address.upper())

Expand Down