From 36da928bdc3fd3f4af382e079b4997e6d11a363c Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 26 Jun 2024 13:34:35 +0800 Subject: [PATCH] tests: Add Get Endpoint ID test Add a small test for the MCTP Control Protocol responder implementation in mctpd. In this case, ensure that we can receive and respond to a Get Endpoint ID request. Signed-off-by: Jeremy Kerr --- tests/test_mctpd.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_mctpd.py b/tests/test_mctpd.py index 052e0a4..ae27938 100644 --- a/tests/test_mctpd.py +++ b/tests/test_mctpd.py @@ -368,3 +368,25 @@ async def test_assign_endpoint_static_varies(dbus, mctpd): await mctp.call_assign_endpoint_static(iface.name, dev.lladdr, 13) assert str(ex.value) == "Already assigned a different EID" + +""" Test that the mctpd control protocol responder support has support +for a basic Get Endpoint ID command""" +async def test_get_endpoint_id(dbus, mctpd): + iface = mctpd.system.interfaces[0] + dev = mctpd.network.endpoints[0] + mctp = await mctpd_mctp_obj(dbus) + dev.eid = 12 + + mctpd.system.add_route(mctpd.system.Route(iface, dev.eid, 0)) + mctpd.system.add_neighbour( + mctpd.system.Neighbour(iface, dev.lladdr, dev.eid) + ) + + rsp = await dev.send_control(mctpd.network.mctp_socket, 0x02) + + # command code + assert rsp[1] == 0x02 + # completion code indicates success + assert rsp[2] == 0x00 + # EID matches the system + assert rsp[3] == mctpd.system.addresses[0].eid