blob: dc34800f11c428ccaf31e8bf6378f2eec8b9f4db [file] [log] [blame]
Prashanth Katti47da3852017-09-25 11:05:22 -05001*** Settings ***
2Documentation Test BMC network interface functionalities.
3
4Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
6Resource ../lib/bmc_network_utils.robot
7Resource ../lib/boot_utils.robot
8
9Library String
10Library SSHLibrary
11
12Suite Setup Suite Setup Execution
13
14*** 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
19${valid_mac} AA:E2:84:14:28:79
20${broadcast_mac} FF:FF:FF:FF:FF:FF
21${zero_mac} 00:00:00:00:00:00
22${out_of_range_mac} AA:FF:FF:FF:FF:100
23${special_char_mac} &$:AA:AA:AA:AA:^^
24
25# There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx)
26# but trying to configure xx.xx.xx.xx.xx
27
28${less_byte_mac} AA:AA:AA:AA:BB
29
30# There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx)
31# but trying to configure xx.xx.xx.xx.xx.xx.xx
32
33${more_byte_mac} AA:AA:AA:AA:AA:AA:BB
34
35*** Test Cases ***
36
37Configure Valid MAC And Verify
38 [Documentation] Configure valid MAC and verify.
39 [Tags] Configure_Valid_MAC_And_Verify
40
41 Configure MAC Settings ${valid_mac} valid
42
43 # Verify whether new MAC is configured on BMC.
44 Validate MAC On BMC ${valid_mac}
45
46Configure Invalid MAC And Verify
47 [Documentation] Configure invalid MAC address which is a string.
48 [Tags] Configure_Invalid_MAC_And_Verify
49
50 [Template] Configure MAC Settings
51 # MAC Address Expected_Result
52 ${special_char_mac} error
53
54
55Configure Out Of Range MAC And Verify
56 [Documentation] Configure out-of-range MAC address.
57 [Tags] Configure_Out_Of_Range_MAC_And_Verify
58
59 [Template] Configure MAC Settings
60 # MAC Address Expected_Result
61 ${out_of_range_mac} error
62
63Configure Broadcast MAC And Verify
64 [Documentation] Configure broadcast MAC address.
65 [Tags] Configure_Broadcast_MAC_And_Verify
66
67 [Template] Configure MAC Settings
68 # MAC Address Expected_Result
69 ${broadcast_mac} error
70
71Configure Zero MAC And Verify
72 [Documentation] Configure zero MAC address.
73 [Tags] Configure_Zero_MAC_And_Verify
74
75 [Template] Configure MAC Settings
76 # MAC Address Expected_Result
77 ${zero_mac} error
78
79Configure More Byte MAC And Verify
80 [Documentation] Configure more byte MAC address.
81 [Tags] Configure_More_Byte_MAC_And_Verify
82
83 [Template] Configure MAC Settings
84 # MAC Address Expected_Result
85 ${more_byte_mac} error
86
87Configure Less Byte MAC And Verify
88 [Documentation] Configure less byte MAC address.
89 [Tags] Configure_Less_Byte_MAC_And_Verify
90
91 [Template] Configure MAC Settings
92 # MAC Address Expected_Result
93 ${less_byte_mac} error
94
95Configure Valid MAC And Check Persistency
96 [Documentation] Configure valid MAC and check persistency.
97 [Tags] Configure_Valid_MAC_And_Check_Persistency
98
99 Configure MAC Settings ${valid_mac} valid
100
101 # Verify whether new MAC is configured on BMC.
102 Validate MAC On BMC ${valid_mac}
103
104 # Reboot BMC and check whether MAC is persistent.
105 OBMC Reboot (off)
106 Validate MAC On BMC ${valid_mac}
107
108Revert To Initial MAC And Verify
109 [Documentation] Revert to initial MAC address.
110 [Tags] Revert_To_Initial_MAC_And_Verify
111
112 Configure MAC Settings ${macaddr} valid
113
114 # Verify whether new MAC is configured on BMC.
115 Validate MAC On BMC ${macaddr}
116
117*** Keywords ***
118
119Suite Setup Execution
120 [Documentation] Network setup.
121 Open Connection And Login
122
123 # Get BMC MAC address.
manasarm104cc6b2018-02-07 12:35:05 +0530124 ${macaddr}= Read Attribute ${NETWORK_MANAGER}/eth0 MACAddress
Prashanth Katti47da3852017-09-25 11:05:22 -0500125 Validate MAC On BMC ${macaddr}
126 Set Suite Variable ${macaddr}
127
Prashanth Katti47da3852017-09-25 11:05:22 -0500128Configure MAC Settings
129 [Documentation] Configure MAC settings.
130 [Arguments] ${mac_addr} ${expected_result}
131
132 # Description of argument(s):
133 # mac_addr MAC address of BMC.
134 # expected_result Expected status of MAC configuration.
135
136 ${data}= Create Dictionary data=${mac_addr}
137
138 Run Keyword And Ignore Error OpenBMC Put Request
manasarm104cc6b2018-02-07 12:35:05 +0530139 ... ${NETWORK_MANAGER}/eth0/attr/MACAddress data=${data}
Prashanth Katti47da3852017-09-25 11:05:22 -0500140
141 # After any modification on network interface, BMC restarts network
142 # module, wait until it is reachable.
143
Rahul Maheshwari3505c8d2018-09-06 01:46:50 -0500144 Wait For Host To Ping ${OPENBMC_HOST}
145 ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME}
Prashanth Katti47da3852017-09-25 11:05:22 -0500146
147 # Verify whether new MAC address is populated on BMC system.
148 # It should not allow to configure invalid settings.
149
150 ${status}= Run Keyword And Return Status
151 ... Validate MAC On BMC ${mac_addr}
152
153 Run Keyword If '${expected_result}' == 'error'
154 ... Should Be Equal ${status} ${False}
155 ... msg=Allowing the configuration of an invalid MAC.
156 ... ELSE
157 ... Should Be Equal ${status} ${True}
158 ... msg=Not allowing the configuration of a valid MAC.
159