Add migration in integration tests
[policy/docker.git] / csit / resources / tests / policy-clamp-test.robot
1 *** Settings ***
2 Library     Collections
3 Library     RequestsLibrary
4 Library     OperatingSystem
5 Library     String
6 Library     json
7 Library     yaml
8
9 *** Test Cases ***
10 HealthcheckAcm
11      [Documentation]    Healthcheck on Clamp Acm
12      ${auth}=    Create List    runtimeUser    zb!XztG34
13      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
14      ${session}=    Create Session      ACM  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
15      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
16      ${resp}=   GET On Session     ACM  /onap/policy/clamp/acm/health     headers=${headers}
17      Log    Received response from ACM healthcheck {resp.text}
18      Should Be Equal As Strings    ${resp.status_code}     200
19
20 HealthcheckParticipantSim
21      [Documentation]    Healthcheck on Participant Simulator
22      ${auth}=    Create List    participantUser    zb!XztG34
23      Log    Creating session http://${POLICY_PARTICIPANT_SIM_IP}
24      ${session}=    Create Session      participant  http://${POLICY_PARTICIPANT_SIM_IP}   auth=${auth}
25      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
26      ${resp}=   GET On Session     participant  /onap/policy/simparticipant/health     headers=${headers}
27      Log    Received response from participant healthcheck {resp.text}
28      Should Be Equal As Strings    ${resp.status_code}     200
29
30 HealthcheckApi
31      [Documentation]    Healthcheck on policy-api
32      Wait Until Keyword Succeeds    5 min    10 sec    VerifyHealthcheckApi
33
34 HealthcheckPap
35      [Documentation]    Healthcheck on policy-pap
36      Wait Until Keyword Succeeds    5 min    10 sec    VerifyHealthcheckPap
37
38 RegisterParticipants
39      [Documentation]  Register Participants.
40      ${auth}=    Create List    runtimeUser    zb!XztG34
41      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
42      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
43      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/participants
44      Log    Received response from runtime acm ${resp.text}
45      Should Be Equal As Strings    ${resp.status_code}     202
46
47 CommissionAutomationComposition
48      [Documentation]  Commission automation composition definition.
49      ${auth}=    Create List    runtimeUser    zb!XztG34
50      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
51      ${postyaml}=  Get file  ${CURDIR}/data/acelement-usecase.yaml
52      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
53      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
54      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions   data=${postyaml}  headers=${headers}
55      Log    Received response from runtime acm ${resp.text}
56      ${respyaml}=  yaml.Safe Load  ${resp.text}
57      set Suite variable  ${compositionId}  ${respyaml["compositionId"]}
58      Should Be Equal As Strings    ${resp.status_code}     201
59
60 CommissionAcDefinitionMigrationFrom
61      [Documentation]  Commission automation composition definition From.
62      ${auth}=    Create List    runtimeUser    zb!XztG34
63      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
64      ${postyaml}=  Get file  ${CURDIR}/data/ac-definition-migration-from.yaml
65      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
66      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
67      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions   data=${postyaml}  headers=${headers}
68      Log    Received response from runtime acm ${resp.text}
69      ${respyaml}=  yaml.Safe Load  ${resp.text}
70      set Suite variable  ${compositionFromId}  ${respyaml["compositionId"]}
71      Should Be Equal As Strings    ${resp.status_code}     201
72
73 CommissionAcDefinitionMigrationTo
74      [Documentation]  Commission automation composition definition To.
75      ${auth}=    Create List    runtimeUser    zb!XztG34
76      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
77      ${postyaml}=  Get file  ${CURDIR}/data/ac-definition-migration-to.yaml
78      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
79      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
80      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions   data=${postyaml}  headers=${headers}
81      Log    Received response from runtime acm ${resp.text}
82      ${respyaml}=  yaml.Safe Load  ${resp.text}
83      set Suite variable  ${compositionToId}  ${respyaml["compositionId"]}
84      Should Be Equal As Strings    ${resp.status_code}     201
85
86 PrimeACDefinitions
87      [Documentation]  Prime automation composition definition
88      ${auth}=    Create List    runtimeUser    zb!XztG34
89      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
90      ${postjson}=  Get file  ${CURDIR}/data/ACPriming.json
91      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
92      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
93      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}   data=${postjson}  headers=${headers}
94      Should Be Equal As Strings    ${resp.status_code}     202
95      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionId}  PRIMED
96
97 PrimeACDefinitionFrom
98      [Documentation]  Prime automation composition definition Migration From.
99      ${auth}=    Create List    runtimeUser    zb!XztG34
100      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
101      ${postjson}=  Get file  ${CURDIR}/data/ACPriming.json
102      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
103      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
104      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}   data=${postjson}  headers=${headers}
105      Should Be Equal As Strings    ${resp.status_code}     202
106      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionFromId}  PRIMED
107
108 PrimeACDefinitionTo
109      [Documentation]  Prime automation composition definition Migration To.
110      ${auth}=    Create List    runtimeUser    zb!XztG34
111      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
112      ${postjson}=  Get file  ${CURDIR}/data/ACPriming.json
113      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
114      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
115      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}   data=${postjson}  headers=${headers}
116      Should Be Equal As Strings    ${resp.status_code}     202
117      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionToId}  PRIMED
118
119 InstantiateAutomationComposition
120      [Documentation]  Instantiate automation composition.
121      ${auth}=    Create List    runtimeUser    zb!XztG34
122      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
123      ${K8sEnabled}=    Convert To Boolean    ${CLAMP_K8S_TEST}
124      Run Keyword If    '${K8sEnabled}'=='True'    set Suite variable  ${instantiationfile}  AcK8s.json
125
126      ...    ELSE    set Suite variable  ${instantiationfile}  AcDocker.json
127      ${postjson}=  Get file  ${CURDIR}/data/${instantiationfile}
128      ${updatedpostjson}=   Replace String     ${postjson}     COMPOSITIONIDPLACEHOLDER       ${compositionId}
129      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
130      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
131      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances   data=${updatedpostjson}  headers=${headers}
132      Log    Received response from runtime acm ${resp.text}
133      ${respyaml}=  yaml.Safe Load  ${resp.text}
134      set Suite variable  ${instanceId}    ${respyaml["instanceId"]}
135      Should Be Equal As Strings    ${resp.status_code}     201
136
137 InstantiateAutomationCompositionMigrationFrom
138      [Documentation]  Instantiate automation composition migration.
139      ${auth}=    Create List    runtimeUser    zb!XztG34
140      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
141      ${postyaml}=  Get file  ${CURDIR}/data/ac-instance-migration-from.yaml
142      ${updatedpostyaml}=   Replace String     ${postyaml}     COMPOSITIONIDPLACEHOLDER       ${compositionFromId}
143      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
144      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
145      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances   data=${updatedpostyaml}  headers=${headers}
146      Log    Received response from runtime acm ${resp.text}
147      ${respyaml}=  yaml.Safe Load  ${resp.text}
148      set Suite variable  ${instanceMigrationId}    ${respyaml["instanceId"]}
149      Should Be Equal As Strings    ${resp.status_code}     201
150
151 DeployAutomationComposition
152      [Documentation]  Deploy automation composition.
153      ${auth}=    Create List    runtimeUser    zb!XztG34
154      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
155      ${postjson}=  Get file  ${CURDIR}/data/DeployAC.json
156      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
157      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
158      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}   data=${postjson}  headers=${headers}
159      Log    Received response from runtime acm ${resp.text}
160      Should Be Equal As Strings    ${resp.status_code}     202
161      Wait Until Keyword Succeeds    10 min    5 sec    VerifyDeployStatus  ${compositionId}  ${instanceId}  DEPLOYED
162
163 QueryPolicies
164      [Documentation]    Verify the new policies deployed
165      ${auth}=    Create List    policyadmin    zb!XztG34
166      Sleep  10s
167      Log    Creating session http://${POLICY_PAP_IP}
168      ${session}=    Create Session      policy  http://${POLICY_PAP_IP}   auth=${auth}
169      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
170      ${resp}=   GET On Session     policy  /policy/pap/v1/policies/deployed     headers=${headers}
171      Log    Received response from policy-pap {resp.text}
172      Should Be Equal As Strings    ${resp.status_code}     200
173      Dictionary Should Contain Value  ${resp.json()[0]}  onap.policies.native.apex.ac.element
174
175 QueryPolicyTypes
176      [Documentation]    Verify the new policy types created
177      ${auth}=    Create List    policyadmin    zb!XztG34
178      Sleep  10s
179      Log    Creating session http://${POLICY_API_IP}:6969
180      ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
181      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
182      ${resp}=   GET On Session     policy  /policy/api/v1/policytypes     headers=${headers}
183      Log    Received response from policy-api ${resp.text}
184      Should Be Equal As Strings    ${resp.status_code}     200
185      List Should Contain Value  ${resp.json()['policy_types']}  onap.policies.native.Apex
186
187 DeployAutomationCompositionMigration
188      [Documentation]  Deploy automation composition.
189      ${auth}=    Create List    runtimeUser    zb!XztG34
190      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
191      ${postjson}=  Get file  ${CURDIR}/data/DeployAC.json
192      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
193      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
194      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances/${instanceMigrationId}   data=${postjson}  headers=${headers}
195      Log    Received response from runtime acm ${resp.text}
196      Should Be Equal As Strings    ${resp.status_code}     202
197      Wait Until Keyword Succeeds    10 min    5 sec    VerifyDeployStatus  ${compositionFromId}  ${instanceMigrationId}  DEPLOYED
198
199 SendOutPropertiesToRuntime
200      [Documentation]  Send Out Properties To Runtime
201      ${auth}=    Create List    participantUser    zb!XztG34
202      Log    Creating session http://${POLICY_PARTICIPANT_SIM_IP}
203      ${postjson}=  Get file  ${CURDIR}/data/OutProperties.json
204      ${updatedpostjson}=   Replace String     ${postjson}     INSTACEIDPLACEHOLDER       ${instanceMigrationId}
205      ${updatedpostjson}=   Replace String     ${updatedpostjson}     TEXTPLACEHOLDER       MyTextToSend
206      ${session}=    Create Session      policy  http://${POLICY_PARTICIPANT_SIM_IP}   auth=${auth}
207      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
208      ${resp}=   PUT On Session     policy  /onap/policy/simparticipant/v2/datas   data=${updatedpostjson}  headers=${headers}
209      Log    Received response from participant sim ${resp.text}
210      Should Be Equal As Strings    ${resp.status_code}     200
211      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPropertiesUpdated  ${compositionFromId}  ${instanceMigrationId}  MyTextToSend
212
213 AutomationCompositionUpdate
214      [Documentation]  Update of an automation composition.
215      ${auth}=    Create List    runtimeUser    zb!XztG34
216      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
217      ${postyaml}=  Get file  ${CURDIR}/data/ac-instance-update.yaml
218      ${updatedpostyaml}=   Replace String     ${postyaml}     COMPOSITIONIDPLACEHOLDER       ${compositionFromId}
219      ${updatedpostyaml}=   Replace String     ${updatedpostyaml}     INSTACEIDPLACEHOLDER       ${instanceMigrationId}
220      ${updatedpostyaml}=   Replace String     ${updatedpostyaml}     TEXTPLACEHOLDER       MyTextUpdated
221      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
222      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
223      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances   data=${updatedpostyaml}  headers=${headers}
224      Log    Received response from runtime acm ${resp.text}
225      Should Be Equal As Strings    ${resp.status_code}     200
226      Wait Until Keyword Succeeds    2 min    5 sec    VerifyDeployStatus  ${compositionFromId}  ${instanceMigrationId}  DEPLOYED
227      VerifyPropertiesUpdated  ${compositionFromId}  ${instanceMigrationId}  MyTextUpdated
228      VerifyParticipantSim  ${instanceMigrationId}  MyTextUpdated
229
230 AutomationCompositionMigrationTo
231      [Documentation]  Migration of an automation composition.
232      ${auth}=    Create List    runtimeUser    zb!XztG34
233      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
234      ${postyaml}=  Get file  ${CURDIR}/data/ac-instance-migration-to.yaml
235      ${updatedpostyaml}=   Replace String     ${postyaml}     COMPOSITIONIDPLACEHOLDER       ${compositionFromId}
236      ${updatedpostyaml}=   Replace String     ${updatedpostyaml}     COMPOSITIONTARGETIDPLACEHOLDER       ${compositionToId}
237      ${updatedpostyaml}=   Replace String     ${updatedpostyaml}     INSTACEIDPLACEHOLDER       ${instanceMigrationId}
238      ${updatedpostyaml}=   Replace String     ${updatedpostyaml}     TEXTPLACEHOLDER       TextForMigration
239      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
240      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
241      ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}/instances   data=${updatedpostyaml}  headers=${headers}
242      Log    Received response from runtime acm ${resp.text}
243      Should Be Equal As Strings    ${resp.status_code}     200
244      Wait Until Keyword Succeeds    10 min    5 sec    VerifyDeployStatus  ${compositionToId}  ${instanceMigrationId}  DEPLOYED
245      VerifyPropertiesUpdated  ${compositionToId}  ${instanceMigrationId}  TextForMigration
246      VerifyParticipantSim  ${instanceMigrationId}  TextForMigration
247
248 UnDeployAutomationComposition
249      [Documentation]  UnDeploy automation composition.
250      ${auth}=    Create List    runtimeUser    zb!XztG34
251      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
252      ${postjson}=  Get file  ${CURDIR}/data/UndeployAC.json
253      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
254      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
255      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}   data=${postjson}   headers=${headers}
256      Log    Received response from runtime acm ${resp.text}
257      Should Be Equal As Strings    ${resp.status_code}     202
258      Wait Until Keyword Succeeds    10 min    5 sec    VerifyDeployStatus  ${compositionId}  ${instanceId}  UNDEPLOYED
259
260 UnDeployAutomationCompositionMigrationTo
261      [Documentation]  UnDeploy automation composition migrated.
262      ${auth}=    Create List    runtimeUser    zb!XztG34
263      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
264      ${postjson}=  Get file  ${CURDIR}/data/UndeployAC.json
265      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
266      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
267      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId}   data=${postjson}   headers=${headers}
268      Log    Received response from runtime acm ${resp.text}
269      Should Be Equal As Strings    ${resp.status_code}     202
270      Wait Until Keyword Succeeds    10 min    5 sec    VerifyDeployStatus  ${compositionToId}  ${instanceMigrationId}  UNDEPLOYED
271
272 UnInstantiateAutomationComposition
273      [Documentation]  Delete automation composition instance.
274      ${auth}=    Create List    runtimeUser    zb!XztG34
275      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
276      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
277      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
278      ${resp}=   DELETE On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}     headers=${headers}
279      Log    Received response from runtime acm ${resp.text}
280      Should Be Equal As Strings    ${resp.status_code}     202
281      Wait Until Keyword Succeeds    1 min    5 sec    VerifyUninstantiated  ${compositionId}
282
283 UnInstantiateAutomationCompositionMigrationTo
284      [Documentation]  Delete automation composition instance migrated.
285      ${auth}=    Create List    runtimeUser    zb!XztG34
286      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
287      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
288      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
289      ${resp}=   DELETE On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${instanceMigrationId}     headers=${headers}
290      Log    Received response from runtime acm ${resp.text}
291      Should Be Equal As Strings    ${resp.status_code}     202
292      Wait Until Keyword Succeeds    1 min    5 sec    VerifyUninstantiated  ${compositionToId}
293
294 DePrimeACDefinitions
295      [Documentation]  DePrime automation composition definition
296      ${auth}=    Create List    runtimeUser    zb!XztG34
297      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
298      ${postjson}=  Get file  ${CURDIR}/data/ACDepriming.json
299      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
300      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
301      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}   data=${postjson}  headers=${headers}
302      Should Be Equal As Strings    ${resp.status_code}     202
303      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionId}  COMMISSIONED
304
305 DePrimeACDefinitionsFrom
306      [Documentation]  DePrime automation composition definition migration From.
307      ${auth}=    Create List    runtimeUser    zb!XztG34
308      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
309      ${postjson}=  Get file  ${CURDIR}/data/ACDepriming.json
310      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
311      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
312      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}   data=${postjson}  headers=${headers}
313      Should Be Equal As Strings    ${resp.status_code}     202
314      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionFromId}  COMMISSIONED
315
316 DePrimeACDefinitionsTo
317      [Documentation]  DePrime automation composition definition migration To.
318      ${auth}=    Create List    runtimeUser    zb!XztG34
319      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
320      ${postjson}=  Get file  ${CURDIR}/data/ACDepriming.json
321      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
322      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
323      ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}   data=${postjson}  headers=${headers}
324      Should Be Equal As Strings    ${resp.status_code}     202
325      Wait Until Keyword Succeeds    2 min    5 sec    VerifyPriming  ${compositionToId}  COMMISSIONED
326
327 DeleteACDefinition
328      [Documentation]  Delete automation composition definition.
329      ${auth}=    Create List    runtimeUser    zb!XztG34
330      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
331      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
332      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
333      ${resp}=   DELETE On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}  headers=${headers}
334      Log    Received response from runtime acm ${resp.text}
335      Should Be Equal As Strings    ${resp.status_code}     200
336
337 DeleteACDefinitionFrom
338      [Documentation]  Delete automation composition definition migration From.
339      ${auth}=    Create List    runtimeUser    zb!XztG34
340      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
341      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
342      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
343      ${resp}=   DELETE On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionFromId}  headers=${headers}
344      Log    Received response from runtime acm ${resp.text}
345      Should Be Equal As Strings    ${resp.status_code}     200
346
347 DeleteACDefinitionTo
348      [Documentation]  Delete automation composition definition migration To.
349      ${auth}=    Create List    runtimeUser    zb!XztG34
350      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
351      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
352      ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
353      ${resp}=   DELETE On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}  headers=${headers}
354      Log    Received response from runtime acm ${resp.text}
355      Should Be Equal As Strings    ${resp.status_code}     200
356
357
358 *** Keywords ***
359
360 VerifyHealthcheckApi
361      [Documentation]    Verify Healthcheck on policy-api
362      ${auth}=    Create List    policyadmin    zb!XztG34
363      Log    Creating session http://${POLICY_API_IP}
364      ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
365      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
366      ${resp}=   GET On Session     policy  /policy/api/v1/health     headers=${headers}
367      Log    Received response from policy-api healthcheck ${resp.text}
368      Should Be Equal As Strings    ${resp.status_code}   200
369
370 VerifyHealthcheckPap
371      [Documentation]    Verify Healthcheck on policy-pap
372      ${auth}=    Create List    policyadmin    zb!XztG34
373      Log    Creating session http://${POLICY_PAP_IP}
374      ${session}=    Create Session      policy  http://${POLICY_PAP_IP}   auth=${auth}
375      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
376      ${resp}=   GET On Session     policy  /policy/pap/v1/health     headers=${headers}
377      Log    Received response from policy-pap healthcheck ${resp.text}
378      Should Be Equal As Strings    ${resp.status_code}     200
379
380 VerifyPriming
381     [Arguments]  ${theCompositionId}  ${primestate}
382     [Documentation]    Verify the AC definitions are primed to the participants
383     ${auth}=    Create List    runtimeUser    zb!XztG34
384     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
385     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
386     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
387     ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${theCompositionId}   headers=${headers}
388     Should Be Equal As Strings    ${resp.status_code}   200
389     Run Keyword If  ${resp.status_code}==200  Should Be Equal As Strings  ${resp.json()['state']}  ${primestate}
390
391 VerifyDeployStatus
392      [Arguments]  ${theCompositionId}  ${theInstanceId}  ${deploystate}
393      [Documentation]  Verify the Deploy status of automation composition.
394      ${auth}=    Create List    runtimeUser    zb!XztG34
395      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
396      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
397      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
398      ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId}     headers=${headers}
399      Should Be Equal As Strings    ${resp.status_code}     200
400      Run Keyword If  ${resp.status_code}==200  Should Be Equal As Strings  ${resp.json()['deployState']}  ${deploystate}
401
402 VerifyPropertiesUpdated
403      [Arguments]  ${theCompositionId}  ${theInstanceId}  ${textToFind}
404      [Documentation]  Verify the Deploy status of automation composition.
405      ${auth}=    Create List    runtimeUser    zb!XztG34
406      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
407      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
408      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
409      ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances/${theInstanceId}     headers=${headers}
410      Should Be Equal As Strings    ${resp.status_code}     200
411      ${respstring}   Convert To String   ${resp.json()}
412      Run Keyword If  ${resp.status_code}==200  Should Match Regexp  ${respstring}  ${textToFind}
413
414 VerifyParticipantSim
415      [Arguments]  ${theInstanceId}  ${textToFind}
416      [Documentation]  Query on Participant Simulator
417      ${auth}=    Create List    participantUser    zb!XztG34
418      Log    Creating session http://${POLICY_PARTICIPANT_SIM_IP}
419      ${session}=    Create Session      ACM  http://${POLICY_PARTICIPANT_SIM_IP}   auth=${auth}
420      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
421      ${resp}=   GET On Session     ACM  /onap/policy/simparticipant/v2/instances/${theInstanceId}     headers=${headers}
422      Log    Received response from participant {resp.text}
423      Should Be Equal As Strings    ${resp.status_code}     200
424      ${respstring}   Convert To String   ${resp.json()}
425      Should Match Regexp  ${respstring}  ${textToFind}
426
427 VerifyUninstantiated
428      [Arguments]  ${theCompositionId}
429      [Documentation]  Verify the Uninstantiation of automation composition.
430      ${auth}=    Create List    runtimeUser    zb!XztG34
431      Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
432      ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
433      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
434      ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${theCompositionId}/instances     headers=${headers}
435      Should Be Equal As Strings    ${resp.status_code}     200
436      Run Keyword If  ${resp.status_code}==200  Length Should Be  ${resp.json()['automationCompositionList']}  0
437
438