blob: 182f7ec40796157c3049d8872e6932318ae628a1 [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
40 # Verify whether new MAC is configured on BMC.
41 Validate MAC On BMC ${valid_mac}
42
43
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
52
53Configure Broadcast MAC And Verify
54 [Documentation] Configure broadcast MAC via Redfish and verify.
55 [Tags] Configure_Broadcast_MAC_And_Verify
56
57 [Template] Configure MAC Settings
58 # MAC address scenario
59 ${broadcast_mac} error
60
Prashanth Kattie8c87352019-03-21 06:23:41 -050061Configure Invalid MAC And Verify
62 [Documentation] Configure invalid MAC address which is a string.
63 [Tags] Configure_Invalid_MAC_And_Verify
64
65 [Template] Configure MAC Settings
66 # MAC Address Expected_Result
67 ${special_char_mac} error
68
69Configure Valid MAC And Check Persistency
70 [Documentation] Configure valid MAC and check persistency.
71 [Tags] Configure_Valid_MAC_And_Check_Persistency
72
73 Configure MAC Settings ${valid_mac} valid
74
75 # Verify whether new MAC is configured on BMC.
76 Validate MAC On BMC ${valid_mac}
77
78 # Reboot BMC and check whether MAC is persistent.
79 OBMC Reboot (off)
80 Validate MAC On BMC ${valid_mac}
Prashanth Katti46ca7ae2019-03-14 02:41:11 -050081
Prashanth Katti63862132019-03-15 04:45:31 -050082Configure Out Of Range MAC And Verify
83 [Documentation] Configure out of range MAC via Redfish and verify.
84 [Tags] Configure_Out_Of_Range_MAC_And_Verify
85
86 [Template] Configure MAC Settings
87 # MAC address scenario
88 ${out_of_range_mac} error
89
90Configure Less Byte MAC And Verify
91 [Documentation] Configure less byte MAC via Redfish and verify.
92 [Tags] Configure_Less_Byte_MAC_And_Verify
93
94 [Template] Configure MAC Settings
95 # MAC address scenario
96 ${less_byte_mac} error
97
98Configure More Byte MAC And Verify
99 [Documentation] Configure more byte MAC via Redfish and verify.
Tony Lee3112f4c2020-05-13 20:31:42 +0800100 [Tags] Configure_More_Byte_MAC_And_Verify
Prashanth Katti63862132019-03-15 04:45:31 -0500101
102 [Template] Configure MAC Settings
103 # MAC address scenario
104 ${more_byte_mac} error
105
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600106*** Keywords ***
107
George Keishinga8cc1ad2019-03-13 02:58:34 -0500108Test Teardown Execution
109 [Documentation] Do the post test teardown.
110
Prashanth Kattie8c87352019-03-21 06:23:41 -0500111 # Revert to initial MAC address.
112 Configure MAC Settings ${initial_mac_address} valid
113
114 # Verify whether new MAC is configured on BMC.
115 Validate MAC On BMC ${initial_mac_address}
116
George Keishinga8cc1ad2019-03-13 02:58:34 -0500117 FFDC On Test Case Fail
118 Redfish.Logout
119
120
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600121Suite Setup Execution
122 [Documentation] Do suite setup tasks.
123
124 Redfish.Login
Tony Lee8094d382020-04-02 13:14:47 +0800125 ${active_channel_config}= Get Active Channel Config
126 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600127
128 # Get BMC MAC address.
Tony Lee8094d382020-04-02 13:14:47 +0800129 ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600130 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
131
132 Validate MAC On BMC ${initial_mac_address}
133
134 Redfish.Logout
135
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500136
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600137Configure MAC Settings
138 [Documentation] Configure MAC settings via Redfish.
139 [Arguments] ${mac_address} ${expected_result}
140
141 # Description of argument(s):
142 # mac_address MAC address of BMC.
143 # expected_result Expected status of MAC configuration.
144
Tony Lee8094d382020-04-02 13:14:47 +0800145 ${active_channel_config}= Get Active Channel Config
146 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
147
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600148 Redfish.Login
149 ${payload}= Create Dictionary MACAddress=${mac_address}
150
Tony Lee8094d382020-04-02 13:14:47 +0800151 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload}
Prashanth Katti12ebf6c2019-06-28 06:31:22 -0500152 ... valid_status_codes=[200, 400, 500]
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600153
154 # After any modification on network interface, BMC restarts network
155 # module, wait until it is reachable.
156
Prashanth Katti12ebf6c2019-06-28 06:31:22 -0500157 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
Tony Lee8094d382020-04-02 13:14:47 +0800158 ... redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600159
160 # Verify whether new MAC address is populated on BMC system.
161 # It should not allow to configure invalid settings.
162
163 ${status}= Run Keyword And Return Status
164 ... Validate MAC On BMC ${mac_address}
165
166 Run Keyword If '${expected_result}' == 'error'
167 ... Should Be Equal ${status} ${False}
168 ... msg=Allowing the configuration of an invalid MAC.
169 ... ELSE
170 ... Should Be Equal ${status} ${True}
171 ... msg=Not allowing the configuration of a valid MAC.
172