blob: 8e17fecf41a81be2827d6f87ac21aba424072564 [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
17
18*** Test Cases ***
19
20Configure Valid MAC And Verify
21 [Documentation] Configure valid MAC via Redfish and verify.
22 [Tags] Configure_Valid_MAC_And_Verify
23
24 Configure MAC Settings ${valid_mac} valid
25
26 # Verify whether new MAC is configured on BMC.
27 Validate MAC On BMC ${valid_mac}
28
29
30*** Keywords ***
31
George Keishinga8cc1ad2019-03-13 02:58:34 -050032Test Teardown Execution
33 [Documentation] Do the post test teardown.
34
35 FFDC On Test Case Fail
36 Redfish.Logout
37
38
Prashanth Kattied0bedd2019-02-20 07:34:14 -060039Suite Setup Execution
40 [Documentation] Do suite setup tasks.
41
42 Redfish.Login
43
44 # Get BMC MAC address.
45 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI}
46 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']}
47
48 Validate MAC On BMC ${initial_mac_address}
49
50 Redfish.Logout
51
52Configure MAC Settings
53 [Documentation] Configure MAC settings via Redfish.
54 [Arguments] ${mac_address} ${expected_result}
55
56 # Description of argument(s):
57 # mac_address MAC address of BMC.
58 # expected_result Expected status of MAC configuration.
59
60 Redfish.Login
61 ${payload}= Create Dictionary MACAddress=${mac_address}
62
63 ${resp}= Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload}
64
65 # After any modification on network interface, BMC restarts network
66 # module, wait until it is reachable.
67
68 Wait For Host To Ping ${OPENBMC_HOST}
69 ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
70
71 # Verify whether new MAC address is populated on BMC system.
72 # It should not allow to configure invalid settings.
73
74 ${status}= Run Keyword And Return Status
75 ... Validate MAC On BMC ${mac_address}
76
77 Run Keyword If '${expected_result}' == 'error'
78 ... Should Be Equal ${status} ${False}
79 ... msg=Allowing the configuration of an invalid MAC.
80 ... ELSE
81 ... Should Be Equal ${status} ${True}
82 ... msg=Not allowing the configuration of a valid MAC.
83