Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library HttpLibrary.HTTP |
| 5 | Library Collections |
| 6 | Library String |
| 7 | |
| 8 | *** Variables *** |
| 9 | ${MESSAGE} Hello, world! |
| 10 | ${DBC_URI} /webapi |
| 11 | |
| 12 | *** Test Cases *** |
| 13 | String Equality Test |
| 14 | Should Be Equal ${MESSAGE} Hello, world! |
| 15 | |
| 16 | Dir Test |
| 17 | [Documentation] Check if /tmp exists |
| 18 | Log ${MESSAGE} |
| 19 | CheckDir /tmp |
| 20 | |
| 21 | Url Test |
| 22 | [Documentation] Check if www.onap.org can be reached |
| 23 | Create Session openo http://www.onap.org |
| 24 | CheckUrl openo / 200 |
| 25 | |
| 26 | HTTPS Heartbeat Test |
| 27 | [Documentation] Check ${DBC_URI}/info SSL endpoint |
| 28 | Create Session heartbeat https://${DMAAPBC_IP}:8443 |
| 29 | CheckUrl heartbeat ${DBC_URI}/info 204 |
| 30 | |
| 31 | HTTPS Dmaap Init Test |
| 32 | [Documentation] Check ${DBC_URI}/dmaap SSL endpoint |
| 33 | Create Session heartbeat https://${DMAAPBC_IP}:8443 |
| 34 | CheckStatus heartbeat ${DBC_URI}/dmaap "VALID" |
| 35 | |
| 36 | HTTPS Dmaap dcaeLocations Test |
| 37 | [Documentation] Check ${DBC_URI}/dcaeLocations SSL endpoint |
| 38 | Create Session heartbeat https://${DMAAPBC_IP}:8443 |
| 39 | CheckStatus0 heartbeat ${DBC_URI}/dcaeLocations "VALID" |
| 40 | |
| 41 | HTTPS Dmaap mr_clusters Test |
| 42 | [Documentation] Check ${DBC_URI}/mr_clusters SSL endpoint |
| 43 | Create Session heartbeat https://${DMAAPBC_IP}:8443 |
| 44 | CheckStatus0 heartbeat ${DBC_URI}/mr_clusters "VALID" |
| 45 | |
| 46 | |
| 47 | *** Keywords *** |
| 48 | CheckDir |
| 49 | [Arguments] ${path} |
| 50 | Directory Should Exist ${path} |
| 51 | |
| 52 | CheckUrl |
| 53 | [Arguments] ${session} ${path} ${expect} |
| 54 | ${resp}= Get Request ${session} ${path} |
| 55 | Should Be Equal As Integers ${resp.status_code} ${expect} |
| 56 | |
| 57 | CheckStatus |
| 58 | [Arguments] ${session} ${path} ${expect} |
| 59 | ${resp}= Get Request ${session} ${path} |
| 60 | log ${resp.content} |
| 61 | ${val}= Get Json value ${resp.content} /status |
| 62 | log ${val} |
| 63 | should be equal as strings ${val} ${expect} |
| 64 | |
| 65 | CheckStatus0 |
| 66 | [Arguments] ${session} ${path} ${expect} |
| 67 | ${resp}= Get Request ${session} ${path} |
| 68 | log ${resp.json()} |
| 69 | log ${resp.content} |
| 70 | # silliness to strip off the brackets returned for a List to get a Dict |
| 71 | ${t1}= Remove String ${resp.content} [ |
| 72 | ${dict}= Remove String ${t1} ] |
| 73 | log ${dict} |
| 74 | ${val}= Get Json value ${dict} /status |
| 75 | log ${val} |
| 76 | should be equal as strings ${val} ${expect} |
| 77 | |