blob: 82dee74206997d8add8ebb1d1754ab733b5c8a64 [file] [log] [blame]
Daniel Gonzalez173afd02018-04-27 16:42:28 -05001*** Settings ***
2Documentation 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
18Library ../lib/bmc_ssh_utils.py
Sandhya Somashekar839a0c22019-01-31 05:05:43 -060019Resource ../lib/resource.robot
Daniel Gonzalez173afd02018-04-27 16:42:28 -050020Resource ../syslib/utils_os.robot
21
22Suite Setup Test Setup Execution
23
George Keishing87dc4422023-10-20 12:56:30 +053024Force Tags Cable_Pull_Recover
25
Daniel Gonzalez173afd02018-04-27 16:42:28 -050026*** Variables ***
27
28${PORT_NUMBER} ${EMPTY}
29
30*** Test Cases ***
31
32Verify 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 Walshc108e422019-03-28 12:27:18 -050037 Printn
Daniel Gonzalez173afd02018-04-27 16:42:28 -050038 Set Switch Port State DOWN
39 Set Switch Port State UP
40
41*** Keywords ***
42
43Set 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
63Check 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
76Test Setup Execution
77 [Documentation] Do suite setup tasks.
78
79 Should Not Be Empty ${PORT_NUMBER}
80 Should Not Be Empty ${NET_INTERFACE}