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