blob: 3b7ae88022dbdbbc0faa105689f3474c995b8949 [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
Chris Austenb29d2e82016-06-07 12:25:35 -0500130***keywords***
131
132Get networkInfo from the interface
133
134 [Documentation] This keyword is used to match the given ip with the configured one.
135 ... returns true if match successfull else false
136 ... eg:- Outout of getAddress4
137 ... NewFormat:-{"data": [ 2,25,"9.3.164.147","9.3.164.129"],"message": "200 OK","status": "ok"}
138 ... OldFormat:-
139 ... {"data": [[[2,25,0,128,"9.3.164.177"],[2,8,254,128,"127.0.0.1"]],"9.3.164.129"],
140 ... "message": "200 OK", "status": "ok"}
141
142 [arguments] ${intf}
143 @{arglist}= Create List ${intf}
144 ${args}= Create Dictionary data=@{arglist}
145 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddress4 data=${args}
146 should be equal as strings ${resp.status_code} ${HTTP_OK}
147 ${json} = to json ${resp.content}
148 log to console ${json['data'][2]}
149 log to console ${json['data'][3]}
150 [return] ${json}
151
152AddNetworkInfo
153 [Arguments] ${intf} ${address} ${mask} ${gateway} ${result}
154
155 ${arglist}= Create List ${intf} ${address} ${mask} ${gateway}
156 ${args}= Create Dictionary data=@{arglist}
157 ${resp}= Call Method /org/openbmc/NetworkManager/Interface/ SetAddress4 data=${args}
158 should not be equal as strings ${resp.status_code} ${HTTP_OK}
159 ${json} = to json ${resp.content}
160 should be equal as strings ${json['status']} ${result}