diff --git a/supervisor/discovery/services/otbr.py b/supervisor/discovery/services/otbr.py new file mode 100644 index 000000000..24992e59c --- /dev/null +++ b/supervisor/discovery/services/otbr.py @@ -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, + } +) diff --git a/tests/discovery/test_otbr.py b/tests/discovery/test_otbr.py new file mode 100644 index 000000000..52048cfb4 --- /dev/null +++ b/tests/discovery/test_otbr.py @@ -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"})