blob: 247f876c9d9738cc3cad813721ecfa334ba3fff9 [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
Prashanth Kattid218f532019-06-13 04:22:34 -050012Force Tags MAC_Test
13
Prashanth Kattied0bedd2019-02-20 07:34:14 -060014*** Variables ***
15
16# AA:AA:AA:AA:AA:AA series is a valid MAC and does not exist in
17# our network, so this is chosen to avoid MAC conflict.
18${valid_mac} AA:E2:84:14:28:79
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050019${zero_mac} 00:00:00:00:00:00
20${broadcast_mac} FF:FF:FF:FF:FF:FF
Prashanth Katti63862132019-03-15 04:45:31 -050021${out_of_range_mac} AA:FF:FF:FF:FF:100
22
23# There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx).
24# Here trying to configure xx.xx.xx.xx.xx
25${less_byte_mac} AA:AA:AA:AA:BB
26# Here trying to configure xx.xx.xx.xx.xx.xx.xx
27${more_byte_mac} AA:AA:AA:AA:AA:AA:BB
Prashanth Kattied0bedd2019-02-20 07:34:14 -060028
Prashanth Kattie8c87352019-03-21 06:23:41 -050029# MAC address with special characters.
30${special_char_mac} &A:$A:AA:AA:AA:^^
31
Prashanth Kattied0bedd2019-02-20 07:34:14 -060032*** Test Cases ***
33
34Configure Valid MAC And Verify
35 [Documentation] Configure valid MAC via Redfish and verify.
36 [Tags] Configure_Valid_MAC_And_Verify
37
38 Configure MAC Settings ${valid_mac} valid
39
shrsuman123fdc51d22020-08-18 06:51:09 -050040 # Verify whether new MAC is configured on BMC and FW_Env.
Prashanth Kattied0bedd2019-02-20 07:34:14 -060041 Validate MAC On BMC ${valid_mac}
shrsuman123fdc51d22020-08-18 06:51:09 -050042 Verify MAC Address Via FW_Env ${valid_mac} valid
Prashanth Kattied0bedd2019-02-20 07:34:14 -060043
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050044Configure Zero MAC And Verify
45 [Documentation] Configure zero MAC via Redfish and verify.
46 [Tags] Configure_Zero_MAC_And_Verify
47
48 [Template] Configure MAC Settings
49 # MAC address scenario
50 ${zero_mac} error
51
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050052Configure Broadcast MAC And Verify
53 [Documentation] Configure broadcast MAC via Redfish and verify.
54 [Tags] Configure_Broadcast_MAC_And_Verify
55
56 [Template] Configure MAC Settings
57 # MAC address scenario
58 ${broadcast_mac} error
59
Prashanth Kattie8c87352019-03-21 06:23:41 -050060Configure Invalid MAC And Verify
61 [Documentation] Configure invalid MAC address which is a string.
62 [Tags] Configure_Invalid_MAC_And_Verify
63
64 [Template] Configure MAC Settings
65 # MAC Address Expected_Result
66 ${special_char_mac} error
67
68Configure Valid MAC And Check Persistency
69 [Documentation] Configure valid MAC and check persistency.
70 [Tags] Configure_Valid_MAC_And_Check_Persistency
71
72 Configure MAC Settings ${valid_mac} valid
73
74 # Verify whether new MAC is configured on BMC.
75 Validate MAC On BMC ${valid_mac}
76
shrsuman123fdc51d22020-08-18 06:51:09 -050077 # Reboot BMC and check whether MAC is persistent on BMC and FW_Env.
Prashanth Kattie8c87352019-03-21 06:23:41 -050078 OBMC Reboot (off)
79 Validate MAC On BMC ${valid_mac}
shrsuman123fdc51d22020-08-18 06:51:09 -050080 Verify MAC Address Via FW_Env ${valid_mac} valid
81
82Configure Invalid MAC And Verify On FW_Env
83 [Documentation] Configure Invalid MAC via Redfish and verify on FW_Env.
84 [Tags] Configure_Invalid_MAC_And_Verify_On_FW_Env
85
86 [Template] Configure MAC Settings
87
88 # invalid_MAC scenario
89 ${zero_mac} error
90 ${broadcast_mac} error
91 ${special_char_mac} error
92 ${less_byte_mac} error
93
George Keishingeedd71a2020-09-17 00:40:36 -050094Configure Invalid MAC And Verify Persistency On FW_Env
shrsuman123fdc51d22020-08-18 06:51:09 -050095 [Documentation] Configure invalid MAC and verify persistency on FW_Env.
96 [Tags] Configure_Invalid_MAC_And_Verify_Persistency_On_FW_Env
97
98 Configure MAC Settings ${special_char_mac} error
99
100 # Reboot BMC and check whether MAC is persistent on FW_Env.
101 OBMC Reboot (off)
102 Verify MAC Address Via FW_Env ${special_char_mac} error
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500103
Prashanth Katti63862132019-03-15 04:45:31 -0500104Configure Out Of Range MAC And Verify
105 [Documentation] Configure out of range MAC via Redfish and verify.
106 [Tags] Configure_Out_Of_Range_MAC_And_Verify
107
shrsuman123fdc51d22020-08-18 06:51:09 -0500108 Configure MAC Settings ${out_of_range_mac} valid
109
110 # Verify whether new MAC is configured on FW_Env.
111 Verify MAC Address Via FW_Env ${out_of_range_mac} valid
Prashanth Katti63862132019-03-15 04:45:31 -0500112
113Configure Less Byte MAC And Verify
114 [Documentation] Configure less byte MAC via Redfish and verify.
115 [Tags] Configure_Less_Byte_MAC_And_Verify
116
117 [Template] Configure MAC Settings
118 # MAC address scenario
119 ${less_byte_mac} error
120
121Configure More Byte MAC And Verify
122 [Documentation] Configure more byte MAC via Redfish and verify.
Tony Lee3112f4c2020-05-13 20:31:42 +0800123 [Tags] Configure_More_Byte_MAC_And_Verify
Prashanth Katti63862132019-03-15 04:45:31 -0500124
shrsuman123fdc51d22020-08-18 06:51:09 -0500125 Configure MAC Settings ${more_byte_mac} valid
126 # Verify whether new MAC is configured on FW_Env.
127 Verify MAC Address Via FW_Env ${more_byte_mac} valid
Prashanth Katti63862132019-03-15 04:45:31 -0500128
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600129*** Keywords ***
130
George Keishinga8cc1ad2019-03-13 02:58:34 -0500131Test Teardown Execution
132 [Documentation] Do the post test teardown.
133
Prashanth Kattie8c87352019-03-21 06:23:41 -0500134 # Revert to initial MAC address.
135 Configure MAC Settings ${initial_mac_address} valid
136
shrsuman123fdc51d22020-08-18 06:51:09 -0500137 # Verify whether new MAC is configured on BMC and FW_Env.
Prashanth Kattie8c87352019-03-21 06:23:41 -0500138 Validate MAC On BMC ${initial_mac_address}
shrsuman123fdc51d22020-08-18 06:51:09 -0500139 Validate MAC On Fw_Env ${initial_mac_address}
Prashanth Kattie8c87352019-03-21 06:23:41 -0500140
George Keishinga8cc1ad2019-03-13 02:58:34 -0500141 FFDC On Test Case Fail
142 Redfish.Logout
143
144
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600145Suite Setup Execution
146 [Documentation] Do suite setup tasks.
147
148 Redfish.Login
Tony Lee8094d382020-04-02 13:14:47 +0800149 ${active_channel_config}= Get Active Channel Config
150 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600151
152 # Get BMC MAC address.
Tony Lee8094d382020-04-02 13:14:47 +0800153 ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600154 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
155
156 Validate MAC On BMC ${initial_mac_address}
157
158 Redfish.Logout
159
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500160
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600161Configure MAC Settings
162 [Documentation] Configure MAC settings via Redfish.
163 [Arguments] ${mac_address} ${expected_result}
164
165 # Description of argument(s):
166 # mac_address MAC address of BMC.
167 # expected_result Expected status of MAC configuration.
168
Tony Lee8094d382020-04-02 13:14:47 +0800169 ${active_channel_config}= Get Active Channel Config
170 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
171
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600172 Redfish.Login
173 ${payload}= Create Dictionary MACAddress=${mac_address}
174
Tony Lee8094d382020-04-02 13:14:47 +0800175 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload}
Prashanth Katti12ebf6c2019-06-28 06:31:22 -0500176 ... valid_status_codes=[200, 400, 500]
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600177
178 # After any modification on network interface, BMC restarts network
Anves Kumar rayankulaed0124b2021-04-06 23:41:07 -0500179 # Note: Network restart takes around 15-18s after patch request processing.
180 Sleep ${NETWORK_TIMEOUT}s
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600181
Anves Kumar rayankulaed0124b2021-04-06 23:41:07 -0500182 Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600183
184 # Verify whether new MAC address is populated on BMC system.
185 # It should not allow to configure invalid settings.
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600186 ${status}= Run Keyword And Return Status
187 ... Validate MAC On BMC ${mac_address}
188
189 Run Keyword If '${expected_result}' == 'error'
190 ... Should Be Equal ${status} ${False}
191 ... msg=Allowing the configuration of an invalid MAC.
192 ... ELSE
193 ... Should Be Equal ${status} ${True}
194 ... msg=Not allowing the configuration of a valid MAC.
195
shrsuman123fdc51d22020-08-18 06:51:09 -0500196 Verify MAC Address Via FW_Env ${mac_address} ${expected_result}
197
198Verify MAC Address Via FW_Env
199 [Documentation] Verify MAC address on FW_Env.
200 [Arguments] ${mac_address} ${expected_result}
201
202 # Description of argument(s):
203 # mac_address MAC address of BMC.
204 # expected_result Expected status of MAC configuration.
205
206 ${status}= Run Keyword And Return Status
207 ... Validate MAC On FW_Env ${mac_address}
208
209 Run Keyword If '${expected_result}' == 'error'
210 ... Should Be Equal ${status} ${False}
211 ... msg=Allowing the configuration of an invalid MAC.
212 ... ELSE
213 ... Should Be Equal ${status} ${True}
214 ... msg=Not allowing the configuration of a valid MAC.
215
216