Add OTBR discovery (#4040)

* Add OTBR discovery

* Fix typo

* Move constants to correct file

* Drop Web Service port

* Use existing port constant
This commit is contained in:
Stefan Agner 2022-12-19 14:05:15 +01:00 committed by GitHub
parent e48e024bb3
commit 1f7199cf00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,13 @@
"""Discovery service for OpenThread Border Router."""
import voluptuous as vol
from ...validate import network_port
from ..const import ATTR_HOST, ATTR_PORT
# pylint: disable=no-value-for-parameter
SCHEMA = vol.Schema(
{
vol.Required(ATTR_HOST): str,
vol.Required(ATTR_PORT): network_port,
}
)

View File

@ -0,0 +1,22 @@
"""Test OTBR discovery."""
import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config
def test_good_config():
"""Test good OTBR config."""
valid_discovery_config(
"otbr",
{"host": "test", "port": 3812},
)
def test_bad_config():
"""Test bad OTBR config."""
with pytest.raises(vol.Invalid):
valid_discovery_config("otbr", {"host": "test"})