blob: 5144f966abb306412bc6c59c5dbcf04a25a87772 [file] [log] [blame]
Michael Mokry88f4d472019-03-04 12:00:05 -06001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Test Cases ***
8Healthcheck
9 [Documentation] Runs Policy Xacml PDP Health check
Jim Hahn5785bf82020-04-16 18:32:27 -040010 ${auth}= Create List healthcheck zb!XztG34
Michael Mokryed8bae52019-03-12 15:10:53 -050011 Log Creating session https://${POLICY_PDPX_IP}:6969
12 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
Michael Mokry88f4d472019-03-04 12:00:05 -060013 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
14 ${resp}= Get Request policy /policy/pdpx/v1/healthcheck headers=${headers}
15 Log Received response from policy ${resp.text}
16 Should Be Equal As Strings ${resp.status_code} 200
17 Should Be Equal As Strings ${resp.json()['code']} 200
18
19Statistics
20 [Documentation] Runs Policy Xacml PDP Statistics
HOCKLA2e519f52019-10-23 13:00:00 -050021 ${auth}= Create List healthcheck zb!XztG34
Michael Mokryed8bae52019-03-12 15:10:53 -050022 Log Creating session https://${POLICY_PDPX_IP}:6969
23 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
Michael Mokry88f4d472019-03-04 12:00:05 -060024 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
25 ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers}
26 Log Received response from policy ${resp.text}
27 Should Be Equal As Strings ${resp.status_code} 200
28 Should Be Equal As Strings ${resp.json()['code']} 200
HOCKLA2e519f52019-10-23 13:00:00 -050029
Michael Mokryb4f69622019-05-13 13:09:17 -050030ExecuteXacmlPolicy
Jim Hahn5785bf82020-04-16 18:32:27 -040031 Wait Until Keyword Succeeds 0 min 15 sec CreateNewMonitorPolicy
32 Wait Until Keyword Succeeds 0 min 15 sec DeployMonitorPolicy
33 Wait Until Keyword Succeeds 0 min 15 sec GetAbbreviatedDecisionResult
34 Wait Until Keyword Succeeds 0 min 15 sec GetMonitoringDecision
35 Wait Until Keyword Succeeds 0 min 15 sec GetNamingDecision
HOCKLA2e519f52019-10-23 13:00:00 -050036
Michael Mokryb4f69622019-05-13 13:09:17 -050037*** Keywords ***
38
Michael Mokryb4f69622019-05-13 13:09:17 -050039CreateNewMonitorPolicy
40 [Documentation] Create a new Monitoring policy
41 ${auth}= Create List healthcheck zb!XztG34
42 ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json
43 Log Creating session https://${POLICY_API_IP}:6969
44 ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth}
45 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
46 ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies data=${postjson} headers=${headers}
47 Log Received response from policy4 ${resp.text}
48 ${postjsonobject} To Json ${postjson}
49 Should Be Equal As Strings ${resp.status_code} 200
50 Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
51 Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
52
53DeployMonitorPolicy
54 [Documentation] Runs Policy PAP to deploy a policy
55 ${auth}= Create List healthcheck zb!XztG34
56 ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.deploy.json
57 Log Creating session https://${POLICY_PAP_IP}:6969
58 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
59 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
60 ${resp}= Post Request policy /policy/pap/v1/pdps/policies data=${postjson} headers=${headers}
61 Log Received response from policy5 ${resp.text}
62 ${postjsonobject} To Json ${postjson}
63 Should Be Equal As Strings ${resp.status_code} 200
64
65GetStatisticsAfterDeployed
66 [Documentation] Runs Policy Xacml PDP Statistics after policy is deployed
HOCKLA2e519f52019-10-23 13:00:00 -050067 ${auth}= Create List healthcheck zb!XztG34
Michael Mokryb4f69622019-05-13 13:09:17 -050068 Log Creating session https://${POLICY_PDPX_IP}:6969
69 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
70 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
71 ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers}
72 Log Received response from policy ${resp.text}
73 Should Be Equal As Strings ${resp.status_code} 200
74 Should Be Equal As Strings ${resp.json()['code']} 200
75 Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1
HOCKLA2e519f52019-10-23 13:00:00 -050076
77GetAbbreviatedDecisionResult
78 [Documentation] Get Decision with abbreviated results from Policy Xacml PDP
79 ${auth}= Create List healthcheck zb!XztG34
80 ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
81 Log Creating session https://${POLICY_PDPX_IP}:6969
82 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
83 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
84 ${params}= Create Dictionary abbrev=true
85 ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers}
86 Log Received response from policy ${resp.text}
87 ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
88 Should Be Equal As Strings ${resp.status_code} 200
89 Dictionary Should Contain Key ${policy} type
90 Dictionary Should Contain Key ${policy} metadata
91 Dictionary Should Not Contain Key ${policy} type_version
92 Dictionary Should Not Contain Key ${policy} properties
93 Dictionary Should Not Contain Key ${policy} name
94 Dictionary Should Not Contain Key ${policy} version
95
Jim Hahn5785bf82020-04-16 18:32:27 -040096GetMonitoringDecision
97 [Documentation] Get Decision from Monitoring Policy Xacml PDP
Michael Mokryb4f69622019-05-13 13:09:17 -050098 ${auth}= Create List healthcheck zb!XztG34
99 ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
100 Log Creating session https://${POLICY_PDPX_IP}:6969
101 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
102 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
103 ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers}
104 Log Received response from policy ${resp.text}
HOCKLA2e519f52019-10-23 13:00:00 -0500105 ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
Michael Mokryb4f69622019-05-13 13:09:17 -0500106 Should Be Equal As Strings ${resp.status_code} 200
HOCKLA2e519f52019-10-23 13:00:00 -0500107 Dictionary Should Contain Key ${policy} type
108 Dictionary Should Contain Key ${policy} metadata
109 Dictionary Should Contain Key ${policy} type_version
110 Dictionary Should Contain Key ${policy} properties
111 Dictionary Should Contain Key ${policy} name
112 Dictionary Should Contain Key ${policy} version
Jim Hahn5785bf82020-04-16 18:32:27 -0400113
114GetNamingDecision
115 [Documentation] Get Decision from Naming Policy Xacml PDP
116 ${auth}= Create List healthcheck zb!XztG34
117 ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json
118 Log Creating session https://${POLICY_PDPX_IP}:6969
119 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
120 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
121 ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers}
122 Log Received response from policy ${resp.text}
123 ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP
124 Should Be Equal As Strings ${resp.status_code} 200
125 Dictionary Should Contain Key ${policy} type
126 Dictionary Should Contain Key ${policy} type_version
127 Dictionary Should Contain Key ${policy} properties
128 Dictionary Should Contain Key ${policy} name
129
Michael Mokryb4f69622019-05-13 13:09:17 -0500130GetStatisticsAfterDecision
131 [Documentation] Runs Policy Xacml PDP Statistics after Decision request
Jim Hahn5785bf82020-04-16 18:32:27 -0400132 ${auth}= Create List healthcheck zb!XztG34
Michael Mokryb4f69622019-05-13 13:09:17 -0500133 Log Creating session https://${POLICY_PDPX_IP}:6969
134 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
135 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
136 ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers}
137 Log Received response from policy ${resp.text}
138 Should Be Equal As Strings ${resp.status_code} 200
139 Should Be Equal As Strings ${resp.json()['code']} 200
140 Should Be Equal As Strings ${resp.json()['totalDecisionsCount'] 1
Jim Hahn5785bf82020-04-16 18:32:27 -0400141
Michael Mokryb4f69622019-05-13 13:09:17 -0500142UndeployMonitorPolicy
143 [Documentation] Runs Policy PAP to undeploy a policy
144 ${auth}= Create List healthcheck zb!XztG34
145 Log Creating session https://${POLICY_PAP_IP}:6969
146 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
147 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
148 ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers}
149 Log Received response from policy ${resp.text}
150 Should Be Equal As Strings ${resp.status_code} 200
Jim Hahn5785bf82020-04-16 18:32:27 -0400151
Michael Mokryb4f69622019-05-13 13:09:17 -0500152GetStatisticsAfterUndeploy
153 [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed
Jim Hahn5785bf82020-04-16 18:32:27 -0400154 ${auth}= Create List healthcheck zb!XztG34
Michael Mokryb4f69622019-05-13 13:09:17 -0500155 Log Creating session https://${POLICY_PDPX_IP}:6969
156 ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
157 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
158 ${resp}= Get Request policy /policy/pdpx/v1/statistics headers=${headers}
159 Log Received response from policy ${resp.text}
160 Should Be Equal As Strings ${resp.status_code} 200
161 Should Be Equal As Strings ${resp.json()['code']} 200
162 Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 0