The purpose is to test the functionality of WoL (Wake-on-LAN) feature on SONiC switch.
For details of WoL feature design, please refer to HLD: Wake-on-LAN in SONiC.
The test is targeting a running SONiC system will fully functioning configuration. The purpose of this test is to verify the function of WoL CLI utility.
The test can run on both physical and virtual testbeds with any topology.
The functional test of WoL depends on NIC capability of target device. In real scenarios, the device waiting for wake up is in low-power mode. In this situation, the network interface is UP but wol packet is not delivered to CPU of device. Instead, the wol packet is handled by NIC and NIC will turn on the device.
In this testplan, the interfaces in PTF are not in low-power mode. We only verify the SONiC switch can send out wol packet as expected. Will not verify the target device can be woken up.
No setup pre-configuration is required, test will setup and clean-up all the configuration.
The test will issue wol
commands with various parameter combinations on DUT, then check if target devices (PTF) can capture the expected packet(s).
- Start
tcpdump
process in PTF to capture WoL packet on spacific interface. Save the captured packets to.pcap
file. - Issue command on DUT host:
- Send magic pattern in ethernet payload:
wol <sonic_interface_name> <target_mac>
(e.g.,wol Ethernet10 00:11:22:33:44:55
) - Send magic pattern in udp payload with ipv4 address:
wol <sonic_interface_name> <target_mac> <udp> <ip-address>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 255.255.255.255
) - Send magic pattern in udp payload with ipv6 address and a specific udp_port:
wol <sonic_interface_name> <target_mac> <udp> <ip-address> <udp-port>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 2404:f801:10::ffff::ffff:ffff --udp-port 1234
)
- Send magic pattern in ethernet payload:
- Stop
tcpdump
process in PTF. - Check if only one wol packet exists in
.pcap
file and the content is expected.
- Start multiple
tcpdump
processes in PTF to capture WoL packet on each interfaces. Save the captured packets to different.pcap
files. - Issue command on DUT host:
- Send magic pattern in ethernet payload:
wol <vlan_name> <target_mac>
. (e.g.,wol Vlan1000 00:11:22:33:44:55
) - Send magic pattern in udp payload with ipv4 address:
wol <vlan_name> <target_mac> <udp> <ip-address>
(e.g.,wol Vlan1000 00:11:22:33:44:55 -u --ip-address 255.255.255.255
) - Send magic pattern in udp payload with ipv6 address and a specific udp_port:
wol <vlan_name> <target_mac> <udp> <ip-address> <udp-port>
(e.g.,wol Vlan1000 00:11:22:33:44:55 -u --ip-address 2404:f801:10::ffff::ffff:ffff --udp-port 1234
)
- Send magic pattern in ethernet payload:
- Stop all
tcpdump
processes in PTF. - For each interface in vlan, check if one wol packet exists in corresponding
.pcap
file and the content is expected. - For each interface not in vlan, check no wol packet exists in corresponding
.pcap
file.
- Start
tcpdump
process in PTF to capture WoL packet on spacific interface. Save the captured packets to.pcap
file. - Issue command on DUT host:
wol <sonic_interface_name> <target_mac> -b
(e.g.,wol Ethernet10 00:11:22:33:44:55 -b
) - Stop
tcpdump
process in PTF. - Check if only one wol packet exists in
.pcap
file and the content is expected. Especially, verify the destination MAC in Ethernet frame header is broadcast MAC address (FF:FF:FF:FF:FF:FF
).
- Start
tcpdump
process in PTF to capture WoL packet on spacific interface. Save the captured packets to.pcap
file. - Issue command on DUT host:
- Send magic pattern in ethernet payload:
wol <sonic_interface_name> <target_mac> -p <password>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -p 192.168.1.1
) - Send magic pattern in udp payload with ipv4 address:
wol <sonic_interface_name> <target_mac> <udp> <ip-address>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 255.255.255.255
-p 11:22:33:44:55:66`) - Send magic pattern in udp payload with ipv6 address and a specific udp_port:
wol <sonic_interface_name> <target_mac> <udp> <ip-address> <udp-port>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 2404:f801:10::ffff::ffff:ffff --udp-port 1234 -p 192.168.123.123
)
- Send magic pattern in ethernet payload:
- Stop
tcpdump
process in PTF. - Check if only one wol packet exists in
.pcap
file and the content is expected. Especially, verify the password in wol packet is same as command.
- Start
tcpdump
process in PTF to capture WoL packet on spacific interface. Save the captured packets to.pcap
file. - Issue command on DUT host:
- Send magic pattern in ethernet payload:
wol <sonic_interface_name> <target_mac> -c <count> -i <interval>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -c 3 -i 2000
) - Send magic pattern in udp payload with ipv4 address:
wol <sonic_interface_name> <target_mac> <udp> <ip-address>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 255.255.255.255 -c 4 -i 1000
) - Send magic pattern in udp payload with ipv6 address and a specific udp_port:
wol <sonic_interface_name> <target_mac> <udp> <ip-address> <udp-port>
(e.g.,wol Ethernet10 00:11:22:33:44:55 -u --ip-address 2404:f801:10::ffff::ffff:ffff --udp-port1234 -c 5 -i 1500
)
- Send magic pattern in ethernet payload:
- Stop
tcpdump
process in PTF. - Check if exact
<count>
wol packets exist in.pcap
file and the content is expected. Moreover, check the time interval between each wol packet in.pcap
file is ALMOST SAME1 as input<interval>
.
- Start multiple
tcpdump
processes in PTF to capture WoL packet on each interfaces. Save the captured packets to different.pcap
files. - Issue command on DUT host:
wol <vlan_name> <target_mac> -c <count> -i <interval>
(e.g.,wol Vlan1000 00:11:22:33:44:55 -c 3 -i 2000
)- Send magic pattern in udp payload with ipv4 address:
wol <vlan_name> <target_mac> <udp> <ip-address>
(e.g.,wol Vlan1000 00:11:22:33:44:55 -u --ip-address 255.255.255.255 -c 4 -i 1000
) - Send magic pattern in udp payload with ipv6 address and a specific udp_port:
wol <vlan_name> <target_mac> <udp> <ip-address> <udp-port>
(e.g.,wol Vlan1000 00:11:22:33:44:55 -u --ip-address 2404:f801:10::ffff::ffff:ffff --udp-port 1234 -c 5 -i 1500
)
- Stop
tcpdump
process in PTF. - For each interface in vlan, check if exact
<count>
wol packets exist in.pcap
file and the content is expected. Moreover, check the time interval between each wol packet in.pcap
file is ALMOST SAME1 as input<interval>
. - For each interface not in vlan, check no wol packet exists in corresponding
.pcap
file.
- Make sure count and interval both exist or not.
- Make sure udp flag is required when using ip address or udp port.
- Make sure udp flag is conflict with mac broadcast flag.
- Make sure interface that receving packet and command line parameter interface are same.
- Make sure target_mac in payload and command line parameter target_mac are same.
- Make sure ip address in header and command line parameter ip_address are same. (Test both ipv4 and ipv6 address with broadcase address or unicast address on VLAN interface or port interface, so there should be 8 combinations, maybe we can leverage pytest parametrize mark to realize that.)
- Make sure when command line parameter ip_address is empty, ip address in header is default value: 255.255.255.255.
- Make sure udp port in header and command line parameter udp port are same.
- Make sure when command line parameter udp_port is empty, udp port in header is default value: 9.