blob: 5bfc6952dba14d447a77d792a267381fd5a4ae50 [file] [log] [blame]
Prashanth Kattibcb7d612019-08-09 06:04:10 -05001*** Settings ***
2Documentation Network stack stress tests using "nping" tool.
3
4Resource ../lib/resource.robot
5
6Library OperatingSystem
7Library String
8Library ../lib/gen_robot_valid.py
9Library ../lib/bmc_network_utils.py
10
11Suite Setup Suite Setup Execution
12
13Force Tags Network_Nping
14
15*** Variables ***
16
17${delay} 1000ms
18${count} 4
19${program_name} nping
20
21*** Test Cases ***
22
23Send ICMP Timestamp Request
24 [Documentation] Send ICMP packet type 13 and check BMC drops such packets
25 [Tags] Send_ICMP_Timestamp_Request
26
27 # Send ICMP packet type 13 to BMC and check packet loss.
28 ${packet_loss}= Send Network Packets And Get Packet Loss
29 ... ${OPENBMC_HOST} ${ICMP_PACKETS} ${NETWORK_PORT} ${ICMP_TIMESTAMP_REQUEST}
30 Should Be Equal ${packet_loss} 100.00
31 ... msg=FAILURE: BMC is not dropping timestamp request messages.
32
33*** Keywords ***
34
35Suite Setup Execution
36 [Documentation] Validate the setup.
37
38 Valid Value OPENBMC_HOST
39 Valid Program program_name
40
41Send Network Packets And Get Packet Loss
42 [Documentation] Send TCP, UDP or ICMP packets to the target.
43 [Arguments] ${host} ${packet_type}=${ICMP_PACKETS} ${port}=80 ${icmp_type}=${ICMP_ECHO_REQUEST}
44
45 # Description of argument(s):
46 # host The host name or IP address of the target system.
47 # packet_type The type of packets to be sent ("tcp, "udp", "icmp").
48 # port Network port.
49 # icmp_type Type of ICMP packets (e.g. 8, 13, 17, etc.).
50
51 # This keyword expects host, port, type and number of packets to be sent
52 # and rate at which packets to be sent, should be given in command line.
53 # By default it sends 4 ICMP echo request packets at 1 packets/second.
54
55 ${cmd_suffix}= Set Variable If '${packet_type}' == 'icmp'
56 ... --icmp-type ${icmp_type}
57 ... -p ${port}
58 ${cmd_buf}= Set Variable --delay ${delay} ${host} -c ${count} --${packet_type} ${cmd_suffix}
59
60 ${nping_result}= Nping ${cmd_buf}
61 [Return] ${nping_result['percent_lost']}