aboutsummaryrefslogtreecommitdiffstats
path: root/csit/resources/tests/drools-applications-test.robot
diff options
context:
space:
mode:
Diffstat (limited to 'csit/resources/tests/drools-applications-test.robot')
-rw-r--r--csit/resources/tests/drools-applications-test.robot176
1 files changed, 96 insertions, 80 deletions
diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot
index edbc1df6..3c4303ad 100644
--- a/csit/resources/tests/drools-applications-test.robot
+++ b/csit/resources/tests/drools-applications-test.robot
@@ -23,9 +23,9 @@ Healthcheck
${resp}= PeformGetRequest /healthcheck ${DROOLS_IP} 200
Should Be Equal As Strings ${resp.json()['healthy']} True
-#Controller
-# [Documentation] Checks controller is up
-# Wait Until Keyword Succeeds 2 min 15 sec VerifyController
+Controller
+ [Documentation] Checks controller is up
+ Wait Until Keyword Succeeds 2 min 15 sec VerifyController
MakeTopics
[Documentation] Creates the Policy topics
@@ -34,112 +34,113 @@ MakeTopics
CreateVcpeXacmlPolicy
[Documentation] Create VCPE Policy for Xacml
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200
+ CreatePolicy vCPE.policy.monitoring.input.tosca.yaml yaml
CreateVcpeDroolsPolicy
[Documentation] Create VCPE Policy for Drools
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200
+ CreatePolicy vCPE.policy.operational.input.tosca.yaml yaml
CreateVdnsXacmlPolicy
[Documentation] Create VDNS Policy for Xacml
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200
+ CreatePolicy vDNS.policy.monitoring.input.tosca.yaml yaml
CreateVdnsDroolsPolicy
[Documentation] Create VDNS Policy for Drools
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vDNS.policy.operational.input.tosca.json ${DATA} json 200
+ CreatePolicy vDNS.policy.operational.input.tosca.json json
CreateVfwXacmlPolicy
[Documentation] Create VFW Policy for Xacml
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200
+ CreatePolicy vFirewall.policy.monitoring.input.tosca.yaml yaml
CreateVfwDroolsPolicy
[Documentation] Create VFW Policy for Drools
- PerformPostRequest /policy/api/v1/policies null ${POLICY_API_IP} vFirewall.policy.operational.input.tosca.json ${DATA} json 200
+ CreatePolicy vFirewall.policy.operational.input.tosca.json json
DeployXacmlPolicies
[Documentation] Deploys the Policies to Xacml
- PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.xacml.policies.json ${CURDIR}/data json 202
+ DeployPolicy deploy.xacml.policies.json
Sleep 5s
${result}= CheckKafkaTopic policy-notification onap.vfirewall.tca
Should Contain ${result} deployed-policies
Should Contain ${result} onap.scaleout.tca
Should Contain ${result} onap.restart.tca
-# Uncomment the drools policy deployment once the drools pdp code is fixed
-#DeployDroolsPolicies
-# [Documentation] Deploys the Policies to Drools
-# PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${POLICY_PAP_IP} deploy.drools.policies.json ${CURDIR}/data json 202
-# Sleep 5s
-# ${result}= CheckKafkaTopic policy-notification operational.modifyconfig
-# Should Contain ${result} deployed-policies
-# Should Contain ${result} operational.scaleout
-# Should Contain ${result} operational.restart
-#
+DeployDroolsPolicies
+ [Documentation] Deploys the Policies to Drools
+ DeployPolicy deploy.drools.policies.json
+ Sleep 5s
+ ${result}= CheckKafkaTopic policy-notification operational.modifyconfig
+ Should Contain ${result} deployed-policies
+ Should Contain ${result} operational.scaleout
+ Should Contain ${result} operational.restart
+
#VcpeExecute
# [Documentation] Executes VCPE Policy
# OnSet ${CURDIR}/data/vcpeOnset.json
-# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# Should Contain ${result} Sending guard query for APPC Restart
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# Should Contain ${result} Guard result for APPC Restart is Permit
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# Should Contain ${result} actor=APPC,operation=Restart
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# Should Contain ${result} actor=APPC,operation=Restart
-# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS
-# Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
-# Should Contain ${result} APPC
-# Should Contain ${result} Restart
+# ${policyExecuted}= Set Variable ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+# @{otherMessages}= Create List ACTIVE
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION Sending guard query for APPC Restart
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION Guard result for APPC Restart is Permit
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
#
-#VdnsExecute
-# [Documentation] Executes VDNS Policy
-# OnSet ${CURDIR}/data/vdnsOnset.json
-# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# Should Contain ${result} Sending guard query for SO VF Module Create
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# Should Contain ${result} Guard result for SO VF Module Create is Permit
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# Should Contain ${result} actor=SO,operation=VF Module Create
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# Should Contain ${result} actor=SO,operation=VF Module Create
-# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS
-# Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
-# Should Contain ${result} SO
-# Should Contain ${result} VF Module Create
+# @{otherMessages}= Create List OPERATION actor=APPC,operation=Restart
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
#
+# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=Restart
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List FINAL: SUCCESS APPC Restart
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+VdnsExecute
+ [Documentation] Executes VDNS Policy
+ OnSet ${CURDIR}/data/vdnsOnset.json
+ ${policyExecuted}= Set Variable ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ @{otherMessages}= Create List ACTIVE
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+ @{otherMessages}= Create List OPERATION Sending guard query for SO VF Module Create
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+ @{otherMessages}= Create List OPERATION Guard result for SO VF Module Create is Permit
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+ @{otherMessages}= Create List OPERATION actor=SO,operation=VF Module Create
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+ @{otherMessages}= Create List OPERATION: SUCCESS actor=SO,operation=VF Module Create
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
+ @{otherMessages}= Create List FINAL: SUCCESS SO VF Module Create
+ AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
#VfwExecute
# [Documentation] Executes VFW Policy
# OnSet ${CURDIR}/data/vfwOnset.json
-# ${result}= CheckKafkaTopic policy-cl-mgt ACTIVE
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# Should Contain ${result} Sending guard query for APPC ModifyConfig
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# Should Contain ${result} Guard result for APPC ModifyConfig is Permit
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# Should Contain ${result} actor=APPC,operation=ModifyConfig
-# ${result}= CheckKafkaTopic policy-cl-mgt OPERATION: SUCCESS
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# Should Contain ${result} actor=APPC,operation=ModifyConfig
-# ${result}= CheckKafkaTopic policy-cl-mgt FINAL: SUCCESS
-# Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
-# Should Contain ${result} APPC
-# Should Contain ${result} ModifyConfig
+# ${policyExecuted}= Set Variable ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+# @{otherMessages}= Create List ACTIVE
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION Sending guard query for APPC ModifyConfig
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION Guard result for APPC ModifyConfig is Permit
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION actor=APPC,operation=ModifyConfig
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# @{otherMessages}= Create List OPERATION: SUCCESS actor=APPC,operation=ModifyConfig
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+#
+# Log "Checking if policy execution status is FINAL: SUCCESS"
+# @{otherMessages}= Create List FINAL: SUCCESS APPC ModifyConfig
+# AssertMessageFromTopic policy-cl-mgt ${policyExecuted} ${otherMessages}
+
*** Keywords ***
@@ -158,13 +159,13 @@ PeformGetRequest
RETURN ${resp}
PerformPostRequest
- [Arguments] ${url} ${params} ${domain} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus}
+ [Arguments] ${url} ${domain} ${file} ${folder} ${contenttype} ${expectedstatus}
${auth}= Create List policyadmin zb!XztG34
- ${postjson}= Get file ${filepath}/${jsonfile}
+ ${body}= Get file ${folder}/${file}
Log Creating session http://${domain}
${session}= Create Session policy http://${domain} auth=${auth}
${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype}
- ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus}
+ ${resp}= POST On Session policy ${url} data=${body} headers=${headers} expected_status=${expectedstatus}
Log Received response from policy ${resp.text}
RETURN ${resp}
@@ -174,3 +175,18 @@ OnSet
${resp}= Run Process ${CURDIR}/kafka_producer.py unauthenticated.dcae_cl_output ${data} ${KAFKA_IP}
Log Response from kafka ${resp.stdout}
RETURN ${resp.stdout}
+
+CreatePolicy
+ [Arguments] ${policyFile} ${contenttype}
+ PerformPostRequest /policy/api/v1/policies ${POLICY_API_IP} ${policyFile} ${DATA} ${contenttype} 201
+
+DeployPolicy
+ [Arguments] ${policyName}
+ PerformPostRequest /policy/pap/v1/pdps/deployments/batch ${POLICY_PAP_IP} ${policyName} ${CURDIR}/data json 202
+
+AssertMessageFromTopic
+ [Arguments] ${topic} ${topicMessage} ${otherMessages}
+ ${response}= Wait Until Keyword Succeeds 4 x 10 sec CheckKafkaTopic ${topic} ${topicMessage}
+ FOR ${msg} IN @{otherMessages}
+ Should Contain ${response} ${msg}
+ END