blob: 8e059ffd689b87e4a9637318020be9b042f18478 (
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
|
*** Settings ***
Library RequestsLibrary
Library Collections
Library OperatingSystem
Library Process
Library json
Resource common-library.robot
*** Variables ***
${OPA_PDP_HOST} /policy/pdpo/v1/healthcheck
${url} /policy/pdpo/v1/decision
*** Test Cases ***
Healthcheck
[Documentation] Verify OPA PDP health check
PdpxGetReq ${OPA_PDP_HOST} <Response [200]>
ValidatingPolicyWithoutPolicyFilter
[Documentation] Validating the policy without giving policy filter
ValidatePolicyResponseWithoutFilter onap.policy.opa.pdp.decision.request.json 400 onap.policy.opa.pdp.decision.request.output.json
ValidatingPolicyWithPolicyFilter
[Documentation] Validating the policy with policy filter
ValidatePolicyResponse onap.policy.opa.pdp.decision.request_filter.json 200 onap.policy.opa.pdp.decision.filter_response.json
ValidatingPolicyWithEmptyPolicyFilter
[Documentation] Validating the policy with empty policy filter
ValidatePolicyResponse onap.policy.opa.pdp.decision.request_filter_empty.json 200 onap.policy.opa.pdp.decision.empty_filter_response.json
*** Keywords ***
PdpxGetReq
[Documentation] Verify the response of Health Check is Successful
[Arguments] ${url} ${status}
${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${POLICY_OPA_IP} ${url} 200 null ${hcauth}
Should Be Equal As Strings ${resp} ${status}
ValidatePolicyResponse
[Documentation] Validating the output for the policy
[Arguments] ${jsonfile} ${status} ${jsonfile1}
${expectedStatus}= Set Variable ${status}
${postjson}= Get file ${CURDIR}/data/${jsonfile}
${expected_data}= Get file ${CURDIR}/data/${jsonfile1}
${hcauth}= PolicyAdminAuth
${resp}= PerformPostRequest ${POLICY_OPA_IP} ${url} ${expectedStatus} ${postjson} abbrev=true ${hcauth}
${response_data}= Get From Dictionary ${resp.json()} output
${expected_value}= Evaluate json.loads('''${expected_data}''') json
${expected_output}= Get From Dictionary ${expected_value} output
Dictionaries Should Be Equal ${response_data} ${expected_output}
ValidatePolicyResponseWithoutFilter
[Documentation] Validating the output for the policy
[Arguments] ${jsonfile} ${status} ${jsonfile1}
${expectedStatus}= Set Variable ${status}
${postjson}= Get file ${CURDIR}/data/${jsonfile}
${expected_data}= Get file ${CURDIR}/data/${jsonfile1}
${hcauth}= PolicyAdminAuth
${resp}= PerformPostRequest ${POLICY_OPA_IP} ${url} ${expectedStatus} ${postjson} abbrev=true ${hcauth}
${response_data}= Get From Dictionary ${resp.json()} responseCode
${expected_value}= Evaluate json.loads('''${expected_data}''') json
${expected_output}= Get From Dictionary ${expected_value} responseCode
Should Be Equal As Strings ${response_data} ${expected_output}
|