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 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 130 | ***keywords*** |
| 131 | |
| 132 | Get 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 | |
| 152 | AddNetworkInfo |
| 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} |