blob: 28d4b4e486b97aab4b5be9a5505d2b3dc38ea00b [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
7Library ../../lib/gen_print.py
8Library ../../lib/gen_robot_print.py
9Library ../../lib/openbmctool_utils.py
10Library ../../lib/gen_misc.py
11Library ../../lib/gen_robot_valid.py
12Resource ../../syslib/utils_os.robot
13Resource ../../lib/resource.robot
14Resource ../../lib/bmc_network_utils.robot
15Resource ../../lib/utils.robot
16Resource ../../lib/common_utils.robot
17
18
19Suite Setup Suite Setup Execution
20Test Setup Printn
21
22*** Variables ***
23
24${ip} 10.5.5.5
25${dns_ip} 10.10.10.10
26${domain_name} randomName.com
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050027${mac_address} 76:e2:84:14:87:91
28${ntp_server} pool.ntp.org
Naman Navin Hegde53691452019-07-30 00:22:37 -050029${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}'
Naman Navin Hegde6b09db32019-09-10 00:54:12 -050030${eth0_resource_path} /xyz/openbmc_project/network/eth0
Naman Navin Hegde53691452019-07-30 00:22:37 -050031${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}
130 # Get NTP server details via REST.
131 ${eth0}= Read Properties ${eth0_resource_path} quiet=1
132 Rprint Vars eth0
133 Valid Value eth0['NTPServers'][0] ['${ntp_server}']
134
135
136Verify GetNTP
137 [Documentation] Verify that openbmctool can run the getNTP command.
138 [Tags] Verify_GetNTP
139
140 Network setNTP I=eth0 N=${ntp_server}
141 # Get NTP server details via REST method.
142 ${eth0}= Read Properties ${eth0_resource_path} quiet=1
143 Rprint Vars eth0
144 ${tool_ntp}= Network getNTP I=eth0
145 Valid Value eth0['NTPServers'][0] ['${tool_ntp}']
146
147
Naman Navin Hegde53691452019-07-30 00:22:37 -0500148*** Keywords ***
149
150Suite Setup Execution
151 [Documentation] Verify connectivity to run openbmctool commands.
152
153 Valid Value OPENBMC_HOST
154 Valid Value OPENBMC_USERNAME
155 Valid Value OPENBMC_PASSWORD
156
157 # Verify connectivity to the BMC host.
158 ${bmc_version}= Get BMC Version
159
160 # Verify can find the openbmctool.
161 ${openbmctool_file_path}= which openbmctool.py
162 Printn
163 Rprint Vars openbmctool_file_path
164
165 # Get the version number from openbmctool.
166 ${openbmctool_version}= Get Openbmctool Version
167
168 ${rc} ${res}= Openbmctool Execute Command network view-config${parser}
169 Set Suite Variable ${interface} ${res.strip()}
170
171 Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
172
173
174Validate Non Existence Of IP On BMC
175 [Documentation] Verify that IP address is not present in set of IP addresses.
176 [Arguments] ${ip_address} ${ip_data}
177
178 # Description of argument(s):
179 # ip_address IP address to check (e.g. xx.xx.xx.xx).
180 # ip_data Set of the IP addresses present.
181
182 Should Not Contain Match ${ip_data} ${ip_address}/*
183 ... msg=${ip_address} found in the list provided.
184
185
186Wait And Verify IP On BMC
187 [Documentation] Wait and verify if system IP exists.
188 [Arguments] ${ip}
189
190 # Description of argument(s):
191 # ip IP address to verify (e.g. xx.xx.xx.xx).
192
193 # Note:Network restart takes around 15-18s after network-config with openbmctool.
194
195 Sleep ${NETWORK_TIMEOUT}s
196 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
197
198 Verify IP On BMC ${ip}