ci: cram: wifi-usp.t: add pwhm usp events check

This commit adds a test to verify that USP events are raised through
the pwhm USP direct socket

Closes: PPW-1259
References: PPW-1208

Signed-off-by: Houssem Dafdouf <houssem.dafdouf_ext@softathome.com>
This commit is contained in:
Houssem Dafdouf
2025-12-03 16:08:20 +01:00
committed by Hela Saadani
parent b6d432b684
commit d8602b0e1e
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#!/usr/bin/lua
local req_object = arg[1]
local req_event = arg[2]
local lamx = require 'lamx'
local usp_backend_config = {
usp = {
EndpointID = 'proto::local_controller'
}
}
lamx.backend.load("/usr/bin/mods/usp/mod-amxb-usp.so")
lamx.backend.push_config(usp_backend_config)
lamx.bus.open("usp:/var/run/pwhm_usp.sock")
local el = lamx.eventloop.new()
local print_event = function(event, data)
if event == req_event then
print("Event " .. event)
table.dump(data)
el:stop()
end
end
local sub = lamx.bus.subscribe(req_object, print_event);
el:start()
--lamx.bus.ubsubscribe(sub)
lamx.backend.remove("usp")

View File

@@ -1,6 +1,8 @@
Create R alias:
$ alias R="${CRAM_REMOTE_COMMAND:-}"
$ alias C="${CRAM_REMOTE_COPY:-}"
$ C ${TESTDIR}/../scripts/target/pwhm-usp-events.lua root@${TARGET_LAN_IP}:/tmp/event.lua 2>/dev/null
$ R logger -t cram "Starting pwhm direct USP socket test ..."
@@ -14,4 +16,29 @@ Check if there is at least one connected client (should be beerocks processes):
$ R "netstat -ap 2>/dev/null | grep 'CONNECTED.*pwhm_usp.sock'| wc -l"
[1-9]$ (re)
Test USP events:
$ R "lua /tmp/event.lua 'Device.WiFi.AccessPoint.1.Enable!' 'dm:object-changed' > /tmp/pwhm_usp_events &"
$ R "ba-cli WiFi.AccessPoint.1.Enable=1" > /dev/null 2>&1
$ sleep 5
$ R "cat /tmp/pwhm_usp_events"
Event dm:object-changed
{
object = "Device.WiFi.AccessPoint.1.",
parameters = {
Enable = {
from = "",
to = "true"
}
},
path = "Device.WiFi.AccessPoint.1."
}
$ R "ba-cli WiFi.AccessPoint.1.Enable=0" > /dev/null 2>&1
$ sleep 5
$ R logger -t cram "Test finished!"