Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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 | |
| 18 | Library ../lib/bmc_ssh_utils.py |
Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 19 | Resource ../lib/resource.robot |
Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 20 | Resource ../syslib/utils_os.robot |
| 21 | |
| 22 | Suite Setup Test Setup Execution |
| 23 | |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame^] | 24 | Force Tags Cable_Pull_Recover |
| 25 | |
Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 26 | *** Variables *** |
| 27 | |
| 28 | ${PORT_NUMBER} ${EMPTY} |
| 29 | |
| 30 | *** Test Cases *** |
| 31 | |
| 32 | Verify 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 | |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 37 | Printn |
Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 38 | Set Switch Port State DOWN |
| 39 | Set Switch Port State UP |
| 40 | |
| 41 | *** Keywords *** |
| 42 | |
| 43 | Set 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 | |
| 63 | Check 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 | |
| 76 | Test Setup Execution |
| 77 | [Documentation] Do suite setup tasks. |
| 78 | |
| 79 | Should Not Be Empty ${PORT_NUMBER} |
| 80 | Should Not Be Empty ${NET_INTERFACE} |