ci: cram: add WoL packet transmission test
Add a CRAM test that verifies Wake-on-LAN packet transmission through the Device.Ethernet.WolL.SendMagicPacket RPC. Use tcpdump to capture the generated UDP port 9 packet and validate it in CI. References: PCF-1774, FEAT-74 Signed-off-by: jim_yang <jim_yang@sdc.sercomm.com>
This commit is contained in:
parent
a5fc999bf1
commit
4820c39fd9
32
.gitlab/tests/cram/generic/wol-packet.t
Normal file
32
.gitlab/tests/cram/generic/wol-packet.t
Normal file
@ -0,0 +1,32 @@
|
||||
Verify that a Wake-on-LAN packet is transmitted (broadcast UDP/9)
|
||||
This test only verifies that the DUT sends a WoL packet; no receiver is required.
|
||||
|
||||
$ rm -f "$CRAMTMP/wol.cap"
|
||||
$ alias R="${CRAM_REMOTE_COMMAND:-}"
|
||||
|
||||
Start local capture on testbed PC:
|
||||
|
||||
$ sudo tcpdump -p -i "$TESTBED_LAN_INTERFACE" -c 1 -nn -e udp port 9 >"$CRAMTMP/wol.cap" 2>&1 &
|
||||
$ TCPDUMP_PID="$!"
|
||||
$ sleep 1
|
||||
|
||||
Trigger WoL RPC first try:
|
||||
|
||||
$ R "ba-cli 'Device.Ethernet.WoL.SendMagicPacket(MACAddress=\"02:00:00:00:00:01\", Password=\"\")' >/dev/null 2>&1 || true"
|
||||
$ sleep 1
|
||||
|
||||
Retry only if UDP is not yet captured:
|
||||
|
||||
$ if ! grep -q 'UDP' "$CRAMTMP/wol.cap" 2>/dev/null; then R "ba-cli 'Device.Ethernet.WoL.SendMagicPacket(MACAddress=\"02:00:00:00:00:01\", Password=\"\")' >/dev/null 2>&1 || true"; fi
|
||||
$ sleep 1
|
||||
$ if ! grep -q 'UDP' "$CRAMTMP/wol.cap" 2>/dev/null; then R "ba-cli 'Device.Ethernet.WoL.SendMagicPacket(MACAddress=\"02:00:00:00:00:01\", Password=\"\")' >/dev/null 2>&1 || true"; fi
|
||||
$ sleep 1
|
||||
|
||||
Cleanup capture process if still running:
|
||||
|
||||
$ sudo kill -9 "$TCPDUMP_PID" >/dev/null 2>&1 || true
|
||||
|
||||
Assert that a UDP packet was sent:
|
||||
|
||||
$ grep -m1 'UDP' "$CRAMTMP/wol.cap"
|
||||
.*UDP.* (re)
|
||||
Loading…
Reference in New Issue
Block a user