1e31542beSPrashanth Katti*** Settings *** 2e31542beSPrashanth KattiDocumentation Network security utility file. 3e31542beSPrashanth Katti 4e31542beSPrashanth KattiResource ../lib/resource.robot 5e31542beSPrashanth KattiResource ../lib/bmc_redfish_resource.robot 6e31542beSPrashanth Katti 78f5ec914SGeorge Keishing*** Keywords *** 88f5ec914SGeorge Keishing 9e31542beSPrashanth KattiSend Network Packets And Get Packet Loss 101da8826cSPrashanth Katti [Documentation] Send TCP, UDP or ICMP packets to any network device and return packet loss. 11e31542beSPrashanth Katti [Arguments] ${host} ${num}=${count} ${packet_type}=${ICMP_PACKETS} 12e31542beSPrashanth Katti ... ${port}=80 ${icmp_type}=${ICMP_ECHO_REQUEST} 13e31542beSPrashanth Katti 14e31542beSPrashanth Katti # Description of argument(s): 15e31542beSPrashanth Katti # host The host name or IP address of the target system. 16e31542beSPrashanth Katti # packet_type The type of packets to be sent ("tcp, "udp", "icmp"). 17e31542beSPrashanth Katti # port Network port. 18e31542beSPrashanth Katti # icmp_type Type of ICMP packets (e.g. 8, 13, 17, etc.). 19e31542beSPrashanth Katti # num Number of packets to be sent. 20e31542beSPrashanth Katti 21e31542beSPrashanth Katti # This keyword expects host, port, type and number of packets to be sent 22e31542beSPrashanth Katti # and rate at which packets to be sent, should be given in command line. 23e31542beSPrashanth Katti # By default it sends 4 ICMP echo request packets at 1 packets/second. 24e31542beSPrashanth Katti 25e31542beSPrashanth Katti ${cmd_suffix}= Set Variable If '${packet_type}' == 'icmp' 26e31542beSPrashanth Katti ... --icmp-type ${icmp_type} 27e31542beSPrashanth Katti ... -p ${port} 28e31542beSPrashanth Katti ${cmd_buf}= Set Variable --delay ${delay} ${host} -c ${num} --${packet_type} ${cmd_suffix} 29e31542beSPrashanth Katti 30e31542beSPrashanth Katti ${nping_result}= Nping ${cmd_buf} 31*409df05dSGeorge Keishing RETURN ${nping_result['percent_lost']} 32e31542beSPrashanth Katti 33e31542beSPrashanth Katti 34e31542beSPrashanth KattiSend Network Packets With Flags And Verify Stability 35e31542beSPrashanth Katti [Documentation] Send TCP with flags to the target. 36e31542beSPrashanth Katti [Arguments] ${host} ${num}=${count} ${port}=${REDFISH_INTERFACE} 37e31542beSPrashanth Katti ... ${flags}=${SYN_PACKETS} 38e31542beSPrashanth Katti [Teardown] Verify Interface Stability ${port} 39e31542beSPrashanth Katti 40e31542beSPrashanth Katti # Description of argument(s): 41e31542beSPrashanth Katti # host The host name or IP address of the target system. 42e31542beSPrashanth Katti # packet_type The type of packets to be sent ("tcp, "udp", "icmp"). 43e31542beSPrashanth Katti # port Network port. 44e31542beSPrashanth Katti # flags Type of flag to be set (e.g. SYN, ACK, RST, FIN, ALL). 45e31542beSPrashanth Katti # num Number of packets to be sent. 46e31542beSPrashanth Katti 47e31542beSPrashanth Katti # This keyword expects host, port, type and number of packets to be sent 48e31542beSPrashanth Katti # and rate at which packets to be sent, should be given in command line. 49e31542beSPrashanth Katti # By default it sends 4 ICMP echo request packets at 1 packets/second. 50e31542beSPrashanth Katti 51e31542beSPrashanth Katti ${cmd_suffix}= Catenate -p ${port} --flags ${flags} 52e31542beSPrashanth Katti ${cmd_buf}= Set Variable --delay ${delay} ${host} -c ${num} --${packet_type} ${cmd_suffix} 53e31542beSPrashanth Katti 54e31542beSPrashanth Katti ${nping_result}= Nping ${cmd_buf} 55e31542beSPrashanth Katti Log To Console Packets lost: ${nping_result['percent_lost']} 56