Skip to content

Commit

Permalink
Merge branch 'ci/chenge_wlan_to_ethernet' into 'main'
Browse files Browse the repository at this point in the history
ci: change wlan to ethernet

See merge request app-frameworks/esp-matter!977
  • Loading branch information
chshu committed Dec 11, 2024
2 parents b2d92fd + 77ed256 commit 8987489
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions examples/pytest_esp_matter_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import netifaces
from typing import Tuple
from pytest_embedded import Dut
import os
import yaml


CURRENT_DIR_LIGHT = str(pathlib.Path(__file__).parent)+'/light'
CHIP_TOOL_EXE = str(pathlib.Path(__file__).parent)+ '/../connectedhomeip/connectedhomeip/out/host/chip-tool'
Expand Down Expand Up @@ -137,9 +140,20 @@ def test_matter_commissioning_c6(dut:Dut) -> None:

# get the host interface name
def get_host_interface_name() -> str:
interfaces = netifaces.interfaces()
interface_name = [s for s in interfaces if 'wl' in s][0]
return str(interface_name)
home_dir = os.path.expanduser("~")
config_path = os.path.join(home_dir, "config", "env_config.yml")
if os.path.exists(config_path):
with open(config_path, 'r') as file:
config = yaml.safe_load(file)
interface_name = config.get("interface_name")
if interface_name:
return str(interface_name)
else:
print("Warning: Configuration file found but 'interface_name' is not defined.")

if "eth1" in netifaces.interfaces():
return "eth1"
raise Exception("No valid network interface found. Please ensure 'eth1' exists or configure 'interface_name' in config/env_config file.")


# reset host interface
Expand Down

0 comments on commit 8987489

Please sign in to comment.