Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
Gunnar Mills | 56b3289 | 2016-11-14 13:56:17 -0600 | [diff] [blame] | 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 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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 |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 14 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
George Keishing | 8f7c1fa | 2017-03-06 06:17:47 -0600 | [diff] [blame] | 16 | Force Tags NetworkManager |
| 17 | |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 18 | *** Variables *** |
| 19 | |
| 20 | ${NW_MANAGER} ${NETWORK_MANAGER_URI}Interface |
| 21 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 22 | *** Test Cases *** |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 23 | |
| 24 | Get the Mac address |
| 25 | |
| 26 | [Documentation] This test case is to get the mac address |
| 27 | [Tags] network_test |
| 28 | @{arglist}= Create List eth0 |
| 29 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 30 | ${resp}= Call Method ${NW_MANAGER} GetHwAddress data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | should not be empty ${resp.content} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 32 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 33 | should be equal as strings ${json['status']} ok |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 34 | set suite variable ${OLD_MAC_ADDRESS} ${json['data']} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 35 | |
| 36 | |
| 37 | Get IP Address with invalid interface |
| 38 | |
| 39 | [Documentation] This test case tries to get the ip addrees with the invalid |
| 40 | ... interface,Expectation is it should get error. |
| 41 | [Tags] network_test |
| 42 | |
| 43 | @{arglist}= Create List lo01 |
| 44 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 45 | ${resp}= Call Method ${NW_MANAGER} GetAddress4 data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | should not be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 47 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 48 | should be equal as strings ${json['status']} error |
| 49 | |
| 50 | Get IP Address with valid interface |
| 51 | |
| 52 | [Documentation] This test case tries to get the ip addrees with the invalid |
| 53 | ... interface,Expectation is it should get error. |
| 54 | [Tags] network_test |
| 55 | |
| 56 | @{arglist}= Create List eth0 |
| 57 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 58 | ${resp}= Call Method ${NW_MANAGER} GetAddress4 data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 59 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 60 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 61 | should be equal as strings ${json['status']} ok |
| 62 | |
| 63 | |
| 64 | Set the IP address on invalid Interface lo01 1.1.1.1 255.255.255.0 1.1.1.1 error |
| 65 | |
| 66 | [Tags] network_test |
| 67 | [Template] AddNetworkInfo |
| 68 | [Documentation] This test case tries to set the ip addrees with the invalid |
| 69 | ... interface,Expectation is it should get error |
| 70 | |
| 71 | Set invalid IP address on the valid interface eth0 ab.cd.ef.gh 255.255.255.0 1.1.1.1 error |
| 72 | |
| 73 | [Tags] network_test |
| 74 | [Template] AddNetworkInfo |
| 75 | [Documentation] This test case tries to set the invalid ip addrees on the interface |
| 76 | ... Expectation is it should get error. |
| 77 | |
| 78 | |
| 79 | Set IP address with invalid subnet mask eth0 2.2.2.2 av.ih.jk.lm 1.1.1.1 error |
| 80 | |
| 81 | [Tags] network_test |
| 82 | [Template] AddNetworkInfo |
| 83 | [Documentation] This test case tries to set the ip addrees on the interface |
| 84 | ... with invalid subnet mask,Expectation is it should get error. |
| 85 | |
| 86 | Set empty IP address eth0 ${EMPTY} 255.255.255.0 1.1.1.1 error |
| 87 | |
| 88 | [Tags] network_test |
| 89 | [Template] AddNetworkInfo |
| 90 | [Documentation] This test case tries to set the NULL ip addrees on the interface |
| 91 | ... Expectation is it should get error. |
| 92 | |
| 93 | Set empty subnet mask eth0 2.2.2.2 ${EMPTY} 1.1.1.1 error |
| 94 | |
| 95 | [Tags] network_test |
| 96 | [Template] AddNetworkInfo |
| 97 | [Documentation] This test case tries to set the ip addrees on the interface |
| 98 | ... with empty subnet mask,Expectation is it should get error. |
| 99 | |
| 100 | Set empty gateway eth0 2.2.2.2 255.255.255.0 ${EMPTY} error |
| 101 | |
| 102 | [Tags] network_test |
| 103 | [Template] AddNetworkInfo |
| 104 | [Documentation] This test case tries to set the ip addrees on the interface |
| 105 | ... with empty gateway,Expectation is it should get error. |
| 106 | |
| 107 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 108 | Get IP Address type |
| 109 | [Tags] GOOD-PATH |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 110 | [Documentation] This test case tries to set existing ipaddress address and |
| 111 | ... later tries to verify that ip address type is set to static |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 112 | ... due to the operation. |
| 113 | |
| 114 | ${networkInfo}= Get networkInfo from the interface eth0 |
| 115 | ${result}= convert to integer ${networkInfo['data'][1]} |
| 116 | |
| 117 | ${CURRENT_MASK}= calcDottedNetmask ${result} |
| 118 | ${CURRENT_IP}= set variable ${networkInfo['data'][2]} |
| 119 | ${CURRENT_GATEWAY}= set variable ${networkInfo['data'][3]} |
| 120 | |
| 121 | ${arglist}= Create List eth0 ${CURRENT_IP} ${CURRENT_MASK} ${CURRENT_GATEWAY} |
| 122 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 123 | run keyword and ignore error Call Method ${NW_MANAGER} SetAddress4 data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 124 | |
| 125 | Wait For Host To Ping ${CURRENT_IP} |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 126 | |
Rahul Maheshwari | 4f467f3 | 2016-09-03 15:02:57 -0500 | [diff] [blame] | 127 | Wait Until Keyword Succeeds 30 sec 5 sec Initialize OpenBMC |
| 128 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 129 | @{arglist}= Create List eth0 |
| 130 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 131 | ${resp}= Call Method ${NW_MANAGER} GetAddressType data=${args} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 132 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 133 | Should Be Equal ${json['data']} STATIC |
| 134 | should be equal as strings ${json['status']} ok |
| 135 | |
Prashanth Katti | 85e90e6 | 2017-03-17 05:07:10 -0500 | [diff] [blame] | 136 | ### IP ADDRESS OCTET VALIDATION ### |
| 137 | |
| 138 | Set Broadcast IP address eth0 6.6.6.255 255.255.255.0 1.1.1.1 error |
| 139 | |
| 140 | [Documentation] Configure broadcast IP address. |
| 141 | [Tags] Set_Broadcast_IP_address |
| 142 | [Template] AddNetworkInfo |
| 143 | |
| 144 | Set Network ID address eth0 6.6.6.0 255.255.255.0 1.1.1.1 error |
| 145 | |
| 146 | [Documentation] Configure network ID address. |
| 147 | [Tags] Set_Network_ID_address |
| 148 | [Template] AddNetworkInfo |
| 149 | |
| 150 | Set Multicast IP address eth0 224.6.6.23 255.255.255.0 1.1.1.1 error |
| 151 | |
| 152 | [Documentation] Configure multicast IP address. |
| 153 | [Tags] Set_Multicast_IP_address |
| 154 | [Template] AddNetworkInfo |
| 155 | |
| 156 | Set Loopback IP address eth0 127.6.6.23 255.255.255.0 1.1.1.1 error |
| 157 | |
| 158 | [Documentation] Configure loopback IP address. |
| 159 | [Tags] Set_Loopback_IP_address |
| 160 | [Template] AddNetworkInfo |
| 161 | |
| 162 | Set Wrong First Octet IP eth0 0.6.6.23 255.255.255.0 1.1.1.1 error |
| 163 | |
| 164 | [Documentation] Configure wrong first octet IP address. |
| 165 | [Tags] Set_Wrong_First_Octet_IP |
| 166 | [Template] AddNetworkInfo |
| 167 | |
| 168 | Set Wrong Second Octet IP eth0 6.256.6.23 255.255.255.0 1.1.1.1 error |
| 169 | |
| 170 | [Documentation] Configure wrong second octet IP address. |
| 171 | [Tags] Set_Wrong_Second_Octet_IP |
| 172 | [Template] AddNetworkInfo |
| 173 | |
| 174 | Set Wrong Third Octet IP eth0 6.6.256.23 255.255.255.0 1.1.1.1 error |
| 175 | |
| 176 | [Documentation] Configure wrong third octet IP address. |
| 177 | [Tags] Set_Wrong_Third_Octet_IP |
| 178 | [Template] AddNetworkInfo |
| 179 | |
| 180 | |
Gunnar Mills | 7c8923f | 2016-12-12 21:19:52 -0600 | [diff] [blame] | 181 | *** Keywords *** |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 182 | |
| 183 | Get networkInfo from the interface |
| 184 | |
| 185 | [Documentation] This keyword is used to match the given ip with the configured one. |
| 186 | ... returns true if match successfull else false |
| 187 | ... eg:- Outout of getAddress4 |
| 188 | ... NewFormat:-{"data": [ 2,25,"9.3.164.147","9.3.164.129"],"message": "200 OK","status": "ok"} |
| 189 | ... OldFormat:- |
| 190 | ... {"data": [[[2,25,0,128,"9.3.164.177"],[2,8,254,128,"127.0.0.1"]],"9.3.164.129"], |
| 191 | ... "message": "200 OK", "status": "ok"} |
| 192 | |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 193 | [Arguments] ${intf} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 194 | @{arglist}= Create List ${intf} |
| 195 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 196 | ${resp}= Call Method ${NW_MANAGER} GetAddress4 data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 197 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 198 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 199 | log to console ${json['data'][2]} |
| 200 | log to console ${json['data'][3]} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 201 | [Return] ${json} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 202 | |
| 203 | AddNetworkInfo |
| 204 | [Arguments] ${intf} ${address} ${mask} ${gateway} ${result} |
| 205 | |
| 206 | ${arglist}= Create List ${intf} ${address} ${mask} ${gateway} |
| 207 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 208 | ${resp}= Call Method ${NW_MANAGER} SetAddress4 data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 209 | should not be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 210 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 211 | should be equal as strings ${json['status']} ${result} |