aboutsummaryrefslogtreecommitdiffstats
path: root/tests/clamp/APIs/01__Test_CL_APIs.robot
blob: 1a87432321a391e2e65db00b0ce056fd32da0717 (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
*** Settings ***
Library     Collections
Library     RequestsLibrary
Library     OperatingSystem
Library     json

*** Variables ***
${login}                     admin
${passw}                     password

*** Keywords ***
Create the sessions
    ${auth}=    Create List     ${login}    ${passw}
    Create Session   clamp  https://localhost:8443   auth=${auth}   disable_warnings=1
    Set Global Variable     ${clamp_session}      clamp

*** Test Cases ***
Get Requests health check ok
    Create the sessions
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
    Should Be Equal As Strings  ${resp.status_code}     200

List TCAs
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/getAllNames
    Should Contain Match    ${resp}   *LOOP_iYTIP_v1_0_ResourceInstanceName1_tca*
    Should Contain Match    ${resp}   *tca_2*
    Should Contain Match    ${resp}   *LOOP_iYTIP_v1_0_ResourceInstanceName1_tca_3*

Open TCA1
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca
    Should Contain Match    ${resp}   *LOOP_iYTIP_v1_0_ResourceInstanceName1_tca*
    Should Contain Match    ${resp}   *GENERATED_POLICY_ID_AT_SUBMIT*
    Should Contain Match    ${resp}   *onap.policy.monitoring.cdap.tca.hi.lo.app*
    Should Contain Match    ${resp}   *TCA Policy Scope*

Open TCA2
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/LOOP_iYTIP_v1_0_ResourceInstanceName2_tca_2
    Should Contain Match    ${resp}   *LOOP_iYTIP_v1_0_ResourceInstanceName2_tca_2*
    Should Contain Match    ${resp}   *GENERATED_POLICY_ID_AT_SUBMIT*
    Should Contain Match    ${resp}   *dmaap.onap-message-router*
    Should Contain Match    ${resp}   *TCA Policy Scope*

Open TCA3
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca_3
    Should Contain Match    ${resp}   *LOOP_iYTIP_v1_0_ResourceInstanceName1_tca*
    Should Contain Match    ${resp}   *GENERATED_POLICY_ID_AT_SUBMIT*
    Should Contain Match    ${resp}   *onap.policy.monitoring.cdap.tca.hi.lo.app*
    Should Contain Match    ${resp}   *TCA Policy Scope Version*

Modify MicroService Policy TCA1
    ${data}=    Get Binary File     ${CURDIR}${/}data${/}microservicePolicyTca1.json
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    POST Request    ${clamp_session}   /restservices/clds/v2/loop/updateMicroservicePolicy/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca     data=${data}   headers=${headers}
    Should Be Equal As Strings      ${resp.status_code}     200

Verify Modification MicroService TCA1
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca
    Should Contain Match    ${resp}   *version1.11*

Modify Operational Policy TCA1
    ${data}=    Get Binary File     ${CURDIR}${/}data${/}operationalPolicyTca1.json
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    POST Request    ${clamp_session}   /restservices/clds/v2/loop/updateOperationalPolicies/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca     data=${data}   headers=${headers}
    Should Be Equal As Strings      ${resp.status_code}     200

Verify Modification Operational TCA1
    ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v2/loop/LOOP_iYTIP_v1_0_ResourceInstanceName1_tca
    Should Contain Match    ${resp}   *Test_Field*