blob: 57c71409fc37e6b54c98848e80e1f4b0e43965d7 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Documentation This suite will verifiy the Network Configuration Rest Interfaces
3... Details of valid interfaces can be found here...
4... https://github.com/openbmc/docs/blob/master/rest-api.md
5
George Keishing4d6c1da2016-07-15 05:51:22 -05006Resource ../lib/rest_client.robot
7Resource ../lib/connection_client.robot
8Resource ../lib/utils.robot
George Keishingd55a4be2016-08-26 03:28:17 -05009Resource ../lib/openbmc_ffdc.robot
George Keishing4d6c1da2016-07-15 05:51:22 -050010Library ../lib/pythonutil.py
Chris Austenb29d2e82016-06-07 12:25:35 -050011
George Keishing4d6c1da2016-07-15 05:51:22 -050012Suite Setup Open Connection And Log In
13Suite Teardown Close All Connections
George Keishingd55a4be2016-08-26 03:28:17 -050014Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -050015
George Keishing4d6c1da2016-07-15 05:51:22 -050016*** Test Cases ***
Chris Austenb29d2e82016-06-07 12:25:35 -050017
18Get the Mac address
19
20 [Documentation] This test case is to get the mac address
21 [Tags] network_test
22 @{arglist}= Create List eth0
23 ${args}= Create Dictionary data=@{arglist}
24 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetHwAddress data=${args}
25 should not be empty ${resp.content}
26 ${json} = to json ${resp.content}
27 should be equal as strings ${json['status']} ok
George Keishing06ae4aa2016-08-30 01:41:28 -050028 set suite variable ${OLD_MAC_ADDRESS} ${json['data']}
Chris Austenb29d2e82016-06-07 12:25:35 -050029
30
31Get IP Address with invalid interface
32
33 [Documentation] This test case tries to get the ip addrees with the invalid
34 ... interface,Expectation is it should get error.
35 [Tags] network_test
36
37 @{arglist}= Create List lo01
38 ${args}= Create Dictionary data=@{arglist}
39 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddress4 data=${args}
40 should not be equal as strings ${resp.status_code} ${HTTP_OK}
41 ${json} = to json ${resp.content}
42 should be equal as strings ${json['status']} error
43
44Get IP Address with valid interface
45
46 [Documentation] This test case tries to get the ip addrees with the invalid
47 ... interface,Expectation is it should get error.
48 [Tags] network_test
49
50 @{arglist}= Create List eth0
51 ${args}= Create Dictionary data=@{arglist}
52 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddress4 data=${args}
53 should be equal as strings ${resp.status_code} ${HTTP_OK}
54 ${json} = to json ${resp.content}
55 should be equal as strings ${json['status']} ok
56
57
58Set the IP address on invalid Interface lo01 1.1.1.1 255.255.255.0 1.1.1.1 error
59
60 [Tags] network_test
61 [Template] AddNetworkInfo
62 [Documentation] This test case tries to set the ip addrees with the invalid
63 ... interface,Expectation is it should get error
64
65Set invalid IP address on the valid interface eth0 ab.cd.ef.gh 255.255.255.0 1.1.1.1 error
66
67 [Tags] network_test
68 [Template] AddNetworkInfo
69 [Documentation] This test case tries to set the invalid ip addrees on the interface
70 ... Expectation is it should get error.
71
72
73Set IP address with invalid subnet mask eth0 2.2.2.2 av.ih.jk.lm 1.1.1.1 error
74
75 [Tags] network_test
76 [Template] AddNetworkInfo
77 [Documentation] This test case tries to set the ip addrees on the interface
78 ... with invalid subnet mask,Expectation is it should get error.
79
80Set empty IP address eth0 ${EMPTY} 255.255.255.0 1.1.1.1 error
81
82 [Tags] network_test
83 [Template] AddNetworkInfo
84 [Documentation] This test case tries to set the NULL ip addrees on the interface
85 ... Expectation is it should get error.
86
87Set empty subnet mask eth0 2.2.2.2 ${EMPTY} 1.1.1.1 error
88
89 [Tags] network_test
90 [Template] AddNetworkInfo
91 [Documentation] This test case tries to set the ip addrees on the interface
92 ... with empty subnet mask,Expectation is it should get error.
93
94Set empty gateway eth0 2.2.2.2 255.255.255.0 ${EMPTY} error
95
96 [Tags] network_test
97 [Template] AddNetworkInfo
98 [Documentation] This test case tries to set the ip addrees on the interface
99 ... with empty gateway,Expectation is it should get error.
100
101
Chris Austenb29d2e82016-06-07 12:25:35 -0500102Get IP Address type
103 [Tags] GOOD-PATH
George Keishing06ae4aa2016-08-30 01:41:28 -0500104 [Documentation] This test case tries to set existing ipaddress address and
105 ... later tries to verify that ip address type is set to static
Chris Austenb29d2e82016-06-07 12:25:35 -0500106 ... due to the operation.
107
108 ${networkInfo}= Get networkInfo from the interface eth0
109 ${result}= convert to integer ${networkInfo['data'][1]}
110
111 ${CURRENT_MASK}= calcDottedNetmask ${result}
112 ${CURRENT_IP}= set variable ${networkInfo['data'][2]}
113 ${CURRENT_GATEWAY}= set variable ${networkInfo['data'][3]}
114
115 ${arglist}= Create List eth0 ${CURRENT_IP} ${CURRENT_MASK} ${CURRENT_GATEWAY}
116 ${args}= Create Dictionary data=@{arglist}
117 run keyword and ignore error Call Method /org/openbmc/NetworkManager/Interface/ SetAddress4 data=${args}
118
119 Wait For Host To Ping ${CURRENT_IP}
George Keishing06ae4aa2016-08-30 01:41:28 -0500120
Rahul Maheshwari4f467f32016-09-03 15:02:57 -0500121 Wait Until Keyword Succeeds 30 sec 5 sec Initialize OpenBMC
122
Chris Austenb29d2e82016-06-07 12:25:35 -0500123 @{arglist}= Create List eth0
124 ${args}= Create Dictionary data=@{arglist}
125 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddressType data=${args}
126 ${json} = to json ${resp.content}
127 Should Be Equal ${json['data']} STATIC
128 should be equal as strings ${json['status']} ok
129
130
Chris Austenb29d2e82016-06-07 12:25:35 -0500131Set invalid Mac address eth0 gg:hh:jj:kk:ll:mm error
132 [Tags] network_test
133 [Template] SetMacAddress_bad
George Keishing06ae4aa2016-08-30 01:41:28 -0500134 [Documentation] This test case tries to set the invalid mac address
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 ... on the eth0 interface.
136 ... Expectation is that it should throw error.
137
138
139Set valid Mac address eth0 00:21:cc:73:91:dd ok
140 [Tags] network_test
141 [Template] SetMacAddress_good
142 [Documentation] ***GOOD PATH***
143 ... This test case add the ip addresson the interface and validates
144 ... that ip address has been added or not.
145 ... Expectation is the ip address should get added.
George Keishing06ae4aa2016-08-30 01:41:28 -0500146
Chris Austenb29d2e82016-06-07 12:25:35 -0500147Revert old Mac address eth0 ${OLD_MAC_ADDRESS} ok
148 [Tags] network_test
149 [Template] SetMacAddress_good
150 [Documentation] ***GOOD PATH***
151 ... This test case add the ip addresson the interface and validates
152 ... that ip address has been added or not.
153 ... Expectation is the ip address should get added.
154
155
156***keywords***
157
158Get networkInfo from the interface
159
160 [Documentation] This keyword is used to match the given ip with the configured one.
161 ... returns true if match successfull else false
162 ... eg:- Outout of getAddress4
163 ... NewFormat:-{"data": [ 2,25,"9.3.164.147","9.3.164.129"],"message": "200 OK","status": "ok"}
164 ... OldFormat:-
165 ... {"data": [[[2,25,0,128,"9.3.164.177"],[2,8,254,128,"127.0.0.1"]],"9.3.164.129"],
166 ... "message": "200 OK", "status": "ok"}
167
168 [arguments] ${intf}
169 @{arglist}= Create List ${intf}
170 ${args}= Create Dictionary data=@{arglist}
171 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddress4 data=${args}
172 should be equal as strings ${resp.status_code} ${HTTP_OK}
173 ${json} = to json ${resp.content}
174 log to console ${json['data'][2]}
175 log to console ${json['data'][3]}
176 [return] ${json}
177
178AddNetworkInfo
179 [Arguments] ${intf} ${address} ${mask} ${gateway} ${result}
180
181 ${arglist}= Create List ${intf} ${address} ${mask} ${gateway}
182 ${args}= Create Dictionary data=@{arglist}
183 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ SetAddress4 data=${args}
184 should not be equal as strings ${resp.status_code} ${HTTP_OK}
185 ${json} = to json ${resp.content}
186 should be equal as strings ${json['status']} ${result}
187
188
189SetMacAddress_bad
190 [Arguments] ${intf} ${address} ${result}
191 ${arglist}= Create List ${intf} ${address}
192 ${args}= Create Dictionary data=@{arglist}
193 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ SetHwAddress data=${args}
194 should not be equal as strings ${resp.status_code} ${HTTP_OK}
195 ${json} = to json ${resp.content}
196 should be equal as strings ${json['status']} ${result}
197
198
199SetMacAddress_good
200 [Arguments] ${intf} ${address} ${result}
George Keishing06ae4aa2016-08-30 01:41:28 -0500201 ${arglist}= Create List ${intf} ${address}
Chris Austenb29d2e82016-06-07 12:25:35 -0500202 ${args}= Create Dictionary data=@{arglist}
203 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ SetHwAddress data=${args}
204 should be equal as strings ${resp.status_code} ${HTTP_OK}
205 ${json} = to json ${resp.content}
206 should be equal as strings ${json['status']} ${result}
207 Wait For Host To Ping ${OPENBMC_HOST}
208
Rahul Maheshwari4f467f32016-09-03 15:02:57 -0500209 Wait Until Keyword Succeeds 30 sec 5 sec Initialize OpenBMC
210
Chris Austenb29d2e82016-06-07 12:25:35 -0500211 @{arglist}= Create List ${intf}
212 ${args}= Create Dictionary data=@{arglist}
213 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetHwAddress data=${args}
214 ${json} = to json ${resp.content}
215 should be equal as strings ${json['data']} ${address}