feat(device-plugins): add profiled K1 lifecycle and canonical data plane

This commit is contained in:
DCCONSTRUCTIONS
2026-07-16 19:44:06 +03:00
parent 19ab973110
commit e6f7648b84
45 changed files with 6401 additions and 440 deletions
+26 -4
View File
@@ -31,6 +31,7 @@ from k1link.web.xgrids_k1_facade import (
ACTION_STREAM_STOP,
ACTION_VIEWER_SETTINGS_UPDATE,
XGRIDS_K1_PLUGIN_ID,
CompatibilityAttestationRequest,
ConnectRequest,
ViewerSettingsRequest,
XgridsK1PluginFacade,
@@ -53,8 +54,13 @@ class FakeXgridsService:
self.calls.append(("connect", request))
return {"phase": "connected", "k1_ip": "192.168.1.20"}
def start_live(self, host: str | None, duration_seconds: float) -> dict[str, Any]:
self.calls.append(("live", (host, duration_seconds)))
def start_live(
self,
host: str | None,
duration_seconds: float,
compatibility_attestation: CompatibilityAttestationRequest,
) -> dict[str, Any]:
self.calls.append(("live", (host, duration_seconds, compatibility_attestation)))
return {"phase": "live"}
def start_replay(self, path: str, speed: float, loop: bool) -> dict[str, Any]:
@@ -271,7 +277,12 @@ def test_facade_validates_payload_before_calling_service() -> None:
dispatcher.invoke(
XGRIDS_K1_PLUGIN_ID,
ACTION_NETWORK_PROVISION,
{"device_id": "id", "ssid": "network", "password": "secret", "extra": True},
{
"device_id": "id",
"ssid": "network",
"password": "x" * 24,
"extra": True,
},
)
)
@@ -281,7 +292,18 @@ def test_facade_validates_payload_before_calling_service() -> None:
@pytest.mark.parametrize(
("action_id", "payload", "expected_call"),
[
(ACTION_STREAM_START_LIVE, {"host": "192.168.1.20"}, "live"),
(
ACTION_STREAM_START_LIVE,
{
"host": "192.168.1.20",
"compatibility_attestation": {
"firmware_version": "3.0.2",
"topology": "direct-lan",
"operator_confirmed": True,
},
},
"live",
),
(
ACTION_STREAM_START_REPLAY,
{"path": "sessions/capture.k1mqtt", "speed": 1, "loop": False},