summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcsit/plans/setup.sh63
-rwxr-xr-xcsit/plans/teardown.sh19
-rw-r--r--csit/plans/testplan.txt3
-rw-r--r--csit/tests/drools-applications-test.robot275
4 files changed, 360 insertions, 0 deletions
diff --git a/csit/plans/setup.sh b/csit/plans/setup.sh
new file mode 100755
index 000000000..c6567260f
--- /dev/null
+++ b/csit/plans/setup.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# ===========LICENSE_START====================================================
+# Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+# ============================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=====================================================
+#
+source ${SCRIPTS}/get-branch-mariadb.sh
+
+echo "Uninstall docker-py and reinstall docker."
+pip uninstall -y docker-py
+pip uninstall -y docker
+pip install -U docker==2.7.0
+
+sudo apt-get -y install libxml2-utils
+
+bash ${SCRIPTS}/policy/get-models-examples.sh
+source ${SCRIPTS}/policy/detmVers.sh
+
+docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d drools-apps
+
+unset http_proxy https_proxy
+
+DROOLS_IP=`get-instance-ip.sh drools-apps`
+API_IP=`get-instance-ip.sh policy-api`
+PAP_IP=`get-instance-ip.sh policy-pap`
+XACML_IP=`get-instance-ip.sh policy-xacml-pdp`
+SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
+export SIM_IP
+
+echo DROOLS IP IS ${DROOLS_IP}
+echo API IP IS ${API_IP}
+echo PAP IP IS ${PAP_IP}
+echo XACML IP IS ${XACML_IP}
+echo SIMULATORS IP IS ${SIM_IP}
+
+# wait for the app to start up
+${SCRIPTS}/policy/wait_for_port.sh ${DROOLS_IP} 6969
+
+# give enough time for the controllers to come up
+sleep 15
+
+DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
+
+ROBOT_VARIABLES=""
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCRIPTS}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}"
diff --git a/csit/plans/teardown.sh b/csit/plans/teardown.sh
new file mode 100755
index 000000000..ce89740d2
--- /dev/null
+++ b/csit/plans/teardown.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# ===========LICENSE_START====================================================
+# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+# ============================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=====================================================
+#
+docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v
diff --git a/csit/plans/testplan.txt b/csit/plans/testplan.txt
new file mode 100644
index 000000000..3ce3d870e
--- /dev/null
+++ b/csit/plans/testplan.txt
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [policy/drools-applications.git]/tests/.
+# Place the suites in run order.
+drools-applications
diff --git a/csit/tests/drools-applications-test.robot b/csit/tests/drools-applications-test.robot
new file mode 100644
index 000000000..2ab05810d
--- /dev/null
+++ b/csit/tests/drools-applications-test.robot
@@ -0,0 +1,275 @@
+*** Settings ***
+Library Collections
+Library String
+Library RequestsLibrary
+Library OperatingSystem
+Library Process
+Library json
+
+*** Test Cases ***
+Alive
+ [Documentation] Runs Policy PDP Alive Check
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:9696
+ ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pdp/engine 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()['alive']} True
+
+Healthcheck
+ [Documentation] Runs Policy PDP-D Health check
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:6969/healthcheck
+ ${session}= Create Session policy https://${DROOLS_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /healthcheck 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()['healthy']} True
+
+Controller
+ [Documentation] Checks controller is up
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:9696
+ ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pdp/engine/controllers/usecases/drools/facts 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()['usecases']} 0
+
+MakeTopics
+ [Documentation] Creates the Policy topics
+ ${result}= Run Process ${SCR2}/make_topic.sh POLICY-PDP-PAP
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/make_topic.sh POLICY-CL-MGT
+ Should Be Equal As Integers ${result.rc} 0
+
+CreateVcpeXacmlPolicy
+ [Documentation] Create VCPE Policy for Xacml
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postyaml}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.yaml
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+CreateVcpeDroolsPolicy
+ [Documentation] Create VCPE Policy for Drools
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postyaml}= Get file ${DATA}/vCPE.policy.operational.input.tosca.yaml
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+CreateVdnsXacmlPolicy
+ [Documentation] Create VDNS Policy for Xacml
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postyaml}= Get file ${DATA}/vDNS.policy.monitoring.input.tosca.yaml
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+CreateVdnsDroolsPolicy
+ [Documentation] Create VDNS Policy for Drools
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${DATA}/vDNS.policy.operational.input.tosca.json
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+CreateVfwXacmlPolicy
+ [Documentation] Create VFW Policy for Xacml
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postyaml}= Get file ${DATA}/vFirewall.policy.monitoring.input.tosca.yaml
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postyaml} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+CreateVfwDroolsPolicy
+ [Documentation] Create VFW Policy for Drools
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${DATA}/vFirewall.policy.operational.input.tosca.json
+ Log Creating session https://${API_IP}:6969
+ ${session}= Create Session policy https://${API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/api/v1/policies data=${postjson} headers=${headers}
+ Log Received response from api ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+DeployXacmlPolicies
+ [Documentation] Deploys the Policies to Xacml
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${PAP_IP}:6969
+ ${postjson}= Get file ${SCR2}/deploy.xacml.policies.json
+ ${session}= Create Session policy https://${PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers}
+ Log Received response from pap ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 202
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP
+ ... responseTo xacml ACTIVE restart
+ Log Received status ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} onap.restart.tca
+ Should Contain ${result.stdout} onap.scaleout.tca
+ Should Contain ${result.stdout} onap.vfirewall.tca
+
+DeployDroolsPolicies
+ [Documentation] Deploys the Policies to Drools
+ ${auth}= Create List healthcheck zb!XztG34
+ Log Creating session https://${PAP_IP}:6969
+ ${postjson}= Get file ${SCR2}/deploy.drools.policies.json
+ ${session}= Create Session policy https://${PAP_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/pap/v1/pdps/deployments/batch data=${postjson} headers=${headers}
+ Log Received response from pap ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 202
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP
+ ... responseTo drools ACTIVE
+ Log Received status ${result.stdout}
+ Sleep 3s
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} operational.restart
+ Should Contain ${result.stdout} operational.scaleout
+ Should Contain ${result.stdout} operational.modifyconfig
+
+VcpeExecute
+ [Documentation] Executes VCPE Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vcpeOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for APPC Restart
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for APPC Restart is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=APPC,operation=Restart
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=APPC,operation=Restart
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} APPC
+ Should Contain ${result.stdout} Restart
+
+VdnsExecute
+ [Documentation] Executes VDNS Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vdnsOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for SO VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for SO VF Module Create is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=SO,operation=VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=SO,operation=VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} SO
+ Should Contain ${result.stdout} VF Module Create
+
+VfwExecute
+ [Documentation] Executes VFW Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vfwOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for APPC ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for APPC ModifyConfig is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} APPC
+ Should Contain ${result.stdout} ModifyConfig