1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Add network interface settings for mDNS/LLMNR (#5520)

This commit is contained in:
Igor Yamolov
2025-09-04 13:18:11 +02:00
committed by GitHub
parent 7ed83a15fe
commit 236c39cbb0
11 changed files with 157 additions and 7 deletions

View File

@@ -88,6 +88,8 @@ async def test_api_network_interface_info(api_client: TestClient, interface_id:
]
assert result["data"]["ipv6"]["ready"] is True
assert result["data"]["interface"] == TEST_INTERFACE_ETH_NAME
assert result["data"]["mdns"] == "announce"
assert result["data"]["llmnr"] == "announce"
async def test_api_network_interface_info_default(api_client: TestClient):
@@ -109,6 +111,8 @@ async def test_api_network_interface_info_default(api_client: TestClient):
]
assert result["data"]["ipv6"]["ready"] is True
assert result["data"]["interface"] == TEST_INTERFACE_ETH_NAME
assert result["data"]["mdns"] == "announce"
assert result["data"]["llmnr"] == "announce"
@pytest.mark.parametrize(
@@ -278,6 +282,33 @@ async def test_api_network_interface_update_wifi_error(api_client: TestClient):
)
async def test_api_network_interface_update_mdns(
api_client: TestClient,
coresys: CoreSys,
network_manager_service: NetworkManagerService,
connection_settings_service: ConnectionSettingsService,
):
"""Test network manager API update with mDNS/LLMNR mode."""
network_manager_service.CheckConnectivity.calls.clear()
connection_settings_service.Update.calls.clear()
resp = await api_client.post(
f"/network/interface/{TEST_INTERFACE_ETH_NAME}/update",
json={
"mdns": "resolve",
"llmnr": "off",
},
)
result = await resp.json()
assert result["result"] == "ok"
assert len(connection_settings_service.Update.calls) == 1
settings = connection_settings_service.Update.calls[0][0]
assert "connection" in settings
assert settings["connection"]["mdns"] == Variant("i", 1)
assert settings["connection"]["llmnr"] == Variant("i", 0)
async def test_api_network_interface_update_remove(api_client: TestClient):
"""Test network manager api."""
resp = await api_client.post(
@@ -380,7 +411,7 @@ async def test_api_network_vlan(
settings_service.AddConnection.calls.clear()
resp = await api_client.post(
f"/network/interface/{TEST_INTERFACE_ETH_NAME}/vlan/1",
json={"ipv4": {"method": "auto"}},
json={"ipv4": {"method": "auto"}, "llmnr": "off"},
)
result = await resp.json()
assert result["result"] == "ok"
@@ -391,8 +422,8 @@ async def test_api_network_vlan(
assert connection["connection"] == {
"id": Variant("s", "Supervisor eth0.1"),
"type": Variant("s", "vlan"),
"llmnr": Variant("i", 2),
"mdns": Variant("i", 2),
"mdns": Variant("i", -1), # Default mode
"llmnr": Variant("i", 0),
"autoconnect": Variant("b", True),
"uuid": connection["connection"]["uuid"],
}