blob: 8f42071110a05b77285e5fd7258f0952c0d14d1e [file] [log] [blame]
Prashanth Kattied0bedd2019-02-20 07:34:14 -06001*** Settings ***
2Documentation Test BMC network interface functionalities.
3
4Resource ../../lib/bmc_redfish_resource.robot
5Resource ../../lib/bmc_network_utils.robot
6Resource ../../lib/openbmc_ffdc.robot
7Library ../../lib/bmc_network_utils.py
8
9Suite Setup Suite Setup Execution
George Keishinga8cc1ad2019-03-13 02:58:34 -050010Test Teardown Test Teardown Execution
Prashanth Kattied0bedd2019-02-20 07:34:14 -060011
12*** Variables ***
13
14# AA:AA:AA:AA:AA:AA series is a valid MAC and does not exist in
15# our network, so this is chosen to avoid MAC conflict.
16${valid_mac} AA:E2:84:14:28:79
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050017${zero_mac} 00:00:00:00:00:00
18${broadcast_mac} FF:FF:FF:FF:FF:FF
Prashanth Kattied0bedd2019-02-20 07:34:14 -060019
Prashanth Kattie8c87352019-03-21 06:23:41 -050020# MAC address with special characters.
21${special_char_mac} &A:$A:AA:AA:AA:^^
22
Prashanth Kattied0bedd2019-02-20 07:34:14 -060023*** Test Cases ***
24
25Configure Valid MAC And Verify
26 [Documentation] Configure valid MAC via Redfish and verify.
27 [Tags] Configure_Valid_MAC_And_Verify
28
29 Configure MAC Settings ${valid_mac} valid
30
31 # Verify whether new MAC is configured on BMC.
32 Validate MAC On BMC ${valid_mac}
33
34
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050035Configure Zero MAC And Verify
36 [Documentation] Configure zero MAC via Redfish and verify.
37 [Tags] Configure_Zero_MAC_And_Verify
38
39 [Template] Configure MAC Settings
40 # MAC address scenario
41 ${zero_mac} error
42
43
44Configure Broadcast MAC And Verify
45 [Documentation] Configure broadcast MAC via Redfish and verify.
46 [Tags] Configure_Broadcast_MAC_And_Verify
47
48 [Template] Configure MAC Settings
49 # MAC address scenario
50 ${broadcast_mac} error
51
Prashanth Kattie8c87352019-03-21 06:23:41 -050052Configure Invalid MAC And Verify
53 [Documentation] Configure invalid MAC address which is a string.
54 [Tags] Configure_Invalid_MAC_And_Verify
55
56 [Template] Configure MAC Settings
57 # MAC Address Expected_Result
58 ${special_char_mac} error
59
60Configure Valid MAC And Check Persistency
61 [Documentation] Configure valid MAC and check persistency.
62 [Tags] Configure_Valid_MAC_And_Check_Persistency
63
64 Configure MAC Settings ${valid_mac} valid
65
66 # Verify whether new MAC is configured on BMC.
67 Validate MAC On BMC ${valid_mac}
68
69 # Reboot BMC and check whether MAC is persistent.
70 OBMC Reboot (off)
71 Validate MAC On BMC ${valid_mac}
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050072
Prashanth Kattied0bedd2019-02-20 07:34:14 -060073*** Keywords ***
74
George Keishinga8cc1ad2019-03-13 02:58:34 -050075Test Teardown Execution
76 [Documentation] Do the post test teardown.
77
Prashanth Kattie8c87352019-03-21 06:23:41 -050078 # Revert to initial MAC address.
79 Configure MAC Settings ${initial_mac_address} valid
80
81 # Verify whether new MAC is configured on BMC.
82 Validate MAC On BMC ${initial_mac_address}
83
George Keishinga8cc1ad2019-03-13 02:58:34 -050084 FFDC On Test Case Fail
85 Redfish.Logout
86
87
Prashanth Kattied0bedd2019-02-20 07:34:14 -060088Suite Setup Execution
89 [Documentation] Do suite setup tasks.
90
91 Redfish.Login
92
93 # Get BMC MAC address.
94 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
95 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
96
97 Validate MAC On BMC ${initial_mac_address}
98
99 Redfish.Logout
100
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500101
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600102Configure MAC Settings
103 [Documentation] Configure MAC settings via Redfish.
104 [Arguments] ${mac_address} ${expected_result}
105
106 # Description of argument(s):
107 # mac_address MAC address of BMC.
108 # expected_result Expected status of MAC configuration.
109
110 Redfish.Login
111 ${payload}= Create Dictionary MACAddress=${mac_address}
112
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500113 Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload}
114 ... valid_status_codes=[200, 400]
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600115
116 # After any modification on network interface, BMC restarts network
117 # module, wait until it is reachable.
118
119 Wait For Host To Ping ${OPENBMC_HOST}
120 ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
121
122 # Verify whether new MAC address is populated on BMC system.
123 # It should not allow to configure invalid settings.
124
125 ${status}= Run Keyword And Return Status
126 ... Validate MAC On BMC ${mac_address}
127
128 Run Keyword If '${expected_result}' == 'error'
129 ... Should Be Equal ${status} ${False}
130 ... msg=Allowing the configuration of an invalid MAC.
131 ... ELSE
132 ... Should Be Equal ${status} ${True}
133 ... msg=Not allowing the configuration of a valid MAC.
134