blob: c776edfef221e5724e0255140d04ea464d09f565 [file] [log] [blame]
Naman Navin Hegde53691452019-07-30 00:22:37 -05001*** Settings ***
2Documentation Verify OBMC tool's network fuctionality.
3
4
5Library String
6Library OperatingSystem
Naman Navin Hegde45dd94f2019-09-17 22:27:12 -05007Library ../../lib/bmc_network_utils.py
Naman Navin Hegde53691452019-07-30 00:22:37 -05008Library ../../lib/gen_print.py
9Library ../../lib/gen_robot_print.py
10Library ../../lib/openbmctool_utils.py
11Library ../../lib/gen_misc.py
12Library ../../lib/gen_robot_valid.py
13Resource ../../syslib/utils_os.robot
14Resource ../../lib/resource.robot
15Resource ../../lib/bmc_network_utils.robot
16Resource ../../lib/utils.robot
17Resource ../../lib/common_utils.robot
18
19
20Suite Setup Suite Setup Execution
21Test Setup Printn
22
23*** Variables ***
24
25${ip} 10.5.5.5
26${dns_ip} 10.10.10.10
27${domain_name} randomName.com
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050028${mac_address} 76:e2:84:14:87:91
29${ntp_server} pool.ntp.org
Naman Navin Hegde53691452019-07-30 00:22:37 -050030${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}'
31${ignore_err} ${0}
32
33
34*** Test Cases ***
35
36Verify GetIP
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050037 [Documentation] Verify that openbmctool can run the getIP command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050038 [Tags] Verify_GetIP
39
40 ${ip_records}= Network getIP I=eth0
41 ${addresses}= Nested Get Address ${ip_records}
Naman Navin Hegde53691452019-07-30 00:22:37 -050042 Verify IP On BMC ${addresses}[${0}]
43
44
45Verify AddIP
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050046 [Documentation] Verify that openbmctool can run the addIP command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050047 [Tags] Verify_AddIP
48
49 Network addIP I=${interface} a=${ip} l=24 p=ipv4
Naman Navin Hegde53691452019-07-30 00:22:37 -050050 Wait And Verify IP On BMC ${ip}
51
52
53Verify GetDefaultGW
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050054 [Documentation] Verify that openbmctool can run the getDefaultGW command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050055 [Tags] Verify_GetDefaultGW
56
57 ${default_gw}= Network getDefaultGW
Naman Navin Hegde53691452019-07-30 00:22:37 -050058 Verify Gateway On BMC ${default_gw}
59
60
61Verify RemoveIP
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050062 [Documentation] Verify that openbmctool can run the rmIP command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050063 [Tags] Verify_RemoveIP
64
65 Network addIP I=${interface} a=${ip} l=24 p=ipv4
66 Wait And Verify IP On BMC ${ip}
Naman Navin Hegde53691452019-07-30 00:22:37 -050067 Network rmIP I=${interface} a=${ip}
Naman Navin Hegde53691452019-07-30 00:22:37 -050068 ${status}= Run Keyword And Return Status Wait And Verify IP On BMC ${ip}
69 Should Be Equal ${status} ${False}
70
71
72Verify SetDNS
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050073 [Documentation] Verify that openbmctool can run the setDNS command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050074 [Tags] Verify_SetDNS
75
76 Network setDNS I=eth0 d=${dns_ip}
77 ${dns_config}= CLI Get Nameservers
Naman Navin Hegde53691452019-07-30 00:22:37 -050078 Should Contain ${dns_config} ${dns_ip}
79
80
81Verify GetDNS
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050082 [Documentation] Verify that openbmctool can run the getDNS command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050083 [Tags] Verify_GetDNS
84
85 Network setDNS I=eth0 d=${dns_ip}
86 ${dns_data}= Network getDNS I=eth0
87 ${dns_config}= CLI Get Nameservers
Naman Navin Hegde53691452019-07-30 00:22:37 -050088 Should Contain ${dns_config} ${dns_data}[${0}]
89
90
91Verify SetHostName
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050092 [Documentation] Verify that openbmctool can run the setHostName command.
Naman Navin Hegde53691452019-07-30 00:22:37 -050093 [Tags] Verify_SetHostName
94
95 Network setHostName H=randomName
96 ${bmc_hostname}= Get BMC Hostname
Naman Navin Hegde53691452019-07-30 00:22:37 -050097 Should Be Equal As Strings ${bmc_hostname} randomName
98
99
100Verify GetHostName
Naman Navin Hegde6b09db32019-09-10 00:54:12 -0500101 [Documentation] Verify that openbmctool can run the getHostName command.
Naman Navin Hegde53691452019-07-30 00:22:37 -0500102 [Tags] Verify_GetHostName
103
104 ${tool_hostname}= Network getHostName
105 ${bmc_hostname}= Get BMC Hostname
Naman Navin Hegde53691452019-07-30 00:22:37 -0500106 Should Be Equal As Strings ${bmc_hostname} ${tool_hostname}
107
108
Naman Navin Hegde6b09db32019-09-10 00:54:12 -0500109Verify SetMACAddress
110 [Documentation] Verify that openbmctool can set a new MAC address.
111 [Tags] Verify_SetMACAddress
112
113 Network setMACAddress I=eth0 MA=${mac_address}
114 Validate MAC On BMC ${mac_address}
115
116
117Verify GetMACAddress
118 [Documentation] Verify that openbmctool can get the MAC address.
119 [Tags] Verify_GetMACAddress
120
121 ${mac_addr}= Network getMACAddress I=eth0
122 Validate MAC On BMC ${mac_addr}
123
124
125Verify SetNTP
126 [Documentation] Verify that openbmctool can run the setNTP command.
127 [Tags] Verify_SetNTP
128
129 Network setNTP I=eth0 N=${ntp_server}
Naman Navin Hegde45dd94f2019-09-17 22:27:12 -0500130 # Get NTP server details via REDFISH.
131 ${eth0}= Redfish.Get Properties ${REDFISH_NW_PROTOCOL_URI}
132 Valid Value eth0['NTP']['NTPServers'][0] ['${ntp_server}']
Naman Navin Hegde6b09db32019-09-10 00:54:12 -0500133
134
135Verify GetNTP
136 [Documentation] Verify that openbmctool can run the getNTP command.
137 [Tags] Verify_GetNTP
138
139 Network setNTP I=eth0 N=${ntp_server}
Naman Navin Hegde45dd94f2019-09-17 22:27:12 -0500140 # Get NTP server details via REDFISH.
141 ${eth0}= Redfish.Get Properties ${REDFISH_NW_PROTOCOL_URI}
Naman Navin Hegde6b09db32019-09-10 00:54:12 -0500142 ${tool_ntp}= Network getNTP I=eth0
Naman Navin Hegde45dd94f2019-09-17 22:27:12 -0500143 Valid Value eth0['NTP']['NTPServers'][0] ['${tool_ntp}']
144
145
146Verify SetDomainName
147 [Documentation] Verify set domain name via openbmctool.
148 [Tags] Verify_SetDomainName
149
150 Network setDomainName I=eth0 D=${domain_name}
151 ${eth0}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}
152 ${eth0_domain_name}= Strip String ${eth0['FQDN']}
153 ... characters=${eth0['HostName']}. mode=left
154 Valid Value eth0_domain_name ['${domain_name}']
155
156
157Verify GetDomainName
158 [Documentation] Verify get domain name via openbmctool.
159 [Tags] Verify_GetDomainName
160
161 Network setDomainName I=eth0 D=${domain_name}
162 ${eth0}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}
163 ${eth0_domain_name}= Strip String ${eth0['FQDN']}
164 ... characters=${eth0['HostName']}. mode=left
165 ${tool_domain_name}= Network getDomainName I=eth0
166 Valid Value eth0_domain_name ['${tool_domain_name}']
Naman Navin Hegde6b09db32019-09-10 00:54:12 -0500167
168
Naman Navin Hegde1192b622019-11-04 23:51:07 -0600169Verify Add VLAN
170 [Documentation] Verify add VLAN via openbmctool.
171 [Tags] Verify_Add_VLAN
172 [Teardown] Network deleteVLAN I=eth0_35
173
174 Network addVLAN I=eth0 n=35
175 ${eth0_vlan}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}VLANs/eth0_35
176 Valid Value eth0_vlan['Id'] ['eth0_35']
177
178
179Verify Delete VLAN
180 [Documentation] Verify delete VLAN via openbmctool.
181 [Tags] Verify_Delete_VLAN
182
183 Network addVLAN I=eth0 n=35
184 ${eth0_vlan}= Redfish.Get Properties ${REDFISH_NW_ETH0_URI}VLANs/eth0_35
185 Valid Value eth0_vlan['Id'] ['eth0_35']
186 Network deleteVLAN I=eth0_35
187 Redfish.Get Properties
188 ... ${REDFISH_NW_ETH0_URI}VLANs/eth0_35 valid_status_codes=[${HTTP_NOT_FOUND}]
189
190
Naman Navin Hegde53691452019-07-30 00:22:37 -0500191*** Keywords ***
192
193Suite Setup Execution
194 [Documentation] Verify connectivity to run openbmctool commands.
195
196 Valid Value OPENBMC_HOST
197 Valid Value OPENBMC_USERNAME
198 Valid Value OPENBMC_PASSWORD
Naman Navin Hegde45dd94f2019-09-17 22:27:12 -0500199 Redfish.Login
Naman Navin Hegde53691452019-07-30 00:22:37 -0500200
201 # Verify connectivity to the BMC host.
202 ${bmc_version}= Get BMC Version
203
204 # Verify can find the openbmctool.
205 ${openbmctool_file_path}= which openbmctool.py
206 Printn
207 Rprint Vars openbmctool_file_path
208
209 # Get the version number from openbmctool.
210 ${openbmctool_version}= Get Openbmctool Version
211
212 ${rc} ${res}= Openbmctool Execute Command network view-config${parser}
213 Set Suite Variable ${interface} ${res.strip()}
214
215 Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
216
217
218Validate Non Existence Of IP On BMC
219 [Documentation] Verify that IP address is not present in set of IP addresses.
220 [Arguments] ${ip_address} ${ip_data}
221
222 # Description of argument(s):
223 # ip_address IP address to check (e.g. xx.xx.xx.xx).
224 # ip_data Set of the IP addresses present.
225
226 Should Not Contain Match ${ip_data} ${ip_address}/*
227 ... msg=${ip_address} found in the list provided.
228
229
230Wait And Verify IP On BMC
231 [Documentation] Wait and verify if system IP exists.
232 [Arguments] ${ip}
233
234 # Description of argument(s):
235 # ip IP address to verify (e.g. xx.xx.xx.xx).
236
237 # Note:Network restart takes around 15-18s after network-config with openbmctool.
238
239 Sleep ${NETWORK_TIMEOUT}s
240 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
241
242 Verify IP On BMC ${ip}