mirror of
https://gitlab.com/prpl-foundation/prplos/prplos.git
synced 2025-12-20 00:56:07 +08:00
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>
(cherry picked from commit d8602b0e1e)
This commit is contained in:
committed by
Hela Saadani
parent
86c79bb5cd
commit
db2ce83e6b
@@ -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!"
|
||||
|
||||
32
.gitlab/tests/cram/scripts/target/pwhm-usp-events.lua
Normal file
32
.gitlab/tests/cram/scripts/target/pwhm-usp-events.lua
Normal 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")
|
||||
Reference in New Issue
Block a user