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:
parent
e48e024bb3
commit
1f7199cf00
|
@ -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,
|
||||
}
|
||||
)
|
|
@ -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"})
|
Loading…
Reference in New Issue