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