diff options
Diffstat (limited to 'test/csit')
13 files changed, 503 insertions, 236 deletions
diff --git a/test/csit/plans/aaf/aafapi/setup.sh b/test/csit/plans/aaf/aafapi/setup.sh new file mode 100644 index 000000000..bfaff925c --- /dev/null +++ b/test/csit/plans/aaf/aafapi/setup.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# ONAP AAF +# ================================================================================ +# Copyright (C) 2017 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============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +# Clone AAF Authz repo +mkdir -p $WORKSPACE/archives/aafcsit +cd $WORKSPACE/archives/aafcsit +#unset http_proxy https_proxy +git clone --depth 1 http://gerrit.onap.org/r/aaf/authz -b master +git pull +cd $WORKSPACE/archives/aafcsit/authz/authz-service/src/main/resources/docker-compose +pwd +chmod -R 777 $WORKSPACE/archives/aafcsit/authz/authz-service/src/main/resources/docker-compose + + +# start aaf containers with docker compose and configuration from docker-compose.yml +docker-compose up -d + +# Wait for initialization of Docker contaienr for AAF & Cassandra +for i in {1..50}; do + if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_aaf_container_1) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' dockercompose_cassandra_container_1) ] && \ + [ $(docker inspect --format '{{ .State.Running }}' dockercompose_aaf_container_1) ] + then + echo "AAF Service Running" + break + else + echo sleep $i + sleep $i + fi +done + + +AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_aaf_container_1) +CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_cassandra_container_1) + + +echo AAF_IP=${AAF_IP} +echo CASSANDRA_IP=${CASSANDRA_IP} + + +# Wait for initialization of docker services +for i in {1..50}; do + curl -sS -m 1 ${AAF_IP}:8101 && break + echo sleep $i + sleep $i +done + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}" diff --git a/test/csit/plans/aaf/aafapi/teardown.sh b/test/csit/plans/aaf/aafapi/teardown.sh new file mode 100644 index 000000000..1f7b2853d --- /dev/null +++ b/test/csit/plans/aaf/aafapi/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# + +kill-instance.sh dockercompose_aaf_container_1 +kill-instance.sh dockercompose_cassandra_container_1 + diff --git a/test/csit/plans/aaf/aafapi/testplan.txt b/test/csit/plans/aaf/aafapi/testplan.txt new file mode 100644 index 000000000..ea18ca6d8 --- /dev/null +++ b/test/csit/plans/aaf/aafapi/testplan.txt @@ -0,0 +1,2 @@ +# Place the suites in run order. +aaf/aafapi diff --git a/test/csit/plans/dcaegen2/testsuites/setup.sh b/test/csit/plans/dcaegen2/testsuites/setup.sh index 3068b5026..6692bb209 100755 --- a/test/csit/plans/dcaegen2/testsuites/setup.sh +++ b/test/csit/plans/dcaegen2/testsuites/setup.sh @@ -20,7 +20,6 @@ #get current host IP addres HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') -echo HOST_IP=${HOST_IP} VESC_IMAGE=nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.1 echo VESC_IMAGE=${VESC_IMAGE} @@ -30,9 +29,11 @@ docker run -d -p 8080:8080/tcp -p 8443:8443/tcp -P --name vesc -e DMAAPHOST=${HO VESC_IP=`get-instance-ip.sh vesc` export VESC_IP=${VESC_IP} +export HOST_IP=${HOST_IP} export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/test/csit/tests/dcaegen2/testcases/resources" +pip install jsonschema uuid # Wait container ready sleep 5 diff --git a/test/csit/plans/vfc-nfvo-resmanagement/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-resmanagement/sanity-check/setup.sh index a18562eb7..b0cec31a1 100644 --- a/test/csit/plans/vfc-nfvo-resmanagement/sanity-check/setup.sh +++ b/test/csit/plans/vfc-nfvo-resmanagement/sanity-check/setup.sh @@ -34,7 +34,7 @@ echo MSB_IP=${MSB_IP} # Start resmgr docker run -d --name vfc-resmanagement -e MSB_ADDR=${MSB_IP}:80 nexus3.onap.org:10001/onap/vfc/resmanagement RESMGR_IP=`get-instance-ip.sh vfc-resmanagement` -for i in {1..10}; do +for i in {1..20}; do curl -sS ${RESMGR_IP}:8480 && break echo sleep $i sleep $i diff --git a/test/csit/tests/aaf/aafapi/aafapi.robot b/test/csit/tests/aaf/aafapi/aafapi.robot new file mode 100644 index 000000000..b1f8e746d --- /dev/null +++ b/test/csit/tests/aaf/aafapi/aafapi.robot @@ -0,0 +1,63 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library requests +Library Collections +Library String + +*** Variables *** +${TARGETURL_NAMESPACE} http://${AAF_IP}:8101/authz/nss/org.openecomp +${TARGETURL_PERMS} http://${AAF_IP}:8101/authz/perms/user/dgl@openecomp.org +${TARGETURL_ROLES} http://${AAF_IP}:8101/authz/roles/user/dgl@openecomp.org +${username} dgl@openecomp.org +${password} ecomp_admin + + +*** Test Cases *** +View Namesapce + [Tags] get + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Get Request aaf /authz/nss/org.openecomp headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 200 + log 'JSON Response Code :'${resp.text} + +View by User Permission + [Tags] get + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Get Request aaf authz/perms/user/dgl@openecomp.org headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 200 + log 'JSON Response Code :'${resp.text} + +View by User Role + [Tags] get + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Get Request aaf authz/roles/user/dgl@openecomp.org headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 200 + log 'JSON Response Code :'${resp.text} + +Cleanup Namespace ( 424 Response - Delete dependencies and try again) + [Tags] delete + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Delete Request aaf authz/ns/org.openecomp.dmaapBC headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 424 + log 'JSON Response Code :'${resp.text} + +Add Data ( Add Admin to Namespace Explicit ) + [Tags] post + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Post Request aaf authz/ns/org.openecomp.dmaapBC/admin/alexD@openecomp.org headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 403 + log 'JSON Response Code :'${resp.text} + +View Explicit Permission + [Tags] post + CreateSession aaf http://${AAF_IP}:8101 + &{headers}= Create Dictionary Authorization=Basic ZGdsQG9wZW5lY29tcC5vcmc6ZWNvbXBfYWRtaW4= Content-Type=application/json Accept=application/json + ${resp}= Post Request aaf authz/perms/user/m99751@dmaapBC.openecomp.org headers=&{headers} + Should Be Equal As Strings ${resp.status_code} 406 + log 'JSON Response Code :'${resp.text}
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2/testcases/dcae_ves.robot b/test/csit/tests/dcaegen2/testcases/dcae_ves.robot index 00c58071b..eee6ea569 100644 --- a/test/csit/tests/dcaegen2/testcases/dcae_ves.robot +++ b/test/csit/tests/dcaegen2/testcases/dcae_ves.robot @@ -1,188 +1,199 @@ -*** Settings ***
-Documentation Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios
-
-Library RequestsLibrary
-Library OperatingSystem
-Library Collections
-Library DcaeLibrary
-Resource resources/dcae_keywords.robot
-Test Setup Cleanup VES Events
-Suite Setup VES Collector Suite Setup DMaaP
-Suite Teardown VES Collector Suite Shutdown DMaaP
-
-
-
-
-*** Variables ***
-${VESC_URL_HTTPS} https://%{VESC_IP}:8443
-${VESC_URL} http://%{VESC_IP}:8080
-${VES_ANY_EVENT_PATH} /eventListener/v5
-${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch
-${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState
-${HEADER_STRING} content-type=application/json
-${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json
-${EVENT_MEASURE_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json
-${EVENT_DATA_FILE_BAD} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json
-${EVENT_BATCH_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json
-${EVENT_THROTTLING_STATE_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json
-
-
-#DCAE Health Check
-${CONFIG_BINDING_URL} http://localhost:8443
-${CB_HEALTHCHECK_PATH} /healthcheck
-${CB_SERVICE_COMPONENT_PATH} /service_component/
-${VES_Service_Name1} dcae-controller-ves-collector
-${VES_Service_Name2} ves-collector-not-exist
-
-*** Comment out from R1 release ***
-DCAE Health Check
- [Tags] DCAE-HealthCheck
- [Documentation] Get DCAE Overall Status
- ${auth}= Create List ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
- ${session}= Create Session dcae-health-check ${CONFIG_BINDING_URL} auth=${auth}
- ${resp}= Get Request dcae-health-check ${CB_HEALTHCHECK_PATH}
- Should Be Equal As Strings ${resp.status_code} 200
-
-
-Get VES Collector Service Status
- [Tags] DCAE-HealthCheck
- [Documentation] Get the status of a VES Collector Service Component based on service name
- ${urlpath}= Catenate SEPARATOR= ${CB_SERVICE_COMPONENT_PATH} ${VES_Service_Name1}
- Log Service component name for status query: ${urlpath}
- ${resp}= Get DCAE Service Component Status ${CONFIG_BINDING_URL} ${CB_SERVICE_COMPONENT_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 200
- ${isEmpty}= Is Json Empty ${resp}
- Run Keyword If '${isEmpty}' == False Log ${resp.json()}
-
-
-
-#*** Comment out from R1 release ***
-Publish VES VoLTE Fault Provide Throttling State
- [Tags] DCAE-D1
- ${evtdata}= Get Event Data From File ${EVENT_THROTTLING_STATE_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- ${resp}= Publish Event To VES Collector ${VES_VOLTE_URL} ${VES_THROTTLE_STATE_EVENT_PATH} ${headers} ${evtdata} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
- Should Be Equal As Strings ${resp.status_code} 204
-
-Publish VES Event With Invalid Method
- [Tags] DCAE-D1
- [Documentation] Use invalid Put instead of Post method to expect 405 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid method Put instead of Post
- ${resp}= Publish Event To VES Collector With Put Method ${VES_VOLTE_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 405
-
-
-Publish VES Event With Invalid URL Path
- [Tags] DCAE-D1
- [Documentation] Use invalid url path to expect 404 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid /listener/v5/ instead of /eventlistener/v5 path
- ${resp}= Publish Event To VES Collector ${VES_VOLTE_URL} /listener/v5/ ${headers} ${evtdata} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 404
-
-Publish VES Event With Invalid Login
- [Tags] DCAE-D1
- [Documentation] Use invalid user or password to expect 401 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid User: BadUserName
- ${resp}= Publish Event To VES Collector ${VES_VOLTE_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} BadUserName ${GLOBAL_DCAE_PASSWORD}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 401
-
-*** Test Cases ***
-VES Collector Health Check
- [Tags] DCAE-VESC-R1
- [Documentation] Ves Collector Health Check
- ${uuid}= Generate UUID
- ${session}= Create Session dcae ${VESC_URL}
- ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
- ${resp}= Get Request dcae /healthcheck headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 200
-
-
-Publish Single VES VoLTE Fault Event
- [Tags] DCAE-VESC-R1
- [Documentation] Post single event and expect 200 Response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 200
- ${isEmpty}= Is Json Empty ${resp}
- Run Keyword If '${isEmpty}' == False Log ${resp.json()}
- ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015
- Should Be Equal As Strings ${ret} true
-
-Publish Single VES VNF Measurement Event
- [Tags] DCAE-VESC-R1
- [Documentation] Post single event and expect 200 Response
- ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 200
- ${isEmpty}= Is Json Empty ${resp}
- Run Keyword If '${isEmpty}' == False Log ${resp.json()}
- ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6
- Should Be Equal As Strings ${ret} true
-
-Publish VES VoLTE Fault Batch Events
- [Tags] DCAE-VESC-R1
- [Documentation] Post batched events and expect 202 Response
- ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata}
- Should Be Equal As Strings ${resp.status_code} 200
- ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016
- Should Be Equal As Strings ${ret} true
-
-
-Publish Single VES VoLTE Fault Event With Bad Data
- [Tags] DCAE-VESC-R1
- [Documentation] Run with JSON Envent with missing comma to expect 400 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE_BAD}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid Json Event Data
- ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 400
- ${isEmpty}= Is Json Empty ${resp}
- Run Keyword If '${isEmpty}' == False Log ${resp.json()}
-
-Publish VES Event With Invalid Method
- [Tags] DCAE-VESC-R1
- [Documentation] Use invalid Put instead of Post method to expect 405 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid method Put instead of Post
- ${resp}= Publish Event To VES Collector With Put Method No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 404
-
-
-Publish VES Event With Invalid URL Path
- [Tags] DCAE-VESC-R1
- [Documentation] Use invalid url path to expect 404 response
- ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE}
- ${headers}= Create Header From String ${HEADER_STRING}
- Log Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path
- ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} /listener/v5/ ${headers} ${evtdata}
- Log Receive HTTP Status code ${resp.status_code}
- Should Be Equal As Strings ${resp.status_code} 404
-
-
-
-
-
-
-
-
-
-
+*** Settings *** +Documentation Testing DCAE VES Listener with various event feeds from VoLTE, vDNS, vFW and cCPE use scenarios + +Library RequestsLibrary +Library OperatingSystem +Library Collections +Library DcaeLibrary +Resource resources/dcae_keywords.robot +Test Setup Cleanup VES Events +Suite Setup VES Collector Suite Setup DMaaP +Suite Teardown VES Collector Suite Shutdown DMaaP + + + + +*** Variables *** +${VESC_URL_HTTPS} https://%{VESC_IP}:8443 +${VESC_URL} http://%{VESC_IP}:8080 +${VES_ANY_EVENT_PATH} /eventListener/v5 +${VES_BATCH_EVENT_PATH} /eventListener/v5/eventBatch +${VES_THROTTLE_STATE_EVENT_PATH} /eventListener/v5/clientThrottlingState +${HEADER_STRING} content-type=application/json +${EVENT_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event.json +${EVENT_MEASURE_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_vfirewall_measurement.json +${EVENT_DATA_FILE_BAD} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_single_fault_event_bad.json +${EVENT_BATCH_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_eventlist_batch.json +${EVENT_THROTTLING_STATE_DATA_FILE} %{WORKSPACE}/test/csit/tests/dcaegen2/testcases/assets/json_events/ves_volte_fault_provide_throttle_state.json + + +#DCAE Health Check +${CONFIG_BINDING_URL} http://localhost:8443 +${CB_HEALTHCHECK_PATH} /healthcheck +${CB_SERVICE_COMPONENT_PATH} /service_component/ +${VES_Service_Name1} dcae-controller-ves-collector +${VES_Service_Name2} ves-collector-not-exist + + +*** Test Cases *** + +VES Collector Health Check + [Tags] DCAE-VESC-R1 + [Documentation] Ves Collector Health Check + ${uuid}= Generate UUID + ${session}= Create Session dcae ${VESC_URL} + ${headers}= Create Dictionary Accept=*/* X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Get Request dcae /healthcheck headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + + +Publish Single VES VoLTE Fault Event + [Tags] DCAE-VESC-R1 + [Documentation] Post single event and expect 200 Response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 200 + ${isEmpty}= Is Json Empty ${resp} + Run Keyword If '${isEmpty}' == False Log ${resp.json()} + ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015 + Should Be Equal As Strings ${ret} true + +Publish Single VES VNF Measurement Event + [Tags] DCAE-VESC-R1 + [Documentation] Post single event and expect 200 Response + ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 200 + ${isEmpty}= Is Json Empty ${resp} + Run Keyword If '${isEmpty}' == False Log ${resp.json()} + ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6 + Should Be Equal As Strings ${ret} true + +Publish VES VoLTE Fault Batch Events + [Tags] DCAE-VESC-R1 + [Documentation] Post batched events and expect 202 Response + ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata} + Should Be Equal As Strings ${resp.status_code} 200 + ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016 + Should Be Equal As Strings ${ret} true + + +Publish Single VES VoLTE Fault Event With Bad Data + [Tags] DCAE-VESC-R1 + [Documentation] Run with JSON Envent with missing comma to expect 400 response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE_BAD} + ${headers}= Create Header From String ${HEADER_STRING} + Log Send HTTP Request with invalid Json Event Data + ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 400 + ${isEmpty}= Is Json Empty ${resp} + Run Keyword If '${isEmpty}' == False Log ${resp.json()} + +Publish VES Event With Invalid Method + [Tags] DCAE-VESC-R1 + [Documentation] Use invalid Put instead of Post method to expect 405 response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + Log Send HTTP Request with invalid method Put instead of Post + ${resp}= Publish Event To VES Collector With Put Method No Auth ${VESC_URL} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 404 + + +Publish VES Event With Invalid URL Path + [Tags] DCAE-VESC-R1 + [Documentation] Use invalid url path to expect 404 response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + Log Send HTTP Request with invalid /listener/v5/ instead of /eventListener/v5 path + ${resp}= Publish Event To VES Collector No Auth ${VESC_URL} /listener/v5/ ${headers} ${evtdata} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 404 + + +Enable VESC HTTPS And Basic Auth + [Tags] DCAE-VESC-R1 + [Documentation] Enable VESC Https and Authentication, Disable Http and Run Health Check + Enable VESC Https Auth + + ${auth}= Create List ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + ${session}= Create Session dcaegen2-r1 ${VESC_URL_HTTPS} auth=${auth} disable_warnings=1 + ${headers}= Create Dictionary Accept=*/* X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Get Request dcaegen2-r1 /healthcheck headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + +Publish Single VES Fault Event Over HTTPS + [Tags] DCAE-VESC-R1 + [Documentation] Post single event and expect 200 Response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + Log Login User=${VESC_HTTPS_USER}, Pd=${VESC_HTTPS_PD} + ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} sample1 sample1 + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 200 + ${isEmpty}= Is Json Empty ${resp} + Run Keyword If '${isEmpty}' == False Log ${resp.json()} + ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546015 + Should Be Equal As Strings ${ret} true + + +Publish Single VES Measurement Event Over HTTPS + [Tags] DCAE-VESC-R1 + [Documentation] Post single event and expect 200 Response + ${evtdata}= Get Event Data From File ${EVENT_MEASURE_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_ANY_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 200 + ${isEmpty}= Is Json Empty ${resp} + Run Keyword If '${isEmpty}' == False Log ${resp.json()} + ${ret}= DMaaP Message Receive 0b2b5790-3673-480a-a4bd-5a00b88e5af6 + Should Be Equal As Strings ${ret} true + +Publish VES Fault Batch Events Over HTTPS + [Tags] DCAE-VESC-R1 + [Documentation] Post batched events and expect 202 Response + ${evtdata}= Get Event Data From File ${EVENT_BATCH_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} ${VES_BATCH_EVENT_PATH} ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + Should Be Equal As Strings ${resp.status_code} 200 + ${ret}= DMaaP Message Receive ab305d54-85b4-a31b-7db2-fb6b9e546016 + Should Be Equal As Strings ${ret} true + + +Publish VES Event With Invalid URL Path HTTPS + [Tags] DCAE-VESC-R1 + [Documentation] Use invalid url path to expect 404 response + ${evtdata}= Get Event Data From File ${EVENT_DATA_FILE} + ${headers}= Create Header From String ${HEADER_STRING} + Log Send HTTP Request with invalid /eventlistener/v5/ instead of /eventListener/v5 path + ${resp}= Publish Event To VES Collector ${VESC_URL_HTTPS} /eventlistener/v5 ${headers} ${evtdata} ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + Log Receive HTTP Status code ${resp.status_code} + Should Be Equal As Strings ${resp.status_code} 404 + + + + + + + + + + + + + + + + + + + + diff --git a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py index 650f8fef8..0242ad7ab 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py @@ -5,14 +5,14 @@ Created on Aug 18, 2017 '''
from robot.api import logger
from Queue import Queue
-import uuid, time, datetime,json, threading
+import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko
import DcaeVariables
import DMaaP
class DcaeLibrary(object):
def __init__(self):
- pass
+ pass
def setup_dmaap_server(self, portNum=3904):
if DcaeVariables.HttpServerThread != None:
@@ -50,6 +50,28 @@ class DcaeLibrary(object): return "true"
logger.console("DMaaP server not started yet")
return "false"
+
+ def enable_vesc_https_auth(self):
+ if 'Windows' in platform.system():
+ try:
+ client = paramiko.SSHClient()
+ client.load_system_host_keys()
+ #client.set_missing_host_key_policy(paramiko.WarningPolicy)
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+
+ client.connect(os.environ['CSIT_IP'], port=22, username=os.environ['CSIT_USER'], password=os.environ['CSIT_PD'])
+ stdin, stdout, stderr = client.exec_command('%{WORKSPACE}/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh')
+ logger.console(stdout.read())
+ finally:
+ client.close()
+ return
+ ws = os.environ['WORKSPACE']
+ script2run = ws + "/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh"
+ logger.info("Running script: " + script2run)
+ logger.console("Running script: " + script2run)
+ subprocess.call(script2run)
+ time.sleep(5)
+ return
def dmaap_message_receive(self, evtobj, action='contain'):
@@ -129,7 +151,9 @@ if __name__ == '__main__': '''
lib = DcaeLibrary()
+ lib.enable_vesc_https_auth()
+
ret = lib.setup_dmaap_server()
print ret
- time.sleep(10000000000)
-
\ No newline at end of file + time.sleep(100000)
+
diff --git a/test/csit/tests/dcaegen2/testcases/resources/collector.properties b/test/csit/tests/dcaegen2/testcases/resources/collector.properties new file mode 100755 index 000000000..1c5c8411e --- /dev/null +++ b/test/csit/tests/dcaegen2/testcases/resources/collector.properties @@ -0,0 +1,74 @@ +############################################################################### +## +## Collector Server config +## +## - Default values are shown as commented settings. +## +############################################################################### +## +## HTTP(S) service +## +## Normally: +## +## - 8080 is http service +## - https is disabled by default (-1) +## +## - At this time, the server always binds to 0.0.0.0 +## +## The default port when header.authflag is disabled (0) +#collector.service.port=8080 + +## The secure port is required if header.authflag is set to 1 (true) +## Authentication is only supported via secure port +## When enabled - require valid keystore defined +collector.service.secure.port=8443 + +## The keystore must be setup per installation when secure port is configured +collector.keystore.file.location=../etc/keystore +collector.keystore.passwordfile=./etc/passwordfile +collector.keystore.alias=tomcat + + +############################################################################### +## Processing +## +## If there's a problem that prevents the collector from processing alarms, +## it's normally better to apply back pressure to the caller than to try to +## buffer beyond a reasonable size limit. With a limit, the server won't crash +## due to being out of memory, and the caller will get a 5xx reply saying the +## server is in trouble. +collector.inputQueue.maxPending=8096 + +## Schema Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schemafile location must be specified +collector.schema.checkflag=1 +collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.3.json\"} + +## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile +collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling +collector.dmaapfile=./etc/DmaapConfig.json + +## Custom ExceptionConfiguration +exceptionConfig=./etc/ExceptionConfig.json + +## authflag control authentication by the collector +## If enabled (1) - then authlist has to be defined +## When authflag is enabled, only secure port will be supported +## To disable enter 0 +header.authflag=1 +## Combination of userid,base64 encoded pwd list to be supported +## userid and pwd comma separated; pipe delimitation between each pair +header.authlist=sample1,c2FtcGxlMQ==|vdnsagg,dmRuc2FnZw== + +## Event transformation Flag - when set expects configurable transformation +## defined under ./etc/eventTransform.json +## Enabled by default; to disable set to 0 +event.transform.flag=0 + +############################################################################### +## +## Tomcat control +## +#tomcat.maxthreads=(tomcat default, which is usually 200) + diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot index a30a1ba01..59d44e158 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -1,16 +1,13 @@ *** Settings ***
Documentation The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields
Library RequestsLibrary
-Library DcaeLibrary.py
+Library DcaeLibrary
Library OperatingSystem
Library Collections
Variables ../resources/DcaeVariables.py
Resource ../resources/dcae_properties.robot
-
-
*** Variables ***
${DCAE_HEALTH_CHECK_BODY} %{WORKSPACE}/test/csit/tests/dcae/testcases/assets/json_events/dcae_healthcheck.json
-
*** Keywords ***
Get DCAE Nodes
[Documentation] Get DCAE Nodes from Consul Catalog
@@ -26,8 +23,6 @@ Get DCAE Nodes ${len}= Get Length ${NodeList}
Should Not Be Equal As Integers ${len} 0
[return] ${NodeList}
-
-
DCAE Node Health Check
[Documentation] Perform DCAE Node Health Check
[Arguments] ${NodeName}
@@ -43,76 +38,58 @@ DCAE Node Health Check Should Not Be Equal As Integers ${len} 0
DCAE Check Health Status ${NodeName} ${StatusList[0]} Serf Health Status
#Run Keyword if ${len} > 1 DCAE Check Health Status ${NodeName} ${StatusList[1]} Serf Health Status
-
-
DCAE Check Health Status
[Arguments] ${NodeName} ${ItemStatus} ${CheckType}
Should Be Equal As Strings ${ItemStatus} passing
Log Node: ${NodeName} ${CheckType} check pass ok
-
VES Collector Suite Setup DMaaP
[Documentation] Start DMaaP Mockup Server
${ret}= Setup DMaaP Server
Should Be Equal As Strings ${ret} true
-
VES Collector Suite Shutdown DMaaP
[Documentation] Shutdown DMaaP Mockup Server
${ret}= Shutdown DMaap
Should Be Equal As Strings ${ret} true
-
-
-
-
Check DCAE Results
[Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN
[Arguments] ${json}
@{rows}= Get From Dictionary ${json['returns']} rows
@{headers}= Get From Dictionary ${json['returns']} columns
-
# Retrieve column names from headers
${columns}= Create List
:for ${header} in @{headers}
- \ ${colName}= Get From Dictionary ${header} colName
+ \ ${colName}= Get From Dictionary ${header} colName
\ Append To List ${columns} ${colName}
-
- # Process each row making sure status=GREEN
+ # Process each row making sure status=GREEN
:for ${row} in @{rows}
\ ${cells}= Get From Dictionary ${row} cells
- \ ${dict}= Make A Dictionary ${cells} ${columns}
+ \ ${dict}= Make A Dictionary ${cells} ${columns}
\ Dictionary Should Contain Item ${dict} healthTestStatus GREEN
-
-
Make A Dictionary
[Documentation] Given a list of column names and a list of dictionaries, map columname=value
[Arguments] ${columns} ${names} ${valuename}=value
${dict}= Create Dictionary
- ${collength}= Get Length ${columns}
- ${namelength}= Get Length ${names}
+ ${collength}= Get Length ${columns}
+ ${namelength}= Get Length ${names}
:for ${index} in range 0 ${collength}
\ ${name}= Evaluate ${names}[${index}]
\ ${valued}= Evaluate ${columns}[${index}]
\ ${value}= Get From Dictionary ${valued} ${valueName}
\ Set To Dictionary ${dict} ${name} ${value}
[Return] ${dict}
-
-
Get Event Data From File
[Arguments] ${jsonfile}
${data}= OperatingSystem.Get File ${jsonfile}
#Should Not Be_Equal ${data} None
[return] ${data}
-
Json String To Dictionary
[Arguments] ${json_string}
${json_dict}= evaluate json.loads('''${json_string}''') json
[return] ${json_dict}
-
Dictionary To Json String
[Arguments] ${json_dict}
${json_string}= evaluate json.dumps(${json_dict}) json
[return] ${json_string}
-
-
Get DCAE Service Component Status
[Documentation] Get the status of a DCAE Service Component
[Arguments] ${url} ${urlpath} ${usr} ${passwd}
@@ -120,26 +97,23 @@ Get DCAE Service Component Status ${session}= Create Session dcae-service-component ${url} auth=${auth}
${resp}= Get Request dcae-service-component ${urlpath}
[return] ${resp}
-
Publish Event To VES Collector No Auth
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url}
- ${resp}= Post Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ ${session}= Create Session dcaegen2-d1 ${url}
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd}
${auth}= Create List ${user} ${pd}
Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url} auth=${auth}
- ${resp}= Post Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ ${session}= Create Session dcaegen2-d1 ${url} auth=${auth} disable_warnings=1
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector With Put Method
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd}
@@ -149,7 +123,6 @@ Publish Event To VES Collector With Put Method ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
Publish Event To VES Collector With Put Method No Auth
[Documentation] Send an event to VES Collector
[Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
@@ -158,4 +131,3 @@ Publish Event To VES Collector With Put Method No Auth ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
#Log Received response from dcae ${resp.json()}
[return] ${resp}
-
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot index be182d4aa..be072d73c 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot @@ -5,9 +5,11 @@ Documentation store all properties that can change or are used in multipl *** Variables ***
-${GLOBAL_APPLICATION_ID} robot-dcae
-${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500
-${GLOBAL_DCAE_CONSUL_URL1} http://135.205.228.170:8500
+${GLOBAL_APPLICATION_ID} robot-dcaegen2
+${GLOBAL_DCAE_CONSUL_URL} http://135.205.228.129:8500
+${GLOBAL_DCAE_CONSUL_URL1} http://135.205.228.170:8500
${GLOBAL_DCAE_VES_URL} http://localhost:8443/eventlistener/v5
${GLOBAL_DCAE_USERNAME} console
${GLOBAL_DCAE_PASSWORD} ZjJkYjllMjljMTI2M2Iz
+${VESC_HTTPS_USER} sample1
+${VESC_HTTPS_PD} sample1
diff --git a/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh b/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh new file mode 100755 index 000000000..12989911b --- /dev/null +++ b/test/csit/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. + +docker exec -it vesc /opt/app/VESCollector/bin/VESrestfulCollector.sh stop +sleep 2 +docker cp ${WORKSPACE}/test/csit/tests/dcaegen2/testcases/resources/collector.properties vesc:/opt/app/VESCollector/etc +sleep 10 +docker exec -id vesc /opt/app/VESCollector/bin/VESrestfulCollector.sh start +sleep 5 +echo "VES Collector Restarted" diff --git a/test/csit/tests/vfc/nfvo-resmanagement/test.robot b/test/csit/tests/vfc/nfvo-resmanagement/test.robot index 526fb304e..2f2475535 100644 --- a/test/csit/tests/vfc/nfvo-resmanagement/test.robot +++ b/test/csit/tests/vfc/nfvo-resmanagement/test.robot @@ -1,4 +1,5 @@ *** settings *** +Resource ../../common.robot Library Collections Library RequestsLibrary Library simplejson @@ -20,4 +21,4 @@ SwaggerFuncTest List Should Contain Value ${return_ok_list} ${responese_code} ${response_json} json.loads ${resp.content} ${swagger_version}= Convert To String ${response_json['swagger']} - Should Be Equal ${swagger_version} 2.0 + Should Be Equal ${swagger_version} 2.0
\ No newline at end of file |