blob: 427f42c484ce4f60b0d173481dbacd7bcc92f4a5 [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
27${parser} |grep "ipv4"|awk -F/ 'NR==1{print$5}'
28${ignore_err} ${0}
29
30
31*** Test Cases ***
32
33Verify GetIP
34 [Documentation] Verify that openbmctool.py can run the getIP command.
35 [Tags] Verify_GetIP
36
37 ${ip_records}= Network getIP I=eth0
38 ${addresses}= Nested Get Address ${ip_records}
39
40 Verify IP On BMC ${addresses}[${0}]
41
42
43Verify AddIP
44 [Documentation] Verify that openbmctool.py can run the addIP command.
45 [Tags] Verify_AddIP
46
47 Network addIP I=${interface} a=${ip} l=24 p=ipv4
48
49 Wait And Verify IP On BMC ${ip}
50
51
52Verify GetDefaultGW
53 [Documentation] Verify that openbmctool.py can run the getDefaultGW command.
54 [Tags] Verify_GetDefaultGW
55
56 ${default_gw}= Network getDefaultGW
57
58 Verify Gateway On BMC ${default_gw}
59
60
61Verify RemoveIP
62 [Documentation] Verify that openbmctool.py can run the rmIP command.
63 [Tags] Verify_RemoveIP
64
65 Network addIP I=${interface} a=${ip} l=24 p=ipv4
66 Wait And Verify IP On BMC ${ip}
67
68 Network rmIP I=${interface} a=${ip}
69
70 ${status}= Run Keyword And Return Status Wait And Verify IP On BMC ${ip}
71 Should Be Equal ${status} ${False}
72
73
74Verify SetDNS
75 [Documentation] Verify that openbmctool.py can run the setDNS command.
76 [Tags] Verify_SetDNS
77
78 Network setDNS I=eth0 d=${dns_ip}
79 ${dns_config}= CLI Get Nameservers
80
81 Should Contain ${dns_config} ${dns_ip}
82
83
84Verify GetDNS
85 [Documentation] Verify that openbmctool.py can run the getDNS command.
86 [Tags] Verify_GetDNS
87
88 Network setDNS I=eth0 d=${dns_ip}
89 ${dns_data}= Network getDNS I=eth0
90 ${dns_config}= CLI Get Nameservers
91
92 Should Contain ${dns_config} ${dns_data}[${0}]
93
94
95Verify SetHostName
96 [Documentation] Verify that openbmctool.py can run the setHostName command.
97 [Tags] Verify_SetHostName
98
99 Network setHostName H=randomName
100 ${bmc_hostname}= Get BMC Hostname
101
102 Should Be Equal As Strings ${bmc_hostname} randomName
103
104
105Verify GetHostName
106 [Documentation] Verify that openbmctool.py can run the getHostName command.
107 [Tags] Verify_GetHostName
108
109 ${tool_hostname}= Network getHostName
110 ${bmc_hostname}= Get BMC Hostname
111
112 Should Be Equal As Strings ${bmc_hostname} ${tool_hostname}
113
114
115*** Keywords ***
116
117Suite Setup Execution
118 [Documentation] Verify connectivity to run openbmctool commands.
119
120 Valid Value OPENBMC_HOST
121 Valid Value OPENBMC_USERNAME
122 Valid Value OPENBMC_PASSWORD
123
124 # Verify connectivity to the BMC host.
125 ${bmc_version}= Get BMC Version
126
127 # Verify can find the openbmctool.
128 ${openbmctool_file_path}= which openbmctool.py
129 Printn
130 Rprint Vars openbmctool_file_path
131
132 # Get the version number from openbmctool.
133 ${openbmctool_version}= Get Openbmctool Version
134
135 ${rc} ${res}= Openbmctool Execute Command network view-config${parser}
136 Set Suite Variable ${interface} ${res.strip()}
137
138 Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]
139
140
141Validate Non Existence Of IP On BMC
142 [Documentation] Verify that IP address is not present in set of IP addresses.
143 [Arguments] ${ip_address} ${ip_data}
144
145 # Description of argument(s):
146 # ip_address IP address to check (e.g. xx.xx.xx.xx).
147 # ip_data Set of the IP addresses present.
148
149 Should Not Contain Match ${ip_data} ${ip_address}/*
150 ... msg=${ip_address} found in the list provided.
151
152
153Wait And Verify IP On BMC
154 [Documentation] Wait and verify if system IP exists.
155 [Arguments] ${ip}
156
157 # Description of argument(s):
158 # ip IP address to verify (e.g. xx.xx.xx.xx).
159
160 # Note:Network restart takes around 15-18s after network-config with openbmctool.
161
162 Sleep ${NETWORK_TIMEOUT}s
163 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
164
165 Verify IP On BMC ${ip}