aboutsummaryrefslogtreecommitdiffstats
path: root/csit
diff options
context:
space:
mode:
Diffstat (limited to 'csit')
-rwxr-xr-x[-rw-r--r--]csit/resources/scripts/get-cluster-info.sh0
-rwxr-xr-xcsit/resources/scripts/prepare-robot-env.sh2
-rwxr-xr-xcsit/resources/scripts/run-test.sh29
-rwxr-xr-xcsit/resources/scripts/setup-drools-applications.sh3
-rwxr-xr-xcsit/resources/scripts/setup-xacml-pdp.sh4
-rw-r--r--csit/resources/tests/apex-pdp-test.robot21
-rw-r--r--csit/resources/tests/common-library.robot21
-rwxr-xr-xcsit/resources/tests/data/make_topic.sh34
-rwxr-xr-xcsit/resources/tests/data/onset.sh33
-rwxr-xr-xcsit/resources/tests/data/wait_topic.sh62
-rw-r--r--csit/resources/tests/distribution-test.robot8
-rw-r--r--csit/resources/tests/drools-applications-test.robot221
-rw-r--r--csit/resources/tests/pap-test.robot4
-rw-r--r--csit/resources/tests/xacml-pdp-test.robot16
-rwxr-xr-xcsit/run-k8s-csit.sh53
15 files changed, 184 insertions, 327 deletions
diff --git a/csit/resources/scripts/get-cluster-info.sh b/csit/resources/scripts/get-cluster-info.sh
index efe0f517..efe0f517 100644..100755
--- a/csit/resources/scripts/get-cluster-info.sh
+++ b/csit/resources/scripts/get-cluster-info.sh
diff --git a/csit/resources/scripts/prepare-robot-env.sh b/csit/resources/scripts/prepare-robot-env.sh
index aeab5cd0..fe8dbd94 100755
--- a/csit/resources/scripts/prepare-robot-env.sh
+++ b/csit/resources/scripts/prepare-robot-env.sh
@@ -42,7 +42,7 @@ python3 -m pip -qq freeze
# install eteutils
mkdir -p "${ROBOT_VENV}"/src/onap
rm -rf "${ROBOT_VENV}"/src/onap/testsuite
-python3 -m pip install -qq --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre
+python3 -m pip install -qq --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.6.0.*' --pre
echo "Uninstall docker-py and reinstall docker."
python3 -m pip uninstall -y -qq docker-py
diff --git a/csit/resources/scripts/run-test.sh b/csit/resources/scripts/run-test.sh
index 977bef75..b8b6857a 100755
--- a/csit/resources/scripts/run-test.sh
+++ b/csit/resources/scripts/run-test.sh
@@ -22,20 +22,25 @@
ROBOT_FILE=$1
echo "Invoking the robot tests from: $1"
-export DEFAULT_PORT=6969
-export DATA=/opt/robotworkspace/models/models-examples/src/main/resources/policies
-export NODETEMPLATES=/opt/robotworkspace/models/models-examples/src/main/resources/nodetemplates
-export POLICY_RUNTIME_ACM_IP=policy-clamp-runtime-acm:${DEFAULT_PORT}
-export POLICY_API_IP=policy-api:${DEFAULT_PORT}
-export POLICY_PAP_IP=policy-pap:${DEFAULT_PORT}
-export APEX_IP=policy-apex-pdp:${DEFAULT_PORT}
-export DMAAP_IP=message-router:3904
-export SIMULATOR_IP=message-router
-export PROMETHEUS_IP=prometheus:9090
+DEFAULT_PORT=6969
+DATA=/opt/robotworkspace/models/models-examples/src/main/resources/policies
+NODETEMPLATES=/opt/robotworkspace/models/models-examples/src/main/resources/nodetemplates
+
+POLICY_RUNTIME_ACM_IP=policy-clamp-runtime-acm:${DEFAULT_PORT}
+POLICY_API_IP=policy-api:${DEFAULT_PORT}
+POLICY_PAP_IP=policy-pap:${DEFAULT_PORT}
+APEX_IP=policy-apex-pdp:${DEFAULT_PORT}
+POLICY_PDPX_IP=policy-xacml-pdp:${DEFAULT_PORT}
+
+DMAAP_IP=message-router:3904
+APEX_EVENTS_IP=policy-apex-pdp:23324
+PROMETHEUS_IP=prometheus:9090
export ROBOT_VARIABLES=
-ROBOT_VARIABLES="-v DATA:$DATA -v NODETEMPLATES:$NODETEMPLATES -v POLICY_RUNTIME_ACM_IP:$POLICY_RUNTIME_ACM_IP -v POLICY_API_IP:$POLICY_API_IP
--v POLICY_PAP_IP:$POLICY_PAP_IP -v APEX_IP:$APEX_IP -v DMAAP_IP:$DMAAP_IP -v SIMULATOR_IP:$SIMULATOR_IP -v PROMETHEUS_IP:${PROMETHEUS_IP}"
+ROBOT_VARIABLES="-v DATA:$DATA -v NODETEMPLATES:$NODETEMPLATES -v POLICY_API_IP:$POLICY_API_IP
+-v POLICY_RUNTIME_ACM_IP:$POLICY_RUNTIME_ACM_IP -v POLICY_PAP_IP:$POLICY_PAP_IP -v APEX_IP:$APEX_IP
+-v APEX_EVENTS_IP:$APEX_EVENTS_IP -v DMAAP_IP:$DMAAP_IP -v PROMETHEUS_IP:${PROMETHEUS_IP}
+-v POLICY_PDPX_IP:$POLICY_PDPX_IP"
echo "Run Robot test"
echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
diff --git a/csit/resources/scripts/setup-drools-applications.sh b/csit/resources/scripts/setup-drools-applications.sh
index 189fa6c9..6e699776 100755
--- a/csit/resources/scripts/setup-drools-applications.sh
+++ b/csit/resources/scripts/setup-drools-applications.sh
@@ -25,7 +25,6 @@ source "${WORKSPACE}"/compose/start-compose.sh drools-apps
sleep 10
unset http_proxy https_proxy
-export DMAAP_IP="localhost:${DMAAP_PORT}"
export SUITES="drools-applications-test.robot"
# wait for the app to start up
@@ -36,4 +35,4 @@ sleep 15
ROBOT_VARIABLES="-v DATA:${DATA} -v DROOLS_IP:localhost:${DROOLS_APPS_PORT}
-v DROOLS_IP_2:localhost:${DROOLS_APPS_TELEMETRY_PORT} -v POLICY_API_IP:localhost:${API_PORT}
--v POLICY_PAP_IP:localhost:${PAP_PORT}"
+-v POLICY_PAP_IP:localhost:${PAP_PORT} -v DMAAP_IP:localhost:${DMAAP_PORT}"
diff --git a/csit/resources/scripts/setup-xacml-pdp.sh b/csit/resources/scripts/setup-xacml-pdp.sh
index 53c44cbd..251cb29c 100755
--- a/csit/resources/scripts/setup-xacml-pdp.sh
+++ b/csit/resources/scripts/setup-xacml-pdp.sh
@@ -25,11 +25,11 @@ source "${WORKSPACE}"/compose/start-compose.sh xacml-pdp
sleep 10
unset http_proxy https_proxy
-export DMAAP_IP="localhost:${DMAAP_PORT}"
export SUITES="xacml-pdp-test.robot"
# wait for the app to start up
"${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}"
ROBOT_VARIABLES="-v DATA:${DATA} -v POLICY_PDPX_IP:localhost:${XACML_PORT}
--v POLICY_API_IP:localhost:${API_PORT} -v POLICY_PAP_IP:localhost:${PAP_PORT}"
+-v POLICY_API_IP:localhost:${API_PORT} -v POLICY_PAP_IP:localhost:${PAP_PORT}
+-v DMAAP_IP:localhost:${DMAAP_PORT}"
diff --git a/csit/resources/tests/apex-pdp-test.robot b/csit/resources/tests/apex-pdp-test.robot
index 28a57065..57fc93b3 100644
--- a/csit/resources/tests/apex-pdp-test.robot
+++ b/csit/resources/tests/apex-pdp-test.robot
@@ -11,14 +11,14 @@ Resource ${CURDIR}/common-library.robot
Healthcheck
[Documentation] Runs Apex PDP Health check
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth}
Should Be Equal As Strings ${resp.json()['code']} 200
Set Suite Variable ${pdpName} ${resp.json()['name']}
ExecuteApexSampleDomainPolicy
+ # [Tags] docker
Set Test Variable ${policyName} onap.policies.native.apex.Sampledomain
- Log ${policyName}
${postjson}= Get File ${CURDIR}/data/${policyName}.json
CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0
Wait Until Keyword Succeeds 3 min 5 sec VerifyPdpStatistics 0 0 0 0
@@ -34,8 +34,7 @@ ExecuteApexTestPnfPolicy
CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0
DeployPolicy
Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
- ${result}= Run Process ${CURDIR}/data/make_topic.sh APEX-CL-MGT
- Should Be Equal As Integers ${result.rc} 0
+ GetTopic APEX-CL-MGT
Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy
ExecuteApexTestVnfPolicy
@@ -44,8 +43,7 @@ ExecuteApexTestVnfPolicy
CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} ${policyName} 1.0.0
DeployPolicy
Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
- ${result}= Run Process ${CURDIR}/data/make_topic.sh APEX-CL-MGT
- Should Be Equal As Integers ${result.rc} 0
+ GetTopic APEX-CL-MGT
Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestVnfPolicy
ExecuteApexTestPnfPolicyWithMetadataSet
@@ -56,13 +54,12 @@ ExecuteApexTestPnfPolicyWithMetadataSet
CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 1
DeployPolicy
Wait Until Keyword Succeeds 2 min 5 sec QueryPolicyStatus ${policyName} defaultGroup apex ${pdpName} onap.policies.native.Apex
- ${result}= Run Process ${CURDIR}/data/make_topic.sh APEX-CL-MGT2
- Should Be Equal As Integers ${result.rc} 0
+ GetTopic APEX-CL-MGT2
Wait Until Keyword Succeeds 2 min 5 sec TriggerAndVerifyTestPnfPolicy
Metrics
[Documentation] Verify policy-apex-pdp is exporting prometheus metrics
- ${auth}= HealthCheckAuth
+ ${auth}= PolicyAdminAuth
${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null ${auth}
Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="TOTAL",} 4.0
Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="SUCCESS",} 4.0
@@ -125,10 +122,8 @@ TriggerAndVerifyTestVnfPolicy
CheckLogMessage
[Documentation] Read log messages received and check for expected content.
[Arguments] ${status} ${expectedMsg}
- ${result}= Run Process ${CURDIR}/data/wait_topic.sh APEX-CL-MGT ${status}
- Log Received log event on APEX-CL-MGT topic ${result.stdout}
- Should Be Equal As Integers ${result.rc} 0
- Should Contain ${result.stdout} ${expectedMsg}
+ ${result}= CheckTopic APEX-CL-MGT ${status}
+ Should Contain ${result} ${expectedMsg}
VerifyPdpStatistics
[Documentation] Verify pdp statistics after policy execution
diff --git a/csit/resources/tests/common-library.robot b/csit/resources/tests/common-library.robot
index fb6f52f0..c43b5dca 100644
--- a/csit/resources/tests/common-library.robot
+++ b/csit/resources/tests/common-library.robot
@@ -10,10 +10,6 @@ PolicyAdminAuth
${policyadmin}= Create list policyadmin zb!XztG34
[return] ${policyadmin}
-HealthCheckAuth
- ${healthcheck}= Create list policyadmin zb!XztG34
- [return] ${healthcheck}
-
PerformPostRequest
[Arguments] ${domain} ${url} ${expectedstatus} ${postjson} ${params} ${auth}
Log Creating session http://${domain}
@@ -135,3 +131,20 @@ ValidateResponseTime
${rawNumber}= Evaluate ${resp['data']['result'][0]['value'][1]}
${actualTime}= Set Variable ${rawNumber * ${1000}}
Should Be True ${actualTime} <= ${timeLimit}
+
+GetTopic
+ [Arguments] ${topic}
+ Create Session session http://${DMAAP_IP} max_retries=1
+ ${params}= Create Dictionary limit 1 timeout 0
+ ${resp}= GET On Session session /events/${topic}/script/1 ${params}
+ Status Should Be OK ${resp}
+
+CheckTopic
+ [Arguments] ${topic} ${expected_status}
+ Create Session session http://${DMAAP_IP} max_retries=1
+ ${params}= Create Dictionary limit 1
+ ${resp}= GET On Session session /events/${topic}/script/1 ${params}
+ Log Received response from dmaap ${resp.text}
+ Status Should Be OK ${resp}
+ Should Contain ${resp.text} ${expected_status}
+ [Return] ${resp.text}
diff --git a/csit/resources/tests/data/make_topic.sh b/csit/resources/tests/data/make_topic.sh
deleted file mode 100755
index c8af564e..00000000
--- a/csit/resources/tests/data/make_topic.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-#
-# ===========LICENSE_START====================================================
-# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2022-2023 Nordix Foundation.
-# ============================================================================
-# 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=====================================================
-#
-
-#
-# Creates a topic, which happens as a side-effect of polling it.
-#
-
-if [ $# -ne 1 ]
-then
- echo "arg(s): topic-name" >&2
- exit 1
-fi
-
-topic="${1}"
-
-curl -s -k "http://${DMAAP_IP}/events/${topic}/script/1?limit=1&timeout=0"
-echo
diff --git a/csit/resources/tests/data/onset.sh b/csit/resources/tests/data/onset.sh
deleted file mode 100755
index 42b0cdec..00000000
--- a/csit/resources/tests/data/onset.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-#
-# ===========LICENSE_START====================================================
-# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2022-2023 Nordix Foundation.
-# ============================================================================
-# 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=====================================================
-#
-
-#
-# Injects an ONSET event on the DCAE_CL_OUTPUT topic.
-#
-
-if [ $# -ne 1 ]
-then
- echo "arg(s): json-message-file-name" >&2
- exit 1
-fi
-
-curl -k -H "Content-type: application/json" --data-binary @$1 \
- http://${DMAAP_IP}/events/unauthenticated.DCAE_CL_OUTPUT
-echo
diff --git a/csit/resources/tests/data/wait_topic.sh b/csit/resources/tests/data/wait_topic.sh
deleted file mode 100755
index a632ee83..00000000
--- a/csit/resources/tests/data/wait_topic.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-#
-# ===========LICENSE_START====================================================
-# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2022-2023 Nordix Foundation.
-# ============================================================================
-# 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=====================================================
-#
-
-#
-# Polls a topic for a message. Additional text items can be specified,
-# in which case, it discards messages that do not contain all of the
-# specified text items.
-#
-# Exits with a non-zero status if no matching message is received on the
-# topic before the timeout.
-#
-
-if [ $# -lt 1 ]
-then
- echo "arg(s): topic-name [text-to-match1 [text-to-match2 ...]]" >&2
- exit 1
-fi
-
-topic="${1}"
-shift
-
-matched=no
-
-while [ ${matched} = "no" ]
-do
- msg=`curl -s -k "http://${DMAAP_IP}/events/${topic}/script/1?limit=1"`
- if [ $? -ne 0 -o "${msg}" = "[]" ]
- then
- echo not found >&2
- exit 2
- fi
-
- matched=yes
- for text in "$@"
- do
- echo "${msg}" | grep -q "${text}"
- if [ $? -ne 0 ]
- then
- matched=no
- break
- fi
- done
-done
-
-echo "${msg}"
diff --git a/csit/resources/tests/distribution-test.robot b/csit/resources/tests/distribution-test.robot
index b79b362b..63d7e8be 100644
--- a/csit/resources/tests/distribution-test.robot
+++ b/csit/resources/tests/distribution-test.robot
@@ -9,19 +9,19 @@ Resource ${CURDIR}/common-library.robot
Healthcheck
[Documentation] Verify policy distribution health check
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${DISTRIBUTION_IP} /healthcheck 200 null ${hcauth}
Should Be Equal As Strings ${resp.json()['code']} 200
Statistics
[Documentation] Verify policy distribution statistics
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${DISTRIBUTION_IP} /statistics 200 null ${hcauth}
Should Be Equal As Strings ${resp.json()['code']} 200
Metrics
[Documentation] Verify policy-distribution is exporting prometheus metrics
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${DISTRIBUTION_IP} /metrics 200 null ${hcauth}
Should Contain ${resp.text} total_distribution_received_count_total 0.0
Should Contain ${resp.text} distribution_success_count_total 0.0
@@ -35,7 +35,7 @@ InvokeDistributionAndRunEventOnEngine
MetricsAfterExecution
[Documentation] Verify policy-distribution is exporting prometheus metrics after execution
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${DISTRIBUTION_IP} /metrics 200 null ${hcauth}
Should Contain ${resp.text} total_distribution_received_count_total 1.0
Should Contain ${resp.text} distribution_success_count_total 1.0
diff --git a/csit/resources/tests/drools-applications-test.robot b/csit/resources/tests/drools-applications-test.robot
index 9c25d622..6d08c963 100644
--- a/csit/resources/tests/drools-applications-test.robot
+++ b/csit/resources/tests/drools-applications-test.robot
@@ -5,6 +5,7 @@ Library RequestsLibrary
Library OperatingSystem
Library Process
Library json
+Resource common-library.robot
*** Test Cases ***
Alive
@@ -28,10 +29,8 @@ Controller
MakeTopics
[Documentation] Creates the Policy topics
- ${result}= Run Process ${CURDIR}/data/make_topic.sh POLICY-PDP-PAP
- Should Be Equal As Integers ${result.rc} 0
- ${result}= Run Process ${CURDIR}/data/make_topic.sh POLICY-CL-MGT
- Should Be Equal As Integers ${result.rc} 0
+ GetTopic POLICY-PDP-PAP
+ GetTopic POLICY-CL-MGT
CreateVcpeXacmlPolicy
[Documentation] Create VCPE Policy for Xacml
@@ -60,149 +59,93 @@ CreateVfwDroolsPolicy
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
- ${result}= Run Process ${CURDIR}/data/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
+ ${result}= CheckTopic POLICY-PDP-PAP PDP_UPDATE
+ Sleep 5s
+ ${result}= CheckTopic POLICY-PDP-PAP ACTIVE
+ Should Contain ${result} responseTo
+ Should Contain ${result} xacml
+ Should Contain ${result} restart
+ Should Contain ${result} onap.restart.tca
+ Should Contain ${result} onap.scaleout.tca
+ Should Contain ${result} onap.vfirewall.tca
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
- ${result}= Run Process ${CURDIR}/data/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
+ ${result}= CheckTopic POLICY-PDP-PAP PDP_UPDATE
+ Sleep 5s
+ ${result}= CheckTopic POLICY-PDP-PAP ACTIVE
+ Should Contain ${result} responseTo
+ Should Contain ${result} drools
+ Should Contain ${result} operational.restart
+ Should Contain ${result} operational.scaleout
+ Should Contain ${result} operational.modifyconfig
VcpeExecute
[Documentation] Executes VCPE Policy
- ${result}= Run Process ${CURDIR}/data/onset.sh ${CURDIR}/data/vcpeOnset.json
- Should Be Equal As Integers ${result.rc} 0
- ${result}= Run Process ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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
+ OnSet ${CURDIR}/data/vcpeOnset.json
+ ${result}= CheckTopic POLICY-CL-MGT ACTIVE
+ Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ ${result}= CheckTopic POLICY-CL-MGT OPERATION
+ Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Should Contain ${result} Sending guard query for APPC Restart
+ ${result}= CheckTopic 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}= CheckTopic POLICY-CL-MGT OPERATION
+ Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Should Contain ${result} actor=APPC,operation=Restart
+ ${result}= CheckTopic POLICY-CL-MGT OPERATION: SUCCESS
+ Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Should Contain ${result} actor=APPC,operation=Restart
+ ${result}= CheckTopic POLICY-CL-MGT FINAL: SUCCESS
+ Should Contain ${result} ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Should Contain ${result} APPC
+ Should Contain ${result} Restart
VdnsExecute
[Documentation] Executes VDNS Policy
- ${result}= Run Process ${CURDIR}/data/onset.sh ${CURDIR}/data/vdnsOnset.json
- Should Be Equal As Integers ${result.rc} 0
- ${result}= Run Process ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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
+ OnSet ${CURDIR}/data/vdnsOnset.json
+ ${result}= CheckTopic POLICY-CL-MGT ACTIVE
+ Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ ${result}= CheckTopic 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}= CheckTopic 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}= CheckTopic POLICY-CL-MGT OPERATION
+ Should Contain ${result} ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Should Contain ${result} actor=SO,operation=VF Module Create
+ ${result}= CheckTopic 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}= CheckTopic 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
VfwExecute
[Documentation] Executes VFW Policy
- ${result}= Run Process ${CURDIR}/data/onset.sh ${CURDIR}/data/vfwOnset.json
- Should Be Equal As Integers ${result.rc} 0
- ${result}= Run Process ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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 ${CURDIR}/data/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
+ OnSet ${CURDIR}/data/vfwOnset.json
+ ${result}= CheckTopic POLICY-CL-MGT ACTIVE
+ Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ ${result}= CheckTopic POLICY-CL-MGT OPERATION
+ Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Should Contain ${result} Sending guard query for APPC ModifyConfig
+ ${result}= CheckTopic 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}= CheckTopic POLICY-CL-MGT OPERATION
+ Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Should Contain ${result} actor=APPC,operation=ModifyConfig
+ ${result}= CheckTopic POLICY-CL-MGT OPERATION: SUCCESS
+ Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Should Contain ${result} actor=APPC,operation=ModifyConfig
+ ${result}= CheckTopic POLICY-CL-MGT FINAL: SUCCESS
+ Should Contain ${result} ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Should Contain ${result} APPC
+ Should Contain ${result} ModifyConfig
*** Keywords ***
@@ -230,3 +173,13 @@ PerformPostRequest
${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus}
Log Received response from policy ${resp.text}
[return] ${resp}
+
+OnSet
+ [Arguments] ${file}
+ ${data}= Get File ${file}
+ Create Session session http://${DMAAP_IP} max_retries=1
+ ${headers}= Create Dictionary Content-Type=application/json
+ ${resp}= POST On Session session /events/unauthenticated.DCAE_CL_OUTPUT headers=${headers} data=${data}
+ Log Response from dmaap ${resp.text}
+ Status Should Be OK
+ [Return] ${resp.text}
diff --git a/csit/resources/tests/pap-test.robot b/csit/resources/tests/pap-test.robot
index ccc16a4d..8a5fbb5f 100644
--- a/csit/resources/tests/pap-test.robot
+++ b/csit/resources/tests/pap-test.robot
@@ -54,11 +54,11 @@ Metrics
[Documentation] Verify policy pap is exporting prometheus metrics
${auth}= PolicyAdminAuth
${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/
- Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0
+ Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",}
Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0
Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0
Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findByKeyName",repository="PdpGroupRepository",state="SUCCESS",} 1.0
- Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",} 1.0
+ Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="findAll",repository="PolicyStatusRepository",state="SUCCESS",}
Statistics
[Documentation] Verify policy pap statistics
diff --git a/csit/resources/tests/xacml-pdp-test.robot b/csit/resources/tests/xacml-pdp-test.robot
index 1ba01531..f90d0c21 100644
--- a/csit/resources/tests/xacml-pdp-test.robot
+++ b/csit/resources/tests/xacml-pdp-test.robot
@@ -24,8 +24,7 @@ Metrics
MakeTopics
[Documentation] Creates the Policy topics
- ${result}= Run Process ${CURDIR}/data/make_topic.sh POLICY-PDP-PAP
- Should Be Equal As Integers ${result.rc} 0
+ GetTopic POLICY-PDP-PAP
ExecuteXacmlPolicy
CreateMonitorPolicy
@@ -65,9 +64,12 @@ DeployPolicies
${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json
${policyadmin}= PolicyAdminAuth
PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin}
- ${result}= Run Process ${CURDIR}/data/wait_topic.sh POLICY-PDP-PAP
- ... responseTo xacml ACTIVE onap.restart.tca
- Should Be Equal As Integers ${result.rc} 0
+ ${result}= CheckTopic POLICY-PDP-PAP PDP_UPDATE
+ Sleep 5s
+ ${result}= CheckTopic POLICY-PDP-PAP ACTIVE
+ Should Contain ${result} responseTo
+ Should Contain ${result} xacml
+ Should Contain ${result} onap.restart.tca
GetStatisticsAfterDeployed
[Documentation] Verify policy xacml-pdp statistics after policy is deployed
@@ -139,12 +141,12 @@ GetStatisticsAfterUndeploy
PdpxGetReq
[Arguments] ${url}
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformGetRequest ${POLICY_PDPX_IP} ${url} 200 null ${hcauth}
[return] ${resp}
DecisionPostReq
[Arguments] ${postjson} ${abbr}
- ${hcauth}= HealthCheckAuth
+ ${hcauth}= PolicyAdminAuth
${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth}
[return] ${resp}
diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh
index 082ab036..d84f7318 100755
--- a/csit/run-k8s-csit.sh
+++ b/csit/run-k8s-csit.sh
@@ -21,7 +21,12 @@
# This script spins up kubernetes cluster in Microk8s for deploying policy helm charts.
# Runs CSITs in kubernetes.
-CSIT_SCRIPT="run-test.sh"
+if [ -z "${WORKSPACE}" ]; then
+ WORKSPACE=$(git rev-parse --show-toplevel)
+ export WORKSPACE
+fi
+
+CSIT_SCRIPT="scripts/run-test.sh"
ROBOT_DOCKER_IMAGE="policy-csit-robot"
POLICY_CLAMP_ROBOT="policy-clamp-test.robot"
POLICY_API_ROBOT="api-test.robot"
@@ -38,7 +43,7 @@ POLICY_XACML_CONTAINER="policy-xacml-pdp"
export PROJECT=""
export ROBOT_FILE=""
-export ROBOT_LOG_DIR=${PWD}/archives
+export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives
export READINESS_CONTAINERS=()
function spin_microk8s_cluster () {
@@ -82,13 +87,16 @@ function teardown_cluster () {
function build_robot_image () {
echo "Build docker image for robot framework"
- cd ../helm;
+ cd ${WORKSPACE}/csit/resources || exit;
clone_models
echo "Build robot framework docker image"
docker login -u docker -p docker nexus3.onap.org:10001
- docker build . --file Dockerfile --build-arg CSIT_SCRIPT="$CSIT_SCRIPT" --build-arg ROBOT_FILE="$ROBOT_FILE" --tag "${ROBOT_DOCKER_IMAGE}" --no-cache
+ docker build . --file Dockerfile \
+ --build-arg CSIT_SCRIPT="$CSIT_SCRIPT" \
+ --build-arg ROBOT_FILE="$ROBOT_FILE" \
+ --tag "${ROBOT_DOCKER_IMAGE}" --no-cache
echo "---------------------------------------------"
- echo "Importing robot image in to microk8s registry"
+ echo "Importing robot image into microk8s registry"
docker save -o policy-csit-robot.tar ${ROBOT_DOCKER_IMAGE}:latest
microk8s ctr image import policy-csit-robot.tar
if [ "${?}" -eq 0 ]; then
@@ -96,27 +104,35 @@ function build_robot_image () {
rm -rf tests/models/
echo "---------------------------------------------"
echo "Installing Robot framework pod for running CSIT"
- microk8s helm install csit-robot robot --set robot=$ROBOT_FILE --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR;
+ cd ${WORKSPACE}/helm
+ mkdir -p ${ROBOT_LOG_DIR}
+ microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR;
print_robot_log
fi
}
+
function print_robot_log () {
+ count_pods=0
+ while [[ ${count_pods} -eq 0 ]]; do
+ echo "Waiting for pods to come up..."
+ sleep 5
+ count_pods=$(microk8s kubectl get pods --output name | wc -l)
+ done
robotpod=$(microk8s kubectl get po | grep policy-csit)
- podName=$(echo $robotpod | awk '{print $1}')
+ podName=$(echo "$robotpod" | awk '{print $1}')
echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..."
- microk8s kubectl wait --for=condition=ready --timeout=180s pod/$podName
- microk8s kubectl logs -f $podName
+ microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=700s pod/"$podName"
+ microk8s kubectl logs -f "$podName"
echo "Please check the logs of policy-csit-robot pod for the test execution results"
}
+
function clone_models () {
- GIT_TOP=$(git rev-parse --show-toplevel)
- GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
- "${GIT_TOP}"/.gitreview)
+ GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' "${WORKSPACE}"/.gitreview)
echo GERRIT_BRANCH="${GERRIT_BRANCH}"
# download models examples
- git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git tests/models
+ git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-models.git "${WORKSPACE}"/csit/resources/tests/models
# create a couple of variations of the policy definitions
sed -e 's!Measurement_vGMUX!ADifferentValue!' \
@@ -145,7 +161,7 @@ function get_robot_file () {
pap | policy-pap)
export ROBOT_FILE=$POLICY_PAP_ROBOT
- export READINESS_CONTAINERS=($POLICY_PAP_CONTAINER,$POLICY_API_CONTAINER)
+ export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_API_CONTAINER)
;;
apex-pdp | policy-apex-pdp)
@@ -155,7 +171,7 @@ function get_robot_file () {
xacml-pdp | policy-xacml-pdp)
export ROBOT_FILE=($POLICY_XACML_PDP_ROBOT)
- export READINESS_CONTAINERS=($POLICY_XACML_CONTAINER)
+ export READINESS_CONTAINERS=($POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER,$POLICY_XACML_CONTAINER)
;;
drools-pdp | policy-drools-pdp)
@@ -175,13 +191,16 @@ if [ $1 == "install" ]; then
spin_microk8s_cluster
if [ "${?}" -eq 0 ]; then
echo "Installing policy helm charts in the default namespace"
- cd ../helm/;microk8s helm dependency build policy;microk8s helm install csit-policy policy;
+ cd ${WORKSPACE}/helm || exit;
+ microk8s helm dependency build policy
+ microk8s helm install csit-policy policy
echo "Policy chart installation completed"
- echo "-------------------------------------------"
+ echo "-------------------------------------------"
fi
if [ "$2" ]; then
export PROJECT=$2
+ export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT}
get_robot_file
echo "CSIT will be invoked from $ROBOT_FILE"
echo "Readiness containers: ${READINESS_CONTAINERS[*]}"