blob: b9a81c061b97f28f53240a1b27d36489f2d8cc24 [file] [log] [blame]
Prashanth Katti01293ef2017-02-16 08:20:20 -06001*** Settings ***
2Documentation Network stack stress tests using "nping" tool.
3
4Resource ../lib/resource.txt
5
6Library OperatingSystem
7Library String
8
9Suite Setup Validate Setup
10
11*** Variables ***
12
13${delay} 200ms
14${count} 100
15${bmc_packet_loss} ${EMPTY}
16
17*** Test Cases ***
18
19Verify Zero Network Packet Loss On BMC
20 [Documentation] Pump network packets to target.
21 [Tags] Verify_Zero_Network_Packet_Loss_On_BMC
22
23 # Send packets to BMC and check packet loss.
24 ${bmc_packet_loss}= Send Network Packets
25 ... ${OPENBMC_HOST} ${PACKET_TYPE} ${NETWORK_PORT}
26 Should Contain
27 ... ${bmc_packet_loss} Lost: 0 (0.00%) msg=Fail, Packet loss on BMC.
28
29*** Keywords ***
30
31Validate Setup
32 [Documentation] Validate the setup.
33
34 Should Not Be Empty ${OPENBMC_HOST} msg=BMC IP address not provided.
35 ${output}= Run which nping
36 Should Not Be Empty ${output} msg="nping" tool not installed.
37
38Send Network Packets
39 [Documentation] Send TCP, UDP or ICMP packets to the target.
40 [Arguments] ${host} ${packet_type}=tcp ${port}=80
41
42 # Description of arguments:
43 # ${host}- Target system to which network packets to be sent.
44 # ${packet_type}- type of packets to be sent viz tcp, udp or icmp.
45 # ${port}- Network port.
46
47 # This program expects host, port, type and number of packets to be sent
48 # and rate at which packets to be sent, should be given in commad line
49 # by default it sends 100 TCP packets at 5 packets/second.
50
51 ${cmd_buff}= Run Keyword If '${packet_type}' == 'icmp'
52 ... Set Variable nping --delay ${delay} ${host} -c ${count} --${packet_type}
53 ... ELSE
54 ... Set variable
55 ... nping --delay ${delay} ${host} -c ${count} -p ${port} --${packet_type}
56 ${rc} ${output} Run And Return RC And Output ${cmd_buff}
57 Should Be Equal As Integers ${rc} 0 msg=Command execution failed.
58 ${packet_loss} Get Packet Loss ${host} ${output}
59 [Return] ${packet_loss}
60
61Get Packet Loss
62 [Documentation] Check packet loss percentage.
63
64 # Sample Output from "nping" command:
65 # Starting Nping 0.6.47 ( http://nmap.org/nping ) at 2017-02-21 22:05 IST
66 # SENT (0.0181s) TCP Source IP:37577 > Destination IP:80 S ttl=64 id=39113 iplen=40 seq=629782493 win=1480
67 # SENT (0.2189s) TCP Source IP:37577 > Destination IP:80 S ttl=64 id=39113 iplen=40 seq=629782493 win=1480
68 # RCVD (0.4120s) TCP Destination IP:80 > Source IP:37577 SA ttl=49 id=0 iplen=44 seq=1078301364 win=5840 <mss 1380>
69 # Max rtt: 193.010ms | Min rtt: 193.010ms | Avg rtt: 193.010ms
70 # Raw packets sent: 2 (80B) | Rcvd: 1 (46B) | Lost: 1 (50.00%)
71 # Nping done: 1 IP address pinged in 0.43 seconds
72
73 [Arguments] ${host} ${traffic_details}
74
75 # Description of arguments:
76 # ${host}- System on which packet loss to be checked.
77 # ${traffic_details}- Details of the network traffic sent.
78
79 ${summary}= Get Lines Containing String ${traffic_details} Rcvd:
80 Log To Console \nPacket loss summary on ${host}\n*********************
81 [Return] ${summary}