diff --git a/framework/python/src/net_orc/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py index 2099455c5..e410c7848 100644 --- a/framework/python/src/net_orc/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -186,11 +186,16 @@ def _device_discovered(self, mac_addr): # Ignore device if not registered return + # Cleanup any old test files + test_dir = os.path.join(RUNTIME_DIR, TEST_DIR) + device_tests = os.listdir(test_dir) + for device_test in device_tests: + device_test_path = os.path.join(RUNTIME_DIR,TEST_DIR,device_test) + if os.path.isdir(device_test_path): + shutil.rmtree(device_test_path, ignore_errors=True) + device_runtime_dir = os.path.join(RUNTIME_DIR, TEST_DIR, mac_addr.replace(':', '')) - - # Cleanup any old current test files - shutil.rmtree(device_runtime_dir, ignore_errors=True) os.makedirs(device_runtime_dir, exist_ok=True) util.run_command(f'chown -R {util.get_host_user()} {device_runtime_dir}')