aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dmaap-buscontroller/ssl_suite/test1.robot
blob: b57233777bf67da5541b658217db8fa70955b81d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
*** Settings ***
Library       OperatingSystem
Library       RequestsLibrary
Library       HttpLibrary.HTTP
Library       Collections
Library       String

*** Variables ***
${MESSAGE}    Hello, world!
${DBC_URI}    /webapi

*** Test Cases ***
String Equality Test
    Should Be Equal    ${MESSAGE}    Hello, world!

Dir Test
    [Documentation]    Check if /tmp exists
    Log                ${MESSAGE}
    CheckDir           /tmp

Url Test
    [Documentation]    Check if www.onap.org can be reached
    Create Session     openo          http://www.onap.org    disable_warnings=True
    CheckUrl           openo          /                        200

HTTPS Heartbeat Test
    [Documentation]        Check ${DBC_URI}/info SSL endpoint
    Create Session         heartbeat          https://${DMAAPBC_IP}:8443    disable_warnings=True
    CheckUrl               heartbeat          ${DBC_URI}/info   204

HTTPS Dmaap Init Test
    [Documentation]        Check ${DBC_URI}/dmaap SSL endpoint
    Create Session         heartbeat          https://${DMAAPBC_IP}:8443    disable_warnings=True
    CheckStatus            heartbeat          ${DBC_URI}/dmaap   "VALID"

HTTPS Dmaap dcaeLocations Test
    [Documentation]        Check ${DBC_URI}/dcaeLocations SSL endpoint
    Create Session         heartbeat          https://${DMAAPBC_IP}:8443    disable_warnings=True
    CheckStatus0           heartbeat          ${DBC_URI}/dcaeLocations   "VALID"

HTTPS Dmaap mr_clusters Test
    [Documentation]        Check ${DBC_URI}/mr_clusters SSL endpoint
    Create Session         heartbeat          https://${DMAAPBC_IP}:8443    disable_warnings=True
    CheckStatus0           heartbeat          ${DBC_URI}/mr_clusters   "VALID"


*** Keywords ***
CheckDir
    [Arguments]                 ${path}
    Directory Should Exist      ${path}

CheckUrl
    [Arguments]                  ${session}   ${path}     ${expect}
    ${resp}=                     RequestsLibrary.Get On Session          ${session}               ${path}
    Should Be Equal As Integers  ${resp.status_code}  ${expect}

CheckStatus
    [Arguments]                  ${session}   ${path}     ${expect}
    ${resp}=                     RequestsLibrary.Get On Session          ${session}               ${path}
    log                          ${resp.content}
    ${val}=                      Get Json value       ${resp.content}     /status
    log                          ${val}
    should be equal as strings   ${val}      ${expect}

CheckStatus0
    [Arguments]                  ${session}   ${path}     ${expect}
    ${resp}=                     RequestsLibrary.Get On Session          ${session}               ${path}
    log                          ${resp.json()}
    log                          ${resp.content}
# silliness to strip off the brackets returned for a List to get a Dict
    ${t1}=                       Remove String       ${resp.content}       [
    ${dict}=                     Remove String       ${t1}                 ]
    log                          ${dict}
    ${val}=                      Get Json value       ${dict}     /status
    log                          ${val}
    should be equal as strings   ${val}      ${expect}