Skip to content

Commit

Permalink
[wol_test] Add udp related tests into wol test plan (#15321)
Browse files Browse the repository at this point in the history
We extended wol tool to support sending magic pattern in udp paylod, and we need to add related tests into test plan.
Related PRs: sonic-net/SONiC#1827, sonic-net/sonic-buildimage#20523

What is the motivation for this PR?
We extended wol tool to support sending magic pattern in udp paylod, and we need to add related tests into test plan.

How did you do it?
Add udp related tests and give some demo commands.
  • Loading branch information
w1nda authored Nov 6, 2024
1 parent f3cf75c commit 2aa8281
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions docs/testplan/WoL-test-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,19 @@ The test will issue `wol` commands with various parameter combinations on DUT, t

#### Test case #1 - Verrify send a wol packet to a specific interface
1. Start `tcpdump` process in PTF to capture WoL packet on spacific interface. Save the captured packets to `.pcap` file.
1. Issue command on DUT host: `wol <sonic_interface_name> <target_mac>` (e.g., `wol Ethernet10 00:11:22:33:44:55`)
1. Issue command on DUT host:
1. Send magic pattern in ethernet payload: `wol <sonic_interface_name> <target_mac>` (e.g., `wol Ethernet10 00:11:22:33:44:55`)
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`)
1. 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`)
1. Stop `tcpdump` process in PTF.
1. Check if only one wol packet exists in `.pcap` file and the content is expected.

#### Test case #2 - Verify send a wol packekt to each member of a vlan
1. Start multiple `tcpdump` processes in PTF to capture WoL packet on each interfaces. Save the captured packets to different `.pcap` files.
1. Issue command on DUT host: `wol <vlan_name> <target_mac>`. (e.g., `wol Vlan1000 00:11:22:33:44:55`)
1. Issue command on DUT host:
1. Send magic pattern in ethernet payload: `wol <vlan_name> <target_mac>`. (e.g., `wol Vlan1000 00:11:22:33:44:55`)
1. 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`)
1. 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`)
1. Stop all `tcpdump` processes in PTF.
1. *For each interface in vlan*, check if one wol packet exists in corresponding `.pcap` file and the content is expected.
1. *For each interface not in vlan*, check no wol packet exists in corresponding `.pcap` file.
Expand All @@ -51,21 +57,43 @@ The test will issue `wol` commands with various parameter combinations on DUT, t

#### Test case #4 - Verify send a wol packet with password
1. Start `tcpdump` process in PTF to capture WoL packet on spacific interface. Save the captured packets to `.pcap` file.
1. Issue command on DUT host: `wol <sonic_interface_name> <target_mac> -p <password>` (e.g., `wol Ethernet10 00:11:22:33:44:55 -p 192.168.1.1`)
1. Issue command on DUT host:
1. 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`)
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`)
1. 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`)
1. Stop `tcpdump` process in PTF.
1. 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.

#### Test case #5 - Verify send multiple wol packets with specific interval to a specific interface
1. Start `tcpdump` process in PTF to capture WoL packet on spacific interface. Save the captured packets to `.pcap` file.
1. Issue command on DUT host: `wol <sonic_interface_name> <target_mac> -c <count> -i <interval>` (e.g., `wol Ethernet10 00:11:22:33:44:55 -c 3 -i 2000`)
1. Issue command on DUT host:
1. 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`)
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 -c 4 -i 1000`)
1. 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`)
1. Stop `tcpdump` process in PTF.
1. 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 SAME[^1] as input `<interval>`.

#### Test case #6 - Verify send multiple wol packets with specific interval to each membor of a vlan
1. Start multiple `tcpdump` processes in PTF to capture WoL packet on each interfaces. Save the captured packets to different `.pcap` files.
1. Issue command on DUT host: `wol <sonic_interface_name> <target_mac> -c <count> -i <interval>` (e.g., `wol Vlan1000 00:11:22:33:44:55 -c 3 -i 2000`)
1. Issue command on DUT host:
1. `wol <vlan_name> <target_mac> -c <count> -i <interval>` (e.g., `wol Vlan1000 00:11:22:33:44:55 -c 3 -i 2000`)
1. 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`)
1. 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`)
1. Stop `tcpdump` process in PTF.
1. *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 SAME[^1] as input `<interval>`.
1. *For each interface not in vlan*, check no wol packet exists in corresponding `.pcap` file.

#### Test case #7 - Verify constrain of parameters
1. Make sure count and interval both exist or not.
1. Make sure udp flag is required when using ip address or udp port.
1. Make sure udp flag is conflict with mac broadcast flag.

#### Test case #8 - Verify parameters can be set correctly by CLI
1. Make sure interface that receving packet and command line parameter interface are same.
1. Make sure target_mac in payload and command line parameter target_mac are same.
1. 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.)
1. Make sure when command line parameter ip_address is empty, ip address in header is default value: 255.255.255.255.
1. Make sure udp port in header and command line parameter udp port are same.
1. Make sure when command line parameter udp_port is empty, udp port in header is default value: 9.

[^1]: ALMOST SAME means we should tolerate small errors caused by electrical characteristics.

0 comments on commit 2aa8281

Please sign in to comment.