blob: f89dc6517d781d0da63d3cece49140caa671fbbc [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
125
126 # Get BMC MAC address.
127 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
128 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
129
130 Validate MAC On BMC ${initial_mac_address}
131
132 Redfish.Logout
133
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500134
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600135Configure MAC Settings
136 [Documentation] Configure MAC settings via Redfish.
137 [Arguments] ${mac_address} ${expected_result}
138
139 # Description of argument(s):
140 # mac_address MAC address of BMC.
141 # expected_result Expected status of MAC configuration.
142
143 Redfish.Login
144 ${payload}= Create Dictionary MACAddress=${mac_address}
145
Prashanth Katti46ca7ae2019-03-14 02:41:11 -0500146 Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload}
Prashanth Katti12ebf6c2019-06-28 06:31:22 -0500147 ... valid_status_codes=[200, 400, 500]
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600148
149 # After any modification on network interface, BMC restarts network
150 # module, wait until it is reachable.
151
Prashanth Katti12ebf6c2019-06-28 06:31:22 -0500152 Wait Until Keyword Succeeds ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
153 ... redfish.Get ${REDFISH_NW_ETH0_URI}
Prashanth Kattied0bedd2019-02-20 07:34:14 -0600154
155 # Verify whether new MAC address is populated on BMC system.
156 # It should not allow to configure invalid settings.
157
158 ${status}= Run Keyword And Return Status
159 ... Validate MAC On BMC ${mac_address}
160
161 Run Keyword If '${expected_result}' == 'error'
162 ... Should Be Equal ${status} ${False}
163 ... msg=Allowing the configuration of an invalid MAC.
164 ... ELSE
165 ... Should Be Equal ${status} ${True}
166 ... msg=Not allowing the configuration of a valid MAC.
167