1*** Settings *** 2Documentation Verify the port recovery by simulating its disconnection. 3 4# Test Parameters: 5 6# OS_HOST The OS host name or IP Address. 7# OS_USERNAME The OS login userid (usually root). 8# OS_PASSWORD The OS login password. 9# DEVICE_HOST The network device hostname or IP where the ports will 10# be shutdown. 11# DEVICE_USERNAME The network device username. 12# DEVICE_PASSWORD The network device password. 13# PORT_NUMBER The switch port where the server is connected (e.g. 14# "1", "2", etc). 15# NET_INTERFACE The network interface name that will be tested (e.g. 16# "enP5s1f0", "eth0"). 17 18Library ../lib/bmc_ssh_utils.py 19Resource ../lib/resource.robot 20Resource ../lib/os_utilities.robot 21 22Suite Setup Test Setup Execution 23 24Test Tags Cable_Pull_Recover 25 26*** Variables *** 27 28${PORT_NUMBER} ${EMPTY} 29 30*** Test Cases *** 31 32Verify Network Interface Recovery 33 [Documentation] Test the recovery of the network interface that has been 34 ... shutdown from the switch port. 35 [Tags] Verify_Network_Interface_Recovery 36 37 Printn 38 Set Switch Port State DOWN 39 Set Switch Port State UP 40 41*** Keywords *** 42 43Set Switch Port State 44 [Documentation] Disable the port connected to the server. 45 [Arguments] ${port_number}=${PORT_NUMBER} ${state}=${EMPTY} 46 47 # Description of argument(s): 48 # port_number The switch port where the server is connected (e.g. 49 # "1", "2", etc). 50 # state The state to be set in the network interface ("UP" or 51 # "DOWN"). 52 53 Device Write enable 54 Device Write configure terminal 55 Device Write interface port ${PORT_NUMBER} 56 Run Keyword If '${state}' == 'DOWN' 57 ... Device Write shutdown 58 ... ELSE 59 ... Device Write no shutdown 60 Wait Until Keyword Succeeds 30 sec 5 sec 61 ... Check Network Interface State ${state} 62 63Check Network Interface State 64 [Documentation] Check the status of the network interface. 65 [Arguments] ${NET_INTERFACE}=${NET_INTERFACE} ${state}=${EMPTY} 66 67 # Description of argument(s): 68 # NET_INTERFACE The network interface name that will be tested (e.g. 69 # "enP5s1f0", "eth0"). 70 # state The network interface expected state ("UP" or "DOWN"). 71 72 ${stdout} ${stderr} ${rc}= OS Execute Command 73 ... ip link | grep "${NET_INTERFACE}" | cut -d " " -f9 74 Should Contain ${stdout} ${state} msg=State not found as expected. 75 76Test Setup Execution 77 [Documentation] Do suite setup tasks. 78 79 Should Not Be Empty ${PORT_NUMBER} 80 Should Not Be Empty ${NET_INTERFACE} 81