5fa48af285910147481dfa3d4b4eb3b8658864fb
[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 Healthcheck
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 #CommissionAutomationCompositionV1
21 #     [Documentation]  Commission automation composition.
22 #     ${auth}=    Create List    runtimeUser    zb!XztG34
23 #     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
24 #     ${postyaml}=  Get file  ${CURDIR}/data/functional-pmsh-usecase.yaml
25 #     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
26 #     ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
27 #     ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions   data=${postyaml}  headers=${headers}
28 #     Log    Received response from runtime acm ${resp.text}
29 #     ${respyaml}=  yaml.Safe Load  ${resp.text}
30 #     set Suite variable  ${compositionId}  ${respyaml["compositionId"]}
31 #     Should Be Equal As Strings    ${resp.status_code}     201
32 #
33 #InstantiateAutomationCompositionV1
34 #     [Documentation]  Instantiate automation composition.
35 #     ${auth}=    Create List    runtimeUser    zb!XztG34
36 #     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
37 #     ${postjson}=  Get file  ${CURDIR}/data/AutomationComposition.json
38 #     ${updatedpostjson}=   Replace String     ${postjson}     COMPOSITIONIDPLACEHOLDER       ${compositionId}
39 #     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
40 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
41 #     ${resp}=   POST On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances   data=${updatedpostjson}  headers=${headers}
42 #     Log    Received response from runtime acm ${resp.text}
43 #     ${respyaml}=  yaml.Safe Load  ${resp.text}
44 #     set Suite variable  ${instanceId}    ${respyaml["instanceId"]}
45 #     Should Be Equal As Strings    ${resp.status_code}     201
46 #
47 #PassivateAutomationComposition
48 #     [Documentation]  Passivate automation composition.
49 #     ${auth}=    Create List    runtimeUser    zb!XztG34
50 #     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
51 #     ${postjson}=  Get file  ${CURDIR}/data/PassiveCommand.json
52 #     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
53 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
54 #     ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}   data=${postjson}  headers=${headers}
55 #     Log    Received response from runtime acm ${resp.text}
56 #     Should Be Equal As Strings    ${resp.status_code}     200
57 #
58 #QueryPolicies
59 #     [Documentation]    Runs Policy Participant Query New Policies
60 #     ${auth}=    Create List    policyadmin    zb!XztG34
61 #     Log    Creating session http://${POLICY_API_IP}
62 #     ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
63 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
64 #     ${resp}=   GET On Session     policy  /policy/api/v1/policies     headers=${headers}
65 #     Log    Received response from policy-api {resp.text}
66 #     Should Be Equal As Strings    ${resp.status_code}     200
67 #
68 #QueryPolicyTypes
69 #     [Documentation]    Runs Policy Participant Query New Policy Types
70 #     ${auth}=    Create List    policyadmin    zb!XztG34
71 #     Log    Creating session http://${POLICY_API_IP}}:6969
72 #     ${session}=    Create Session      policy  http://${POLICY_API_IP}   auth=${auth}
73 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
74 #     ${resp}=   GET On Session     policy  /policy/api/v1/policytypes     headers=${headers}
75 #     Log    Received response from policy-api ${resp.text}
76 #     Should Be Equal As Strings    ${resp.status_code}     200
77 #
78 #StateChangeRunningAutomationComposition
79 #     [Documentation]  AutomationComposition State Change to RUNNING.
80 #     ${auth}=    Create List    runtimeUser    zb!XztG34
81 #     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
82 #     ${postjson}=  Get file  ${CURDIR}/data/RunningCommand.json
83 #     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
84 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
85 #     ${resp}=   PUT On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}   data=${postjson}  headers=${headers}  expected_status=400
86 #     Log    Received response from runtime acm ${resp.text}
87 #
88 #QueryInstantiatedACs
89 #     [Documentation]    Get Instantiated AutomationCompositions
90 #     ${auth}=    Create List    runtimeUser    zb!XztG34
91 #     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
92 #     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
93 #     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
94 #     ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId}     headers=${headers}
95 #     Log    Received response from runtime acm ${resp.text}
96 #     Should Be Equal As Strings    ${resp.status_code}     200
97 #     Should Be Equal As Strings  ${resp.json()['state']}  UNINITIALISED2PASSIVE
98 #     Should Be Equal As Strings  ${resp.json()['orderedState']}  PASSIVE