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 | |
| 24 | *** Variables *** |
| 25 | |
| 26 | ${PORT_NUMBER} ${EMPTY} |
| 27 | |
| 28 | *** Test Cases *** |
| 29 | |
| 30 | Verify Network Interface Recovery |
| 31 | [Documentation] Test the recovery of the network interface that has been |
| 32 | ... shutdown from the switch port. |
| 33 | [Tags] Verify_Network_Interface_Recovery |
| 34 | |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 35 | Printn |
Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 36 | Set Switch Port State DOWN |
| 37 | Set Switch Port State UP |
| 38 | |
| 39 | *** Keywords *** |
| 40 | |
| 41 | Set Switch Port State |
| 42 | [Documentation] Disable the port connected to the server. |
| 43 | [Arguments] ${port_number}=${PORT_NUMBER} ${state}=${EMPTY} |
| 44 | |
| 45 | # Description of argument(s): |
| 46 | # port_number The switch port where the server is connected (e.g. |
| 47 | # "1", "2", etc). |
| 48 | # state The state to be set in the network interface ("UP" or |
| 49 | # "DOWN"). |
| 50 | |
| 51 | Device Write enable |
| 52 | Device Write configure terminal |
| 53 | Device Write interface port ${PORT_NUMBER} |
| 54 | Run Keyword If '${state}' == 'DOWN' |
| 55 | ... Device Write shutdown |
| 56 | ... ELSE |
| 57 | ... Device Write no shutdown |
| 58 | Wait Until Keyword Succeeds 30 sec 5 sec |
| 59 | ... Check Network Interface State ${state} |
| 60 | |
| 61 | Check Network Interface State |
| 62 | [Documentation] Check the status of the network interface. |
| 63 | [Arguments] ${NET_INTERFACE}=${NET_INTERFACE} ${state}=${EMPTY} |
| 64 | |
| 65 | # Description of argument(s): |
| 66 | # NET_INTERFACE The network interface name that will be tested (e.g. |
| 67 | # "enP5s1f0", "eth0"). |
| 68 | # state The network interface expected state ("UP" or "DOWN"). |
| 69 | |
| 70 | ${stdout} ${stderr} ${rc}= OS Execute Command |
| 71 | ... ip link | grep "${NET_INTERFACE}" | cut -d " " -f9 |
| 72 | Should Contain ${stdout} ${state} msg=State not found as expected. |
| 73 | |
| 74 | Test Setup Execution |
| 75 | [Documentation] Do suite setup tasks. |
| 76 | |
| 77 | Should Not Be Empty ${PORT_NUMBER} |
| 78 | Should Not Be Empty ${NET_INTERFACE} |