Add veilid_features API and logging

This commit is contained in:
Brandon Vandegrift 2025-05-02 19:20:02 -04:00
parent ec887d3bec
commit 81b265e4bf
21 changed files with 140 additions and 8 deletions

View file

@ -44,6 +44,13 @@ async def test_version(api_connection: veilid.VeilidAPI):
print(f"veilid_version_string: {vstr}")
@pytest.mark.asyncio
async def test_features(api_connection: veilid.VeilidAPI):
features = await api_connection.veilid_features()
print(f"veilid_features: {features}")
assert isinstance(features, list)
@pytest.mark.asyncio
async def test_config(api_connection: veilid.VeilidAPI):
cfgstr = await api_connection.default_veilid_config()

View file

@ -462,6 +462,10 @@ class VeilidAPI(ABC):
async def veilid_version_string(self) -> str:
pass
@abstractmethod
async def veilid_features(self) -> list[str]:
pass
@abstractmethod
async def veilid_version(self) -> types.VeilidVersion:
pass

View file

@ -490,6 +490,9 @@ class _JsonVeilidAPI(VeilidAPI):
v = await self.send_ndjson_request(Operation.VEILID_VERSION)
return VeilidVersion(v["major"], v["minor"], v["patch"])
async def veilid_features(self) -> list[str]:
return raise_api_result(await self.send_ndjson_request(Operation.VEILID_FEATURES))
async def default_veilid_config(self) -> str:
return raise_api_result(await self.send_ndjson_request(Operation.DEFAULT_VEILID_CONFIG))

View file

@ -29,6 +29,7 @@ class Operation(StrEnum):
DEBUG = "Debug"
VEILID_VERSION_STRING = "VeilidVersionString"
VEILID_VERSION = "VeilidVersion"
VEILID_FEATURES = "VeilidFeatures"
DEFAULT_VEILID_CONFIG = "DefaultVeilidConfig"

View file

@ -2479,6 +2479,27 @@
"type": "string"
}
}
},
{
"type": "object",
"required": [
"op",
"value"
],
"properties": {
"op": {
"type": "string",
"enum": [
"VeilidFeatures"
]
},
"value": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
],
"required": [

View file

@ -1617,6 +1617,20 @@
}
}
},
{
"type": "object",
"required": [
"op"
],
"properties": {
"op": {
"type": "string",
"enum": [
"VeilidFeatures"
]
}
}
},
{
"type": "object",
"required": [