aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-19 12:47:01 -0400
committerJim Hahn <jrh3@att.com>2019-04-19 14:59:58 -0400
commit0a594cf5cb96a31bf7e5abb0d00844db25fa7408 (patch)
treea1187f2c8cad5a8fbee453be5c81326e4a6d53fb /tests
parent2d3f0db728f0e4c24e4a5461edea4a4ffa97d97b (diff)
Flesh out PAP CSITs
This exercises all of the PAP REST APIs, except for the simple policy "deploy" API. Change-Id: I681c4c40f05f6e343a782e764f7f939ecbb31258 Issue-ID: POLICY-1672 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/policy/pap/data/create.group.request.json42
-rw-r--r--tests/policy/pap/pap-test.robot89
2 files changed, 131 insertions, 0 deletions
diff --git a/tests/policy/pap/data/create.group.request.json b/tests/policy/pap/data/create.group.request.json
new file mode 100644
index 00000000..b0937f7f
--- /dev/null
+++ b/tests/policy/pap/data/create.group.request.json
@@ -0,0 +1,42 @@
+{
+ "groups": [
+ {
+ "name": "create.group.request",
+ "pdpGroupState": "PASSIVE",
+ "properties": {
+ "hello": "world"
+ },
+ "pdpSubgroups": [
+ {
+ "pdpType": "pdpTypeA",
+ "desiredInstanceCount": 2,
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ "version": "1.0.0"
+ }
+ ],
+ "policies": [
+ {
+ "name": "onap.restart.tca",
+ "version": "1.0.0"
+ }
+ ]
+ },
+ {
+ "pdpType": "pdpTypeB",
+ "desiredInstanceCount": 1,
+ "properties": {},
+ "supportedPolicyTypes": [
+ {
+ "name": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ "version": "1.0.0"
+ }
+ ],
+ "policies": []
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/policy/pap/pap-test.robot b/tests/policy/pap/pap-test.robot
index d187d8fc..0a6251de 100644
--- a/tests/policy/pap/pap-test.robot
+++ b/tests/policy/pap/pap-test.robot
@@ -26,3 +26,92 @@ Statistics
Log Received response from policy ${resp.text}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As Strings ${resp.json()['code']} 200
+
+CreatePdpGroups
+ [Documentation] Runs Policy PAP Create PDP Groups
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${postjson}= Get file ${CURDIR}/data/create.group.request.json
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/pap/v1/pdps data=${postjson} headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+ActivatePdpGroup
+ [Documentation] Runs Policy PAP Change PDP Group State to ACTIVE
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=ACTIVE headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+QueryPdpGroups
+ [Documentation] Runs Policy PAP Query PDP Groups
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['groups'][0]['name']} controlloop
+ Should Be Equal As Strings ${resp.json()['groups'][1]['name']} create.group.request
+ Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ACTIVE
+ Should Be Equal As Strings ${resp.json()['groups'][2]['name']} monitoring
+
+UndeployPolicy
+ [Documentation] Runs Policy PAP Undeploy a Policy from PDP Groups
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.restart.tca headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+QueryPdpGroupsAfterUndeploy
+ [Documentation] Runs Policy PAP Query PDP Groups after Undeploy
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['groups'][1]['name']} create.group.request
+ Should Be Equal As Strings ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} []
+
+DeactivatePdpGroup
+ [Documentation] Runs Policy PAP Change PDP Group State to PASSIVE
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Put Request policy /policy/pap/v1/pdps/groups/create.group.request?state=PASSIVE headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+DeletePdpGroups
+ [Documentation] Runs Policy PAP Delete PDP Groups
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Delete Request policy /policy/pap/v1/pdps/groups/create.group.request headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+QueryPdpGroupsAfterDelete
+ [Documentation] Runs Policy PAP Query PDP Groups after Delete
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${POLICY_PAP_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pap/v1/pdps headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['groups'][0]['name']} controlloop
+ Should Be Equal As Strings ${resp.json()['groups'][1]['name']} monitoring