blob: 0a6251de39f67751a1040076cf4b9c13a02bce41 [file] [log] [blame]
ramverma9e9f7222019-02-11 16:25:44 +00001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Test Cases ***
8Healthcheck
9 [Documentation] Runs Policy PAP Health check
10 ${auth}= Create List healthcheck zb!XztG34
11 Log Creating session https://${POLICY_PAP_IP}:6969
12 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
13 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
ramverma55c1fcf2019-02-22 14:08:15 +000014 ${resp}= Get Request policy /policy/pap/v1/healthcheck headers=${headers}
ramverma9e9f7222019-02-11 16:25:44 +000015 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 PAP Statistics
21 ${auth}= Create List healthcheck zb!XztG34
22 Log Creating session https://${POLICY_PAP_IP}:6969
23 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
24 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
ramverma55c1fcf2019-02-22 14:08:15 +000025 ${resp}= Get Request policy /policy/pap/v1/statistics headers=${headers}
ramverma9e9f7222019-02-11 16:25:44 +000026 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
Jim Hahn0a594cf2019-04-19 12:47:01 -040029
30CreatePdpGroups
31 [Documentation] Runs Policy PAP Create PDP Groups
32 ${auth}= Create List healthcheck zb!XztG34
33 Log Creating session https://${POLICY_PAP_IP}:6969
34 ${postjson}= Get file ${CURDIR}/data/create.group.request.json
35 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
36 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
37 ${resp}= Post Request policy /policy/pap/v1/pdps data=${postjson} headers=${headers}
38 Log Received response from policy ${resp.text}
39 Should Be Equal As Strings ${resp.status_code} 200
40
41ActivatePdpGroup
42 [Documentation] Runs Policy PAP Change PDP Group State to ACTIVE
43 ${auth}= Create List healthcheck zb!XztG34
44 Log Creating session https://${POLICY_PAP_IP}:6969
45 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
46 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
47 ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=ACTIVE headers=${headers}
48 Log Received response from policy ${resp.text}
49 Should Be Equal As Strings ${resp.status_code} 200
50
51QueryPdpGroups
52 [Documentation] Runs Policy PAP Query PDP Groups
53 ${auth}= Create List healthcheck zb!XztG34
54 Log Creating session https://${POLICY_PAP_IP}:6969
55 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
56 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
57 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
58 Log Received response from policy ${resp.text}
59 Should Be Equal As Strings ${resp.status_code} 200
60 Should Be Equal As Strings ${resp.json()['groups'][0]['name']} controlloop
61 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} create.group.request
62 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ACTIVE
63 Should Be Equal As Strings ${resp.json()['groups'][2]['name']} monitoring
64
65UndeployPolicy
66 [Documentation] Runs Policy PAP Undeploy a Policy from PDP Groups
67 ${auth}= Create List healthcheck zb!XztG34
68 Log Creating session https://${POLICY_PAP_IP}:6969
69 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
70 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
71 ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers}
72 Log Received response from policy ${resp.text}
73 Should Be Equal As Strings ${resp.status_code} 200
74
75QueryPdpGroupsAfterUndeploy
76 [Documentation] Runs Policy PAP Query PDP Groups after Undeploy
77 ${auth}= Create List healthcheck zb!XztG34
78 Log Creating session https://${POLICY_PAP_IP}:6969
79 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
80 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
81 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
82 Log Received response from policy ${resp.text}
83 Should Be Equal As Strings ${resp.status_code} 200
84 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} create.group.request
85 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} []
86
87DeactivatePdpGroup
88 [Documentation] Runs Policy PAP Change PDP Group State to PASSIVE
89 ${auth}= Create List healthcheck zb!XztG34
90 Log Creating session https://${POLICY_PAP_IP}:6969
91 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
92 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
93 ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=PASSIVE headers=${headers}
94 Log Received response from policy ${resp.text}
95 Should Be Equal As Strings ${resp.status_code} 200
96
97DeletePdpGroups
98 [Documentation] Runs Policy PAP Delete PDP Groups
99 ${auth}= Create List healthcheck zb!XztG34
100 Log Creating session https://${POLICY_PAP_IP}:6969
101 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
102 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
103 ${resp}= Delete Request policy /policy/pap/v1/pdps/groups/create.group.request headers=${headers}
104 Log Received response from policy ${resp.text}
105 Should Be Equal As Strings ${resp.status_code} 200
106
107QueryPdpGroupsAfterDelete
108 [Documentation] Runs Policy PAP Query PDP Groups after Delete
109 ${auth}= Create List healthcheck zb!XztG34
110 Log Creating session https://${POLICY_PAP_IP}:6969
111 ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
112 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
113 ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
114 Log Received response from policy ${resp.text}
115 Should Be Equal As Strings ${resp.status_code} 200
116 Should Be Equal As Strings ${resp.json()['groups'][0]['name']} controlloop
117 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} monitoring