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 20a28061a0SGeorge KeishingResource ../lib/os_utilities.robot 21173afd0fSDaniel Gonzalez 22173afd0fSDaniel GonzalezSuite Setup Test Setup Execution 23173afd0fSDaniel Gonzalez 24*6fb70d98SMatt FischerTest Tags Cable_Pull_Recover 2587dc442cSGeorge Keishing 26173afd0fSDaniel Gonzalez*** Variables *** 27173afd0fSDaniel Gonzalez 28173afd0fSDaniel Gonzalez${PORT_NUMBER} ${EMPTY} 29173afd0fSDaniel Gonzalez 30173afd0fSDaniel Gonzalez*** Test Cases *** 31173afd0fSDaniel Gonzalez 32173afd0fSDaniel GonzalezVerify Network Interface Recovery 33173afd0fSDaniel Gonzalez [Documentation] Test the recovery of the network interface that has been 34173afd0fSDaniel Gonzalez ... shutdown from the switch port. 35173afd0fSDaniel Gonzalez [Tags] Verify_Network_Interface_Recovery 36173afd0fSDaniel Gonzalez 37c108e429SMichael Walsh Printn 38173afd0fSDaniel Gonzalez Set Switch Port State DOWN 39173afd0fSDaniel Gonzalez Set Switch Port State UP 40173afd0fSDaniel Gonzalez 41173afd0fSDaniel Gonzalez*** Keywords *** 42173afd0fSDaniel Gonzalez 43173afd0fSDaniel GonzalezSet Switch Port State 44173afd0fSDaniel Gonzalez [Documentation] Disable the port connected to the server. 45173afd0fSDaniel Gonzalez [Arguments] ${port_number}=${PORT_NUMBER} ${state}=${EMPTY} 46173afd0fSDaniel Gonzalez 47173afd0fSDaniel Gonzalez # Description of argument(s): 48173afd0fSDaniel Gonzalez # port_number The switch port where the server is connected (e.g. 49173afd0fSDaniel Gonzalez # "1", "2", etc). 50173afd0fSDaniel Gonzalez # state The state to be set in the network interface ("UP" or 51173afd0fSDaniel Gonzalez # "DOWN"). 52173afd0fSDaniel Gonzalez 53173afd0fSDaniel Gonzalez Device Write enable 54173afd0fSDaniel Gonzalez Device Write configure terminal 55173afd0fSDaniel Gonzalez Device Write interface port ${PORT_NUMBER} 56173afd0fSDaniel Gonzalez Run Keyword If '${state}' == 'DOWN' 57173afd0fSDaniel Gonzalez ... Device Write shutdown 58173afd0fSDaniel Gonzalez ... ELSE 59173afd0fSDaniel Gonzalez ... Device Write no shutdown 60173afd0fSDaniel Gonzalez Wait Until Keyword Succeeds 30 sec 5 sec 61173afd0fSDaniel Gonzalez ... Check Network Interface State ${state} 62173afd0fSDaniel Gonzalez 63173afd0fSDaniel GonzalezCheck Network Interface State 64173afd0fSDaniel Gonzalez [Documentation] Check the status of the network interface. 65173afd0fSDaniel Gonzalez [Arguments] ${NET_INTERFACE}=${NET_INTERFACE} ${state}=${EMPTY} 66173afd0fSDaniel Gonzalez 67173afd0fSDaniel Gonzalez # Description of argument(s): 68173afd0fSDaniel Gonzalez # NET_INTERFACE The network interface name that will be tested (e.g. 69173afd0fSDaniel Gonzalez # "enP5s1f0", "eth0"). 70173afd0fSDaniel Gonzalez # state The network interface expected state ("UP" or "DOWN"). 71173afd0fSDaniel Gonzalez 72173afd0fSDaniel Gonzalez ${stdout} ${stderr} ${rc}= OS Execute Command 73173afd0fSDaniel Gonzalez ... ip link | grep "${NET_INTERFACE}" | cut -d " " -f9 74173afd0fSDaniel Gonzalez Should Contain ${stdout} ${state} msg=State not found as expected. 75173afd0fSDaniel Gonzalez 76173afd0fSDaniel GonzalezTest Setup Execution 77173afd0fSDaniel Gonzalez [Documentation] Do suite setup tasks. 78173afd0fSDaniel Gonzalez 79173afd0fSDaniel Gonzalez Should Not Be Empty ${PORT_NUMBER} 80173afd0fSDaniel Gonzalez Should Not Be Empty ${NET_INTERFACE} 81