Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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 Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 6 | Resource ../lib/rest_client.robot |
| 7 | Resource ../lib/connection_client.robot |
| 8 | Resource ../lib/utils.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 9 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 10 | Library ../lib/pythonutil.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 12 | Suite Setup Open Connection And Log In |
| 13 | Suite Teardown Close All Connections |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 14 | Test Teardown Log FFDC |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 16 | *** Test Cases *** |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 17 | |
| 18 | Get 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 Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 28 | set suite variable ${OLD_MAC_ADDRESS} ${json['data']} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 29 | |
| 30 | |
| 31 | Get 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 | |
| 44 | Get 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 | |
| 58 | Set 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 | |
| 65 | Set 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 | |
| 73 | Set 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 | |
| 80 | Set 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 | |
| 87 | Set 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 | |
| 94 | Set 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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 102 | Get IP Address type |
| 103 | [Tags] GOOD-PATH |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 104 | [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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 106 | ... 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 Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 120 | |
Rahul Maheshwari | 4f467f3 | 2016-09-03 15:02:57 -0500 | [diff] [blame] | 121 | Wait Until Keyword Succeeds 30 sec 5 sec Initialize OpenBMC |
| 122 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 123 | @{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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 131 | Set invalid Mac address eth0 gg:hh:jj:kk:ll:mm error |
| 132 | [Tags] network_test |
| 133 | [Template] SetMacAddress_bad |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 134 | [Documentation] This test case tries to set the invalid mac address |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 135 | ... on the eth0 interface. |
| 136 | ... Expectation is that it should throw error. |
| 137 | |
| 138 | |
| 139 | Set valid Mac address eth0 00:21:cc:73:91:dd ok |
George Keishing | 9e7796f | 2016-09-23 10:15:57 -0500 | [diff] [blame] | 140 | [Tags] network_test Set_valid_Mac_address |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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 Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 146 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 147 | Revert old Mac address eth0 ${OLD_MAC_ADDRESS} ok |
George Keishing | 9e7796f | 2016-09-23 10:15:57 -0500 | [diff] [blame] | 148 | [Tags] network_test Revert_old_Mac_address |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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 | |
| 158 | Get 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 | |
| 178 | AddNetworkInfo |
| 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 | |
| 189 | SetMacAddress_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 | |
| 199 | SetMacAddress_good |
| 200 | [Arguments] ${intf} ${address} ${result} |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 201 | ${arglist}= Create List ${intf} ${address} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 202 | ${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 Maheshwari | 4f467f3 | 2016-09-03 15:02:57 -0500 | [diff] [blame] | 209 | Wait Until Keyword Succeeds 30 sec 5 sec Initialize OpenBMC |
| 210 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 211 | @{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} |