| 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 | 
| George Keishing | a28061a | 2023-12-15 14:46:54 +0530 | [diff] [blame] | 20 | Resource        ../lib/os_utilities.robot | 
| Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 21 |  | 
|  | 22 | Suite Setup     Test Setup Execution | 
|  | 23 |  | 
| George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 24 | Test Tags       Cable_Pull_Recover | 
| George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 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} | 
| George Keishing | cd58a5e | 2025-04-29 18:50:06 +0530 | [diff] [blame] | 56 | IF  '${state}' == 'DOWN' | 
|  | 57 | Device Write  shutdown | 
|  | 58 | ELSE | 
|  | 59 | Device Write  no shutdown | 
|  | 60 | END | 
| Daniel Gonzalez | 173afd0 | 2018-04-27 16:42:28 -0500 | [diff] [blame] | 61 | Wait Until Keyword Succeeds  30 sec  5 sec | 
|  | 62 | ...  Check Network Interface State  ${state} | 
|  | 63 |  | 
|  | 64 | Check Network Interface State | 
|  | 65 | [Documentation]  Check the status of the network interface. | 
|  | 66 | [Arguments]  ${NET_INTERFACE}=${NET_INTERFACE}  ${state}=${EMPTY} | 
|  | 67 |  | 
|  | 68 | # Description of argument(s): | 
|  | 69 | # NET_INTERFACE   The network interface name that will be tested (e.g. | 
|  | 70 | #                 "enP5s1f0", "eth0"). | 
|  | 71 | # state           The network interface expected state ("UP" or "DOWN"). | 
|  | 72 |  | 
|  | 73 | ${stdout}  ${stderr}  ${rc}=  OS Execute Command | 
|  | 74 | ...  ip link | grep "${NET_INTERFACE}" | cut -d " " -f9 | 
|  | 75 | Should Contain  ${stdout}  ${state}  msg=State not found as expected. | 
|  | 76 |  | 
|  | 77 | Test Setup Execution | 
|  | 78 | [Documentation]  Do suite setup tasks. | 
|  | 79 |  | 
|  | 80 | Should Not Be Empty  ${PORT_NUMBER} | 
|  | 81 | Should Not Be Empty  ${NET_INTERFACE} |