1173afd0fSDaniel Gonzalez*** Settings *** 2173afd0fSDaniel GonzalezDocumentation Verify the port recovery by simulating its disconnection. 3173afd0fSDaniel Gonzalez 4173afd0fSDaniel Gonzalez# Test Parameters: 5173afd0fSDaniel Gonzalez 6173afd0fSDaniel Gonzalez# OS_HOST The OS host name or IP Address. 7173afd0fSDaniel Gonzalez# OS_USERNAME The OS login userid (usually root). 8173afd0fSDaniel Gonzalez# OS_PASSWORD The OS login password. 9173afd0fSDaniel Gonzalez# DEVICE_HOST The network device hostname or IP where the ports will 10173afd0fSDaniel Gonzalez# be shutdown. 11173afd0fSDaniel Gonzalez# DEVICE_USERNAME The network device username. 12173afd0fSDaniel Gonzalez# DEVICE_PASSWORD The network device password. 13173afd0fSDaniel Gonzalez# PORT_NUMBER The switch port where the server is connected (e.g. 14173afd0fSDaniel Gonzalez# "1", "2", etc). 15173afd0fSDaniel Gonzalez# NET_INTERFACE The network interface name that will be tested (e.g. 16173afd0fSDaniel Gonzalez# "enP5s1f0", "eth0"). 17173afd0fSDaniel Gonzalez 18173afd0fSDaniel GonzalezLibrary ../lib/bmc_ssh_utils.py 19839a0c27SSandhya SomashekarResource ../lib/resource.robot 20173afd0fSDaniel GonzalezResource ../syslib/utils_os.robot 21173afd0fSDaniel Gonzalez 22173afd0fSDaniel GonzalezSuite Setup Test Setup Execution 23173afd0fSDaniel Gonzalez 24173afd0fSDaniel Gonzalez*** Variables *** 25173afd0fSDaniel Gonzalez 26173afd0fSDaniel Gonzalez${PORT_NUMBER} ${EMPTY} 27173afd0fSDaniel Gonzalez 28173afd0fSDaniel Gonzalez*** Test Cases *** 29173afd0fSDaniel Gonzalez 30173afd0fSDaniel GonzalezVerify Network Interface Recovery 31173afd0fSDaniel Gonzalez [Documentation] Test the recovery of the network interface that has been 32173afd0fSDaniel Gonzalez ... shutdown from the switch port. 33173afd0fSDaniel Gonzalez [Tags] Verify_Network_Interface_Recovery 34173afd0fSDaniel Gonzalez 35*c108e429SMichael Walsh Printn 36173afd0fSDaniel Gonzalez Set Switch Port State DOWN 37173afd0fSDaniel Gonzalez Set Switch Port State UP 38173afd0fSDaniel Gonzalez 39173afd0fSDaniel Gonzalez*** Keywords *** 40173afd0fSDaniel Gonzalez 41173afd0fSDaniel GonzalezSet Switch Port State 42173afd0fSDaniel Gonzalez [Documentation] Disable the port connected to the server. 43173afd0fSDaniel Gonzalez [Arguments] ${port_number}=${PORT_NUMBER} ${state}=${EMPTY} 44173afd0fSDaniel Gonzalez 45173afd0fSDaniel Gonzalez # Description of argument(s): 46173afd0fSDaniel Gonzalez # port_number The switch port where the server is connected (e.g. 47173afd0fSDaniel Gonzalez # "1", "2", etc). 48173afd0fSDaniel Gonzalez # state The state to be set in the network interface ("UP" or 49173afd0fSDaniel Gonzalez # "DOWN"). 50173afd0fSDaniel Gonzalez 51173afd0fSDaniel Gonzalez Device Write enable 52173afd0fSDaniel Gonzalez Device Write configure terminal 53173afd0fSDaniel Gonzalez Device Write interface port ${PORT_NUMBER} 54173afd0fSDaniel Gonzalez Run Keyword If '${state}' == 'DOWN' 55173afd0fSDaniel Gonzalez ... Device Write shutdown 56173afd0fSDaniel Gonzalez ... ELSE 57173afd0fSDaniel Gonzalez ... Device Write no shutdown 58173afd0fSDaniel Gonzalez Wait Until Keyword Succeeds 30 sec 5 sec 59173afd0fSDaniel Gonzalez ... Check Network Interface State ${state} 60173afd0fSDaniel Gonzalez 61173afd0fSDaniel GonzalezCheck Network Interface State 62173afd0fSDaniel Gonzalez [Documentation] Check the status of the network interface. 63173afd0fSDaniel Gonzalez [Arguments] ${NET_INTERFACE}=${NET_INTERFACE} ${state}=${EMPTY} 64173afd0fSDaniel Gonzalez 65173afd0fSDaniel Gonzalez # Description of argument(s): 66173afd0fSDaniel Gonzalez # NET_INTERFACE The network interface name that will be tested (e.g. 67173afd0fSDaniel Gonzalez # "enP5s1f0", "eth0"). 68173afd0fSDaniel Gonzalez # state The network interface expected state ("UP" or "DOWN"). 69173afd0fSDaniel Gonzalez 70173afd0fSDaniel Gonzalez ${stdout} ${stderr} ${rc}= OS Execute Command 71173afd0fSDaniel Gonzalez ... ip link | grep "${NET_INTERFACE}" | cut -d " " -f9 72173afd0fSDaniel Gonzalez Should Contain ${stdout} ${state} msg=State not found as expected. 73173afd0fSDaniel Gonzalez 74173afd0fSDaniel GonzalezTest Setup Execution 75173afd0fSDaniel Gonzalez [Documentation] Do suite setup tasks. 76173afd0fSDaniel Gonzalez 77173afd0fSDaniel Gonzalez Should Not Be Empty ${PORT_NUMBER} 78173afd0fSDaniel Gonzalez Should Not Be Empty ${NET_INTERFACE} 79