fix(mcp): let link_list return kernel_datapath

The tool descriptions have always advertised kernel_datapath as a
requestable field, but the handler's whitelist did not contain it: asking
for it was rejected as an invalid field, so the MCP clients could not see
which links run on kernel interfaces at all.

Also record what seeding a netem experiment on IOU costs: IOL emits its own
CDP/keepalive frames and they draw from the netem RNG stream, so a
seeded run only reproduces after `no cdp run` (verified bit-identical pcaps).
This commit is contained in:
YueGuobin committed 2026-10-06 00:21:09 +08:00
1 parent 4fa7f158fd
commit 6633304e97
3 files changed
+25

No files matched your search

+15
View File
@@ -425,6 +425,21 @@ class TestLink:
result = get_links_handler({"project_id": "p1", "fields": ["link_id"]}, ctx)
assert result["links"] == [{"link_id": "l1"}]
def test_list_can_ask_for_kernel_datapath(self, ctx):
"""
The datapath is a field the tool descriptions always advertised, so
it has to be requestable: a whitelist missing it rejected
fields=["kernel_datapath"] and made link_list unable to report which
links run on kernel interfaces.
"""
from gns3server.agent.gns3_copilot.gns3_client.api_handlers import get_links_handler
with patch(f"{AH}._get_connector") as m:
m.return_value = _mock_conn([{"link_id": "l1", "link_type": "ethernet", "kernel_datapath": True}])
result = get_links_handler({"project_id": "p1", "fields": ["link_id", "kernel_datapath"]}, ctx)
assert result["links"] == [{"link_id": "l1", "kernel_datapath": True}]
def test_get(self, ctx):
from gns3server.agent.gns3_copilot.gns3_client.api_handlers import get_link_handler