diff options
Diffstat (limited to 'test/csit')
75 files changed, 2606 insertions, 1558 deletions
diff --git a/test/csit/plans/aaf/aafapi/setup.sh b/test/csit/plans/aaf/aafapi/setup.sh index bfaff925c..4a312704f 100644 --- a/test/csit/plans/aaf/aafapi/setup.sh +++ b/test/csit/plans/aaf/aafapi/setup.sh @@ -30,24 +30,24 @@ 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 +cd $WORKSPACE/archives/aafcsit/authz/auth/auth-service/src/main/resources/docker-compose pwd -chmod -R 777 $WORKSPACE/archives/aafcsit/authz/authz-service/src/main/resources/docker-compose +chmod -R 777 $WORKSPACE/archives/aafcsit/authz/auth/auth-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 +for i in {1..12}; 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) ] + [ $(docker inspect --format '{{ .State.Running }}' dockercompose_aaf_container_1) ] then - echo "AAF Service Running" - break - else - echo sleep $i + echo "AAF Service Running" + break + else + echo sleep $i sleep $i fi done @@ -62,11 +62,11 @@ 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 +for i in {1..12}; 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}" +ROBOT_VARIABLES="-v AAF_IP:${AAF_IP}" diff --git a/test/csit/plans/aaf/sms-test-plan/setup.sh b/test/csit/plans/aaf/sms-test-plan/setup.sh new file mode 100755 index 000000000..9f77b698e --- /dev/null +++ b/test/csit/plans/aaf/sms-test-plan/setup.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# 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. +# + +# Not sure why this is needed. +source ${SCRIPTS}/common_functions.sh + +CONFIG_FILE=$(pwd)/config/smsconfig.json + +mkdir -p $(pwd)/config + +docker login -u docker -p docker nexus3.onap.org:10001 +docker pull nexus3.onap.org:10001/onap/aaf/sms +docker pull docker.io/vault:0.9.5 + +# +# Running vault in dev server mode here for CSIT +# In HELM it runs in production mode +# +docker run -e "VAULT_DEV_ROOT_TOKEN_ID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" \ + -e SKIP_SETCAP=true \ + --name vault -d -p 8200:8200 vault:0.9.5 + +SMSDB_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vault) +cat << EOF > $CONFIG_FILE +{ + "cafile": "auth/selfsignedca.pem", + "servercert": "auth/server.cert", + "serverkey": "auth/server.key", + + "smsdbaddress": "http://$SMSDB_IP:8200", + "vaulttoken": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "disable_tls": true +} +EOF + +cat $CONFIG_FILE + +docker run --workdir /sms -v $CONFIG_FILE:/sms/smsconfig.json \ + --name sms -d -p 10443:10443 nexus3.onap.org:10001/onap/aaf/sms + +SMS_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sms) + +echo "###### WAITING FOR ALL CONTAINERS TO COME UP" +sleep 20 +for i in {1..20}; do + curl -sS -m 1 http://${SMSDB_IP}:8200/v1/sys/seal-status && break + echo sleep $i + sleep $i +done + +# +# add here all ROBOT_VARIABLES settings +# +echo "# sms robot variables settings"; +ROBOT_VARIABLES="-v SMS_HOSTNAME:http://${SMS_IP} -v SMS_PORT:10443" + +echo ${ROBOT_VARIABLES} diff --git a/test/csit/plans/aaf/sms-test-plan/teardown.sh b/test/csit/plans/aaf/sms-test-plan/teardown.sh new file mode 100644 index 000000000..d6fa32924 --- /dev/null +++ b/test/csit/plans/aaf/sms-test-plan/teardown.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# 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 cp sms:/sms/sms.log . +cat sms.log +rm sms.log +rm -rf config +docker stop sms vault +docker rm sms vault +docker rmi nexus3.onap.org:10001/onap/aaf/sms +docker rmi docker.io/vault:0.9.5 diff --git a/test/csit/plans/aaf/sms-test-plan/testplan.txt b/test/csit/plans/aaf/sms-test-plan/testplan.txt new file mode 100644 index 000000000..c2b3b7b1b --- /dev/null +++ b/test/csit/plans/aaf/sms-test-plan/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +aaf/aaf-sms-suite
\ No newline at end of file diff --git a/test/csit/plans/aai/resources/aai-resources/appconfig/titan-cached.properties b/test/csit/plans/aai/resources/aai-resources/appconfig/janusgraph-cached.properties index 97bb81863..c2110f77c 100644 --- a/test/csit/plans/aai/resources/aai-resources/appconfig/titan-cached.properties +++ b/test/csit/plans/aai/resources/aai-resources/appconfig/janusgraph-cached.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/traversal/aai-resources/appconfig/titan-realtime.properties b/test/csit/plans/aai/resources/aai-resources/appconfig/janusgraph-realtime.properties index 0c97b753a..4791431a1 100644 --- a/test/csit/plans/aai/traversal/aai-resources/appconfig/titan-realtime.properties +++ b/test/csit/plans/aai/resources/aai-resources/appconfig/janusgraph-realtime.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/traversal/aai-resources/appconfig/titan-cached.properties b/test/csit/plans/aai/resources/aai-traversal/appconfig/janusgraph-cached.properties index 97bb81863..c2110f77c 100644 --- a/test/csit/plans/aai/traversal/aai-resources/appconfig/titan-cached.properties +++ b/test/csit/plans/aai/resources/aai-traversal/appconfig/janusgraph-cached.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/resources/aai-resources/appconfig/titan-realtime.properties b/test/csit/plans/aai/resources/aai-traversal/appconfig/janusgraph-realtime.properties index 0c97b753a..4791431a1 100644 --- a/test/csit/plans/aai/resources/aai-resources/appconfig/titan-realtime.properties +++ b/test/csit/plans/aai/resources/aai-traversal/appconfig/janusgraph-realtime.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/resources/docker-compose.yml b/test/csit/plans/aai/resources/docker-compose.yml index 3f465c3ec..6f62e6ef2 100644 --- a/test/csit/plans/aai/resources/docker-compose.yml +++ b/test/csit/plans/aai/resources/docker-compose.yml @@ -6,11 +6,12 @@ services: environment: - LOCAL_USER_ID=${USER_ID} - LOCAL_GROUP_ID=${GROUP_ID} + - SKIP_CREATE_DB_SCHEMA_AT_STARTUP=true ports: - 8447:8447 volumes: - - ${CURRENT_PWD}/aai-resources/appconfig/titan-realtime.properties:/opt/app/aai-resources/resources/etc/appprops/titan-realtime.properties - - ${CURRENT_PWD}/aai-resources/appconfig/titan-cached.properties:/opt/app/aai-resources/resources/etc/appprops/titan-cached.properties + - ${CURRENT_PWD}/aai-resources/appconfig/janusgraph-realtime.properties:/opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties + - ${CURRENT_PWD}/aai-resources/appconfig/janusgraph-cached.properties:/opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties - ${CURRENT_PWD}/aai-resources/appconfig/aaiconfig.properties:/opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties - ${CURRENT_PWD}/aai-resources/appconfig/application.properties:/opt/app/aai-resources/resources/application.properties - ${CURRENT_PWD}/aai-resources/appconfig/logback.xml:/opt/app/aai-resources/resources/logback.xml @@ -30,8 +31,8 @@ services: - LOCAL_GROUP_ID=${GROUP_ID} - DISABLE_UPDATE_QUERY=true volumes: - - ${CURRENT_PWD}/aai-traversal/appconfig/titan-realtime.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-realtime.properties - - ${CURRENT_PWD}/aai-traversal/appconfig/titan-cached.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-cached.properties + - ${CURRENT_PWD}/aai-traversal/appconfig/janusgraph-realtime.properties:/opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties + - ${CURRENT_PWD}/aai-traversal/appconfig/janusgraph-cached.properties:/opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties - ${CURRENT_PWD}/aai-traversal/appconfig/aaiconfig.properties:/opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties - ${CURRENT_PWD}/aai-traversal/appconfig/application.properties:/opt/app/aai-traversal/resources/application.properties - ${CURRENT_PWD}/aai-traversal/appconfig/logback.xml:/opt/app/aai-traversal/resources/logback.xml @@ -61,16 +62,18 @@ services: max-size: "30m" max-file: "5" aai.hbase.simpledemo.onap.org: - image: ${HBASE_IMAGE}:${HBASE_VERSION} + image: cassandra:2.1 hostname: aai.hbase.simpledemo.onap.org ports: - - 2181:2181 - - 8080:8080 - - 8085:8085 - - 9090:9090 - - 16000:16000 - - 16010:16010 - - 16201:16201 + - 7000:7000 + - 7001:7001 + - 7199:7199 + - 9042:9042 + environment: + - CASSANDRA_SEEDS=aai.hbase.simpledemo.onap.org + - CASSANDRA_DC=Heat + - CASSANDRA_RACK=Rack1 + - CASSANDRA_AUTO_BOOTSTRAP=true logging: driver: "json-file" options: diff --git a/test/csit/plans/aai/resources/setup.sh b/test/csit/plans/aai/resources/setup.sh index 14b567108..bd5cb5214 100644 --- a/test/csit/plans/aai/resources/setup.sh +++ b/test/csit/plans/aai/resources/setup.sh @@ -73,10 +73,8 @@ ${DOCKER_COMPOSE_CMD} stop ${DOCKER_COMPOSE_CMD} rm -f -v # Start the hbase where the data will be stored -HBASE_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.hbase.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:8085'; -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:8080'; -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:9095'; +CASSANDRA_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.hbase.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); +wait_for_container $CASSANDRA_CONTAINER_NAME 'Listening for thrift clients'; USER_EXISTS=$(check_if_user_exists aaiadmin); @@ -102,6 +100,8 @@ else export USER_ID=$(id -u aaiadmin); fi; +$DOCKER_COMPOSE_CMD run --rm aai-resources.api.simpledemo.onap.org createDBSchema.sh + RESOURCES_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-resources.api.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); wait_for_container $RESOURCES_CONTAINER_NAME 'Resources Microservice Started'; diff --git a/test/csit/plans/aai/resources/aai-traversal/appconfig/titan-cached.properties b/test/csit/plans/aai/traversal/aai-resources/appconfig/janusgraph-cached.properties index 97bb81863..c2110f77c 100644 --- a/test/csit/plans/aai/resources/aai-traversal/appconfig/titan-cached.properties +++ b/test/csit/plans/aai/traversal/aai-resources/appconfig/janusgraph-cached.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/traversal/aai-traversal/appconfig/titan-realtime.properties b/test/csit/plans/aai/traversal/aai-resources/appconfig/janusgraph-realtime.properties index 0c97b753a..4791431a1 100644 --- a/test/csit/plans/aai/traversal/aai-traversal/appconfig/titan-realtime.properties +++ b/test/csit/plans/aai/traversal/aai-resources/appconfig/janusgraph-realtime.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/traversal/aai-traversal/appconfig/titan-cached.properties b/test/csit/plans/aai/traversal/aai-traversal/appconfig/janusgraph-cached.properties index 97bb81863..c2110f77c 100644 --- a/test/csit/plans/aai/traversal/aai-traversal/appconfig/titan-cached.properties +++ b/test/csit/plans/aai/traversal/aai-traversal/appconfig/janusgraph-cached.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/resources/aai-traversal/appconfig/titan-realtime.properties b/test/csit/plans/aai/traversal/aai-traversal/appconfig/janusgraph-realtime.properties index 0c97b753a..4791431a1 100644 --- a/test/csit/plans/aai/resources/aai-traversal/appconfig/titan-realtime.properties +++ b/test/csit/plans/aai/traversal/aai-traversal/appconfig/janusgraph-realtime.properties @@ -21,10 +21,14 @@ # query.fast-property=true +query.smart-limit=false + # the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase +storage.backend=cassandra storage.hostname=aai.hbase.simpledemo.onap.org +storage.cassandra.keyspace=aaigraph + #schema.default=none storage.lock.wait-time=300 storage.hbase.table=aaigraph-dev1.dev diff --git a/test/csit/plans/aai/traversal/docker-compose.yml b/test/csit/plans/aai/traversal/docker-compose.yml index 3f465c3ec..6f62e6ef2 100644 --- a/test/csit/plans/aai/traversal/docker-compose.yml +++ b/test/csit/plans/aai/traversal/docker-compose.yml @@ -6,11 +6,12 @@ services: environment: - LOCAL_USER_ID=${USER_ID} - LOCAL_GROUP_ID=${GROUP_ID} + - SKIP_CREATE_DB_SCHEMA_AT_STARTUP=true ports: - 8447:8447 volumes: - - ${CURRENT_PWD}/aai-resources/appconfig/titan-realtime.properties:/opt/app/aai-resources/resources/etc/appprops/titan-realtime.properties - - ${CURRENT_PWD}/aai-resources/appconfig/titan-cached.properties:/opt/app/aai-resources/resources/etc/appprops/titan-cached.properties + - ${CURRENT_PWD}/aai-resources/appconfig/janusgraph-realtime.properties:/opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties + - ${CURRENT_PWD}/aai-resources/appconfig/janusgraph-cached.properties:/opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties - ${CURRENT_PWD}/aai-resources/appconfig/aaiconfig.properties:/opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties - ${CURRENT_PWD}/aai-resources/appconfig/application.properties:/opt/app/aai-resources/resources/application.properties - ${CURRENT_PWD}/aai-resources/appconfig/logback.xml:/opt/app/aai-resources/resources/logback.xml @@ -30,8 +31,8 @@ services: - LOCAL_GROUP_ID=${GROUP_ID} - DISABLE_UPDATE_QUERY=true volumes: - - ${CURRENT_PWD}/aai-traversal/appconfig/titan-realtime.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-realtime.properties - - ${CURRENT_PWD}/aai-traversal/appconfig/titan-cached.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-cached.properties + - ${CURRENT_PWD}/aai-traversal/appconfig/janusgraph-realtime.properties:/opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties + - ${CURRENT_PWD}/aai-traversal/appconfig/janusgraph-cached.properties:/opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties - ${CURRENT_PWD}/aai-traversal/appconfig/aaiconfig.properties:/opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties - ${CURRENT_PWD}/aai-traversal/appconfig/application.properties:/opt/app/aai-traversal/resources/application.properties - ${CURRENT_PWD}/aai-traversal/appconfig/logback.xml:/opt/app/aai-traversal/resources/logback.xml @@ -61,16 +62,18 @@ services: max-size: "30m" max-file: "5" aai.hbase.simpledemo.onap.org: - image: ${HBASE_IMAGE}:${HBASE_VERSION} + image: cassandra:2.1 hostname: aai.hbase.simpledemo.onap.org ports: - - 2181:2181 - - 8080:8080 - - 8085:8085 - - 9090:9090 - - 16000:16000 - - 16010:16010 - - 16201:16201 + - 7000:7000 + - 7001:7001 + - 7199:7199 + - 9042:9042 + environment: + - CASSANDRA_SEEDS=aai.hbase.simpledemo.onap.org + - CASSANDRA_DC=Heat + - CASSANDRA_RACK=Rack1 + - CASSANDRA_AUTO_BOOTSTRAP=true logging: driver: "json-file" options: diff --git a/test/csit/plans/aai/traversal/setup.sh b/test/csit/plans/aai/traversal/setup.sh index 118a1bc9c..70dda84b6 100644 --- a/test/csit/plans/aai/traversal/setup.sh +++ b/test/csit/plans/aai/traversal/setup.sh @@ -72,10 +72,8 @@ ${DOCKER_COMPOSE_CMD} stop ${DOCKER_COMPOSE_CMD} rm -f -v # Start the hbase where the data will be stored -HBASE_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.hbase.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:8085'; -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:8080'; -wait_for_container ${HBASE_CONTAINER_NAME} ' Started SelectChannelConnector@0.0.0.0:9095'; +CASSANDRA_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai.hbase.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); +wait_for_container $CASSANDRA_CONTAINER_NAME 'Listening for thrift clients'; USER_EXISTS=$(check_if_user_exists aaiadmin); @@ -103,12 +101,16 @@ else export GROUP_ID=$(id -g aaiadmin); fi; +$DOCKER_COMPOSE_CMD run --rm aai-resources.api.simpledemo.onap.org createDBSchema.sh + RESOURCES_CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} up -d aai-resources.api.simpledemo.onap.org 2>&1 | grep 'Creating' | grep -v 'volume' | grep -v 'network' | awk '{ print $2; }' | head -1); wait_for_container $RESOURCES_CONTAINER_NAME 'Resources Microservice Started'; ${DOCKER_COMPOSE_CMD} up -d aai-traversal.api.simpledemo.onap.org aai.api.simpledemo.onap.org TRAVERSAL_CONTAINER_NAME=$(echo $RESOURCES_CONTAINER_NAME | sed 's/aai-resources/aai-traversal/g'); +$DOCKER_COMPOSE_CMD run --rm aai-traversal.api.simpledemo.onap.org install/updateQueryData.sh + echo "A&AI Microservices, resources and traversal, are up and running along with HAProxy"; wait_for_container $TRAVERSAL_CONTAINER_NAME 'Traversal Microservice Started'; diff --git a/test/csit/plans/dmaap/mrpubsub/setup.sh b/test/csit/plans/dmaap/mrpubsub/setup.sh index 3e8950f2b..0a1f9d359 100755 --- a/test/csit/plans/dmaap/mrpubsub/setup.sh +++ b/test/csit/plans/dmaap/mrpubsub/setup.sh @@ -35,6 +35,7 @@ cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/Ms # start DMaaP MR containers with docker compose and configuration from docker-compose.yml +docker login -u docker -p docker nexus3.onap.org:10001 docker-compose up -d # Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper @@ -68,6 +69,7 @@ sed -i -e 's/<zookeeper_host>/'$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties sed -i -e 's/<kafka_host>:<kafka_port>/'$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties docker-compose build +docker login -u docker -p docker nexus3.onap.org:10001 docker-compose up -d # Wait for initialization of Docker containers diff --git a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh index ae78ec49a..89688eeaf 100644 --- a/test/csit/plans/holmes-rule-management/sanity-check/setup.sh +++ b/test/csit/plans/holmes-rule-management/sanity-check/setup.sh @@ -60,6 +60,12 @@ for i in {1..10}; do echo sleep $i sleep $i done + +echo sleep 30s for service registration +sleep 30 + +docker logs i-rulemgt +docker logs i-engine-d #Pass any variables required by Robot test suites in ROBOT_VARIABLES ROBOT_VARIABLES="-v MSB_IP:${MSB_IP} -v RULEMGT_IP:${RULEMGT_IP} -v ENGINE_D_IP:${ENGINE_D_IP}" diff --git a/test/csit/plans/multicloud-vmware/functionality1/testplan.txt b/test/csit/plans/multicloud-vmware/functionality1/testplan.txt index 2f5ad1b6f..0a2ad45af 100644 --- a/test/csit/plans/multicloud-vmware/functionality1/testplan.txt +++ b/test/csit/plans/multicloud-vmware/functionality1/testplan.txt @@ -7,3 +7,7 @@ multicloud-vmware/provision/sanity_test_neutron.robot multicloud-vmware/nova/sanity-flavor.robot multicloud-vmware/nova/sanity-host.robot multicloud-vmware/nova/sanity-server.robot +multicloud-vmware/samples/sanity-sample.robot +multicloud-vmware/hosts/sanity-host.robot +multicloud-vmware/networks/sanity-network.robot +multicloud-vmware/images/sanity-image.robot diff --git a/test/csit/plans/multicloud/functionality1/setup.sh b/test/csit/plans/multicloud/functionality1/setup.sh index 993a39f68..50118a54a 100755 --- a/test/csit/plans/multicloud/functionality1/setup.sh +++ b/test/csit/plans/multicloud/functionality1/setup.sh @@ -20,7 +20,9 @@ source ${SCRIPTS}/common_functions.sh # start multivim-broker -docker run -d --name multivim-broker nexus3.onap.org:10001/onap/multicloud/framework +docker run -d --name multivim-vio nexus3.onap.org:10001/onap/multicloud/vio +docker run -d --name multivim-broker --link multivim-vio -e MSB_ADDR=multivim-vio -e MSB_PORT=9004 nexus3.onap.org:10001/onap/multicloud/framework + BROKER_IP=`get-instance-ip.sh multivim-broker` for i in {1..50}; do curl -sS ${BROKER_IP}:9001 && break diff --git a/test/csit/plans/multicloud/functionality1/teardown.sh b/test/csit/plans/multicloud/functionality1/teardown.sh index 1732649af..a2ef0e35e 100755 --- a/test/csit/plans/multicloud/functionality1/teardown.sh +++ b/test/csit/plans/multicloud/functionality1/teardown.sh @@ -16,4 +16,5 @@ # # This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh multivim-vio kill-instance.sh multivim-broker diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh b/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh new file mode 100644 index 000000000..88becf69e --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/setup.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# 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. +# + +# Not sure why this is needed. +source ${SCRIPTS}/common_functions.sh + +# Initial Configuration. +DATASTORE="consul" +DATASTORE_IP="localhost" + +MOUNTPATH="/dkv_mount_path/configs/" +DEFAULT_CONFIGS=$(pwd)/mountpath/default + +mkdir -p mountpath/default + +pushd mountpath/default +cat << EOF > sampleConfig1.properties +foo1=bar1 +hello1=world1 +key1=value1 +EOF +cat << EOF > sampleConfig2.properties +foo2=bar2 +hello2=world2 +key2=value2 +EOF +popd + +docker login -u docker -p docker nexus3.onap.org:10001 +docker pull nexus3.onap.org:10001/onap/music/distributed-kv-store +docker run -e DATASTORE=$DATASTORE -e DATASTORE_IP=$DATASTORE_IP -e MOUNTPATH=$MOUNTPATH -d \ + --name dkv \ + -v $DEFAULT_CONFIGS:/dkv_mount_path/configs/default \ + -p 8200:8200 -p 8080:8080 nexus3.onap.org:10001/onap/music/distributed-kv-store + + +echo "###### WAITING FOR DISTRIBUTED KV STORE CONTAINER TO COME UP" +sleep 10 + +# +# add here all ROBOT_VARIABLES settings +# +echo "# music robot variables settings"; +ROBOT_VARIABLES="-v DKV_HOSTNAME:http://localhost -v DKV_PORT:8080" + +echo ${ROBOT_VARIABLES}
\ No newline at end of file diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh b/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh new file mode 100644 index 000000000..0abf3a62d --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/teardown.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2018 Intel Corporation +# +# 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. +# + +rm -rf mountpath +docker stop dkv +docker rm dkv +docker rmi nexus3.onap.org:10001/onap/music/distributed-kv-store diff --git a/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt b/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt new file mode 100644 index 000000000..ac37bc5a6 --- /dev/null +++ b/test/csit/plans/music/music-distributed-kv-store-test-plan/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +music/music-distributed-kv-store-suite
\ No newline at end of file diff --git a/test/csit/plans/music/music-test-plan/setup.sh b/test/csit/plans/music/music-test-plan/setup.sh index 63d2ef93f..ddfdfc023 100755 --- a/test/csit/plans/music/music-test-plan/setup.sh +++ b/test/csit/plans/music/music-test-plan/setup.sh @@ -50,14 +50,21 @@ docker network create music-net; # Start Cassandra docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG}; +CASSA_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-db` +echo "CASSANDRA_IP=${CASSA_IP}" +${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042 + # Start Music war docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; # Start Zookeeper docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}; -# Delay for Cassandra -sleep 20; +ZOO_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-zk` +echo "ZOOKEEPER_IP=${ZOO_IP}" + +# Delay between Cassandra/Zookeeper and Tomcat +sleep 60; # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG}; @@ -65,20 +72,6 @@ docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vo # Connect tomcat to host bridge network so that its port can be seen. docker network connect bridge music-tomcat; -################################## - -# -# add here below the start of all docker containers needed for music CSIT testing -# - -CASSA_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-db` -echo "CASSANDRA_IP=${CASSA_IP}" - -ZOO_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-zk` -echo "ZOOKEEPER_IP=${ZOO_IP}" - -${WORKSPACE}/test/csit/scripts/music/music-scripts/wait_for_port.sh ${CASSA_IP} 9042 - TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` echo "TOMCAT_IP=${TOMCAT_IP}" @@ -93,7 +86,10 @@ docker inspect music-war docker volume inspect music-vol docker network inspect music-net - +echo "dump music content just after music is started" +docker exec music-db /usr/bin/nodetool status +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' # diff --git a/test/csit/plans/portal-sdk/testsuite/.env b/test/csit/plans/portal-sdk/testsuite/.env index 0b7de9560..27e9aa3fb 100644 --- a/test/csit/plans/portal-sdk/testsuite/.env +++ b/test/csit/plans/portal-sdk/testsuite/.env @@ -2,25 +2,34 @@ # used by docker-compose AND by other shell scripts # Host directory with config files -LOGS_DIR=./logs -PROPS_DIR=./properties - - -# Directory within containers -WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps - # Following are ALSO used in demo/boot/portal_vm_init.sh -EP_IMG_NAME=onap/portal-apps +EP_IMG_NAME=onap/portal-app +SDK_IMG_NAME=onap/portal-sdk DB_IMG_NAME=onap/portal-db +CDR_IMG_NAME=onap/music/cassandra_music +ZK_IMG_NAME=zookeeper WMS_IMG_NAME=onap/portal-wms +# Deployed with portal; built elsewhere CLI_IMG_NAME=onap/cli # Tag all images with this -PORTAL_TAG=1.3.0 -DOCKER_IMAGE_VERSION=1.3-STAGING-latest +DOCKER_IMAGE_VERSION=2.1-STAGING-latest CLI_DOCKER_VERSION=1.1-STAGING-latest +CDR_IMAGE_VERSION=latest +ZK_IMAGE_VERSION=3.4 NEXUS_DOCKER_REPO=nexus3.onap.org:10003 +# This is used during builds and in docker-compose; +# it is never published to the ONAP registry. +PORTAL_TAG=beijing + +# Name of directory in apps container (NOT host) +WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps + +# Required settings with default values. +# Export shell environment variables on ALL hosts. +LOGS_DIR=./logs +PROPS_DIR=./properties # Optional settings with no defaults. EXTRA_HOST_IP="" diff --git a/test/csit/plans/portal-sdk/testsuite/docker-compose.yml b/test/csit/plans/portal-sdk/testsuite/docker-compose.yml index 7a9fb8caa..dda74c91a 100644 --- a/test/csit/plans/portal-sdk/testsuite/docker-compose.yml +++ b/test/csit/plans/portal-sdk/testsuite/docker-compose.yml @@ -1,11 +1,12 @@ # docker-compose for ONAP portal containers: database, microservice, portal apps. -# Relies on .env file in current directory. +# Relies on .env file, which CANNOT be specified via command-line option # Works in multiple environments; does not pull from a Nexus registry. # Exposes the portal apps docker (but not DB nor WMS dockers) on the host network. # Images must be pulled from ONAP Nexus registry after logging in like this: # docker login -u USER -p PASS nexus3.onap.org:10001 +# Uses healthcheck feature added in docker-compose v2.1 -version: '2.0' +version: '2.1' services: @@ -29,11 +30,51 @@ services: volumes: # Just specify a path and let the Engine create a volume - /var/lib/mysql + # Inject the onboarding script at start time + - ./Apps_Users_OnBoarding_Script.sql:/docker-entrypoint-initdb.d/zzz_apps_users_onboarding.sql logging: driver: json-file + healthcheck: + test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] + timeout: 10s + retries: 30 + + # Config files may use hostname "portal-cassandra" + portal-cassandra: + image: ${CDR_IMG_NAME}:${PORTAL_TAG} + environment: + - CASSUSER=root + - CASSPASS=Aa123456 + expose: + - 7000 + - 7001 + - 7199 + - 9042 + - 9160 + ports: + - 7000:7000 + - 7001:7001 + - 7199:7199 + - 9042:9042 + - 9160:9160 + volumes: + - ./portal.cql:/docker-entrypoint-initdb.d/zzz_portal.cql + - ./portalsdk.cql:/docker-entrypoint-initdb.d/zzz_portalsdk.cql + links: + - portal-db + depends_on: + portal-db: + condition: service_healthy + + # Config files may use hostname "portal-zk" + portal-zk: + image: ${ZK_IMG_NAME}:${PORTAL_TAG} + expose: + - 2181 + ports: + - 2181:2181 - # An environment variable here CAN override the database URL; - # instead the value in the config file uses hostname from above + # The app config file uses the docker name above portal-wms: image: ${WMS_IMG_NAME}:${PORTAL_TAG} expose: @@ -41,25 +82,18 @@ services: links: - portal-db depends_on: - - portal-db + portal-db: + condition: service_healthy volumes: - - ${PROPS_DIR}/ECOMPWIDGETMS/application.properties:/application.properties + - ${PROPS_DIR}/ONAPWIDGETMS/application.properties:/application.properties + - ${PROPS_DIR}/ONAPWIDGETMS/application.yml:/application.yml command: - - /wait-for.sh - - -t - - "420" - - portal-db:3306 - - -- - - /start-wms-cmd.sh + - /start-wms.sh logging: driver: json-file - # Environment variables here CANNOT override the database URL because - # two apps use identical configuration keys with different values - portal-apps: + portal-app: image: ${EP_IMG_NAME}:${PORTAL_TAG} - expose: - - 8989 ports: - 8989:8080 - 8010:8009 @@ -67,32 +101,51 @@ services: links: - portal-db - portal-wms + - portal-zk + - portal-cassandra depends_on: - - portal-db - - portal-wms + portal-db: + condition: service_healthy + portal-wms: + condition: service_started volumes: - - ${PROPS_DIR}/ECOMPPORTALAPP/system.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/fusion/conf/fusion.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/portal.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/openid-connect.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/openid-connect.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/logback.xml:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/logback.xml - - ${PROPS_DIR}/ECOMPSDKAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/fusion/conf/fusion.properties - - ${PROPS_DIR}/ECOMPSDKAPP/system.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPSDKAPP/portal.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPDBCAPP/system.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPDBCAPP/portal.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPDBCAPP/dbcapp.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/dbcapp/dbcapp.properties - - ${PROPS_DIR}/ECOMPDBCAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTAL/system.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/conf/system.properties + - ${PROPS_DIR}/ONAPPORTAL/fusion.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTAL/portal.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/portal.properties + - ${PROPS_DIR}/ONAPPORTAL/music.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/music.properties + - ${PROPS_DIR}/ONAPPORTAL/openid-connect.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/openid-connect.properties + - ${PROPS_DIR}/ONAPPORTAL/logback.xml:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/logback.xml - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs command: - - /wait-for.sh - - -t - - "420" - - portal-db:3306 - - -- - - /start-apps-cmd.sh + - /start-apache-tomcat.sh # see comments in .env file + - -i - $EXTRA_HOST_IP + - -n - $EXTRA_HOST_NAME logging: driver: json-file + + portal-sdk: + image: ${SDK_IMG_NAME}:${PORTAL_TAG} + ports: + - 8990:8080 + links: + - portal-db + - portal-wms + - portal-zk + - portal-cassandra + depends_on: + portal-db: + condition: service_healthy + volumes: + - ${PROPS_DIR}/ONAPPORTALSDK/fusion.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTALSDK/system.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/conf/system.properties + - ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties + - ${PROPS_DIR}/ONAPPORTALSDK/music.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/music.properties + - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml + - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs + command: + - /start-apache-tomcat.sh + logging: + driver: json-file diff --git a/test/csit/plans/portal-sdk/testsuite/setup.sh b/test/csit/plans/portal-sdk/testsuite/setup.sh index 0c90dc66b..6510311cb 100644 --- a/test/csit/plans/portal-sdk/testsuite/setup.sh +++ b/test/csit/plans/portal-sdk/testsuite/setup.sh @@ -48,7 +48,7 @@ NEXUS_DOCKER_REPO=nexus3.onap.org:10003 CURR="$(pwd)" -git clone http://gerrit.onap.org/r/portal -b "release-1.3.0" +git clone http://gerrit.onap.org/r/portal -b "master" # Refresh configuration and scripts cd portal @@ -80,15 +80,21 @@ mkdir -p $LOGS_DIR # Refresh images docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO -docker pull $NEXUS_DOCKER_REPO/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION +docker pull $ZK_IMG_NAME:$ZK_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION docker pull $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION # Tag them as expected by docker-compose file -docker tag $NEXUS_DOCKER_REPO/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG -docker tag $NEXUS_DOCKER_REPO/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG -docker tag $NEXUS_DOCKER_REPO/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION $SDK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION $CDR_IMG_NAME:$PORTAL_TAG +docker tag $ZK_IMG_NAME:$ZK_IMAGE_VERSION $ZK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$PORTAL_TAG @@ -130,7 +136,7 @@ fi -sleep 3m +sleep 6m # WAIT 5 minutes maximum and test every 5 seconds if Portal up using HealthCheck API TIME_OUT=500 @@ -170,7 +176,7 @@ HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') export HOST_IP=${HOST_IP} #docker logs deliveries_portal-db_1 -docker logs deliveries_portal-apps_1 +docker logs deliveries_portal-app_1 docker logs deliveries_portal-wms_1 diff --git a/test/csit/plans/portal/testsuite/.env b/test/csit/plans/portal/testsuite/.env index 0b7de9560..27e9aa3fb 100644 --- a/test/csit/plans/portal/testsuite/.env +++ b/test/csit/plans/portal/testsuite/.env @@ -2,25 +2,34 @@ # used by docker-compose AND by other shell scripts # Host directory with config files -LOGS_DIR=./logs -PROPS_DIR=./properties - - -# Directory within containers -WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps - # Following are ALSO used in demo/boot/portal_vm_init.sh -EP_IMG_NAME=onap/portal-apps +EP_IMG_NAME=onap/portal-app +SDK_IMG_NAME=onap/portal-sdk DB_IMG_NAME=onap/portal-db +CDR_IMG_NAME=onap/music/cassandra_music +ZK_IMG_NAME=zookeeper WMS_IMG_NAME=onap/portal-wms +# Deployed with portal; built elsewhere CLI_IMG_NAME=onap/cli # Tag all images with this -PORTAL_TAG=1.3.0 -DOCKER_IMAGE_VERSION=1.3-STAGING-latest +DOCKER_IMAGE_VERSION=2.1-STAGING-latest CLI_DOCKER_VERSION=1.1-STAGING-latest +CDR_IMAGE_VERSION=latest +ZK_IMAGE_VERSION=3.4 NEXUS_DOCKER_REPO=nexus3.onap.org:10003 +# This is used during builds and in docker-compose; +# it is never published to the ONAP registry. +PORTAL_TAG=beijing + +# Name of directory in apps container (NOT host) +WEBAPPS_DIR=/opt/apache-tomcat-8.0.37/webapps + +# Required settings with default values. +# Export shell environment variables on ALL hosts. +LOGS_DIR=./logs +PROPS_DIR=./properties # Optional settings with no defaults. EXTRA_HOST_IP="" diff --git a/test/csit/plans/portal/testsuite/docker-compose.yml b/test/csit/plans/portal/testsuite/docker-compose.yml index 7a9fb8caa..dda74c91a 100644 --- a/test/csit/plans/portal/testsuite/docker-compose.yml +++ b/test/csit/plans/portal/testsuite/docker-compose.yml @@ -1,11 +1,12 @@ # docker-compose for ONAP portal containers: database, microservice, portal apps. -# Relies on .env file in current directory. +# Relies on .env file, which CANNOT be specified via command-line option # Works in multiple environments; does not pull from a Nexus registry. # Exposes the portal apps docker (but not DB nor WMS dockers) on the host network. # Images must be pulled from ONAP Nexus registry after logging in like this: # docker login -u USER -p PASS nexus3.onap.org:10001 +# Uses healthcheck feature added in docker-compose v2.1 -version: '2.0' +version: '2.1' services: @@ -29,11 +30,51 @@ services: volumes: # Just specify a path and let the Engine create a volume - /var/lib/mysql + # Inject the onboarding script at start time + - ./Apps_Users_OnBoarding_Script.sql:/docker-entrypoint-initdb.d/zzz_apps_users_onboarding.sql logging: driver: json-file + healthcheck: + test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ] + timeout: 10s + retries: 30 + + # Config files may use hostname "portal-cassandra" + portal-cassandra: + image: ${CDR_IMG_NAME}:${PORTAL_TAG} + environment: + - CASSUSER=root + - CASSPASS=Aa123456 + expose: + - 7000 + - 7001 + - 7199 + - 9042 + - 9160 + ports: + - 7000:7000 + - 7001:7001 + - 7199:7199 + - 9042:9042 + - 9160:9160 + volumes: + - ./portal.cql:/docker-entrypoint-initdb.d/zzz_portal.cql + - ./portalsdk.cql:/docker-entrypoint-initdb.d/zzz_portalsdk.cql + links: + - portal-db + depends_on: + portal-db: + condition: service_healthy + + # Config files may use hostname "portal-zk" + portal-zk: + image: ${ZK_IMG_NAME}:${PORTAL_TAG} + expose: + - 2181 + ports: + - 2181:2181 - # An environment variable here CAN override the database URL; - # instead the value in the config file uses hostname from above + # The app config file uses the docker name above portal-wms: image: ${WMS_IMG_NAME}:${PORTAL_TAG} expose: @@ -41,25 +82,18 @@ services: links: - portal-db depends_on: - - portal-db + portal-db: + condition: service_healthy volumes: - - ${PROPS_DIR}/ECOMPWIDGETMS/application.properties:/application.properties + - ${PROPS_DIR}/ONAPWIDGETMS/application.properties:/application.properties + - ${PROPS_DIR}/ONAPWIDGETMS/application.yml:/application.yml command: - - /wait-for.sh - - -t - - "420" - - portal-db:3306 - - -- - - /start-wms-cmd.sh + - /start-wms.sh logging: driver: json-file - # Environment variables here CANNOT override the database URL because - # two apps use identical configuration keys with different values - portal-apps: + portal-app: image: ${EP_IMG_NAME}:${PORTAL_TAG} - expose: - - 8989 ports: - 8989:8080 - 8010:8009 @@ -67,32 +101,51 @@ services: links: - portal-db - portal-wms + - portal-zk + - portal-cassandra depends_on: - - portal-db - - portal-wms + portal-db: + condition: service_healthy + portal-wms: + condition: service_started volumes: - - ${PROPS_DIR}/ECOMPPORTALAPP/system.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/fusion/conf/fusion.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/portal.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/openid-connect.properties:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/openid-connect.properties - - ${PROPS_DIR}/ECOMPPORTALAPP/logback.xml:${WEBAPPS_DIR}/ECOMPPORTAL/WEB-INF/classes/logback.xml - - ${PROPS_DIR}/ECOMPSDKAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/fusion/conf/fusion.properties - - ${PROPS_DIR}/ECOMPSDKAPP/system.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPSDKAPP/portal.properties:${WEBAPPS_DIR}/ECOMPSDKAPP/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPDBCAPP/system.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/conf/system.properties - - ${PROPS_DIR}/ECOMPDBCAPP/portal.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/classes/portal.properties - - ${PROPS_DIR}/ECOMPDBCAPP/dbcapp.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/dbcapp/dbcapp.properties - - ${PROPS_DIR}/ECOMPDBCAPP/fusion.properties:${WEBAPPS_DIR}/ECOMPDBCAPP/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTAL/system.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/conf/system.properties + - ${PROPS_DIR}/ONAPPORTAL/fusion.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTAL/portal.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/portal.properties + - ${PROPS_DIR}/ONAPPORTAL/music.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/music.properties + - ${PROPS_DIR}/ONAPPORTAL/openid-connect.properties:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/openid-connect.properties + - ${PROPS_DIR}/ONAPPORTAL/logback.xml:${WEBAPPS_DIR}/ONAPPORTAL/WEB-INF/classes/logback.xml - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs command: - - /wait-for.sh - - -t - - "420" - - portal-db:3306 - - -- - - /start-apps-cmd.sh + - /start-apache-tomcat.sh # see comments in .env file + - -i - $EXTRA_HOST_IP + - -n - $EXTRA_HOST_NAME logging: driver: json-file + + portal-sdk: + image: ${SDK_IMG_NAME}:${PORTAL_TAG} + ports: + - 8990:8080 + links: + - portal-db + - portal-wms + - portal-zk + - portal-cassandra + depends_on: + portal-db: + condition: service_healthy + volumes: + - ${PROPS_DIR}/ONAPPORTALSDK/fusion.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/fusion/conf/fusion.properties + - ${PROPS_DIR}/ONAPPORTALSDK/system.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/conf/system.properties + - ${PROPS_DIR}/ONAPPORTALSDK/portal.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/portal.properties + - ${PROPS_DIR}/ONAPPORTALSDK/music.properties:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/music.properties + - ${PROPS_DIR}/ONAPPORTALSDK/logback.xml:${WEBAPPS_DIR}/ONAPPORTALSDK/WEB-INF/classes/logback.xml + - ${LOGS_DIR}:/opt/apache-tomcat-8.0.37/logs + command: + - /start-apache-tomcat.sh + logging: + driver: json-file diff --git a/test/csit/plans/portal/testsuite/setup.sh b/test/csit/plans/portal/testsuite/setup.sh index 0c90dc66b..76cf5f373 100644 --- a/test/csit/plans/portal/testsuite/setup.sh +++ b/test/csit/plans/portal/testsuite/setup.sh @@ -48,7 +48,7 @@ NEXUS_DOCKER_REPO=nexus3.onap.org:10003 CURR="$(pwd)" -git clone http://gerrit.onap.org/r/portal -b "release-1.3.0" +git clone http://gerrit.onap.org/r/portal -b "master" # Refresh configuration and scripts cd portal @@ -80,15 +80,21 @@ mkdir -p $LOGS_DIR # Refresh images docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO -docker pull $NEXUS_DOCKER_REPO/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION +docker pull $ZK_IMG_NAME:$ZK_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION docker pull $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION # Tag them as expected by docker-compose file -docker tag $NEXUS_DOCKER_REPO/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG -docker tag $NEXUS_DOCKER_REPO/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG -docker tag $NEXUS_DOCKER_REPO/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION $SDK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION $CDR_IMG_NAME:$PORTAL_TAG +docker tag $ZK_IMG_NAME:$ZK_IMAGE_VERSION $ZK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$PORTAL_TAG @@ -130,7 +136,7 @@ fi -sleep 3m +sleep 6m # WAIT 5 minutes maximum and test every 5 seconds if Portal up using HealthCheck API TIME_OUT=500 @@ -169,8 +175,8 @@ fi HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') export HOST_IP=${HOST_IP} -#docker logs deliveries_portal-db_1 -docker logs deliveries_portal-apps_1 +docker logs deliveries_portal-db_1 +docker logs deliveries_portal-app_1 docker logs deliveries_portal-wms_1 diff --git a/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/setup.sh b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/setup.sh new file mode 100644 index 000000000..4d97f33eb --- /dev/null +++ b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/setup.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copyright 2018 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. +# +# Place the scripts in run order: +# Start all process required for executing test case + +#login to the onap nexus docker repo +docker login -u docker -p docker nexus3.onap.org:10001 + +# Start MSB +docker run -d -p 8500:8500 --name msb_consul consul:0.9.3 +CONSUL_IP=`get-instance-ip.sh msb_consul` +echo CONSUL_IP=${CONSUL_IP} +docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo DISCOVERY_IP=${DISCOVERY_IP} +docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IP==`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IP=${MSB_IP} + +# Start resmgr +docker run -d --name vfc-multivimproxy -e MSB_ADDR=${MSB_IP}:80 nexus3.onap.org:10001/onap/vfc/multivimproxy +RESMGR_IP=`get-instance-ip.sh vfc-multivimproxy` +for i in {1..20}; do + curl -sS ${RESMGR_IP}:8486 && break + echo sleep $i + sleep $i +done + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IP:${MSB_IP} -v RESMGR_IP:${RESMGR_IP}" diff --git a/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/teardown.sh b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/teardown.sh new file mode 100644 index 000000000..c158d1997 --- /dev/null +++ b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/teardown.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright 2018 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. +# + +# This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh msb_internal_apigateway +kill-instance.sh msb_discovery +kill-instance.sh msb_consul +kill-instance.sh vfc-multivimproxy diff --git a/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/testplan.txt b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/testplan.txt new file mode 100644 index 000000000..f81be8ecf --- /dev/null +++ b/test/csit/plans/vfc-nfvo-multivimproxy/sanity-check/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +vfc/nfvo-multivimproxy/test.robot
\ No newline at end of file diff --git a/test/csit/plans/vfc-nfvo-wfengine/sanity-check/testplan.txt b/test/csit/plans/vfc-nfvo-wfengine/sanity-check/testplan.txt index 5f6910bdd..ff9f4d5d6 100644 --- a/test/csit/plans/vfc-nfvo-wfengine/sanity-check/testplan.txt +++ b/test/csit/plans/vfc-nfvo-wfengine/sanity-check/testplan.txt @@ -1,4 +1,4 @@ -# Test suites are relative paths under [integration.git]/test/csit/tests/.
-# Place the suites in run order.
-
+# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. + vfc/nfvo-wfengine/workflow.robot
\ No newline at end of file diff --git a/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh index 7e777a133..22d9acddc 100644 --- a/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh +++ b/test/csit/plans/vnfsdk-ice/sanity-check/setup.sh @@ -18,7 +18,7 @@ #Start ice server -docker run --rm --name vnfsdk-ice -d -p 5000:5000 onap/vnfsdk/ice +docker run --name vnfsdk-ice -d -p 5000:5000 nexus3.onap.org:10001/onap/vnfsdk/ice:latest # Wait for server initialization echo Wait for vnfsdk-ice initialization diff --git a/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap b/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap index d3e391cde..0f9e7494d 100644 --- a/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap +++ b/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap @@ -247,9 +247,15 @@ timeout = 3600 # # From conductor # +music_new_version = True # Base URL for Music REST API without a trailing slash. (string value) server_url = http://localhost:8080/MUSIC/rest/v2 +version = v2 +music_version = "2.4.22" +aafuser = conductor +aafpass = c0nduct0r +aafns = conductor # DEPRECATED: List of hostnames (round-robin access) (list value) # This option is deprecated for removal. diff --git a/test/csit/scripts/optf-has/has/has_script.sh b/test/csit/scripts/optf-has/has/has_script.sh index 242f5f63e..ed0f48838 100755 --- a/test/csit/scripts/optf-has/has/has_script.sh +++ b/test/csit/scripts/optf-has/has/has_script.sh @@ -53,21 +53,26 @@ sed -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/prop AAISIM_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' aaisim` echo "AAISIM_IP=${AAISIM_IP}" -# change MUSIC reference to the local instance +# change AAI reference to the local instance sed -i -e "s%localhost:8081/%${AAISIM_IP}:8081/%g" /tmp/conductor/properties/conductor.conf +#onboard conductor into music +curl -vvvvv --noproxy "*" --request POST http://${MUSIC_IP}:8080/MUSIC/rest/v2/admin/onboardAppWithMusic -H "Content-Type: application/json" --data @${WORKSPACE}/test/csit/tests/optf-has/has/data/onboard.json + docker run -d --name cond-cont -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf +sleep 2 docker run -d --name cond-api -p "8091:8091" -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf +sleep 2 docker run -d --name cond-solv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf +sleep 2 docker run -d --name cond-resv -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf +sleep 2 docker run -d --name cond-data -v ${COND_CONF}:/usr/local/bin/conductor.conf -v ${LOG_CONF}:/usr/local/bin/log.conf -v ${CERT}:/usr/local/bin/cert.cer -v ${KEY}:/usr/local/bin/cert.key -v ${BUNDLE}:/usr/local/bin/cert.pem ${IMAGE_NAME}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf +sleep 2 COND_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' cond-api` ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${COND_IP} 8091 -# wait a while before continuing -sleep 5 - echo "inspect docker things for tracing purpose" docker inspect cond-data docker inspect cond-cont @@ -75,6 +80,7 @@ docker inspect cond-api docker inspect cond-solv docker inspect cond-resv -docker exec -it music-db /usr/bin/nodetool status -docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' -docker exec -it music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' +echo "dump music content just after conductor is started" +docker exec music-db /usr/bin/nodetool status +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' diff --git a/test/csit/scripts/optf-has/has/has_teardown_script.sh b/test/csit/scripts/optf-has/has/has_teardown_script.sh index 40a536a87..bef28b435 100755 --- a/test/csit/scripts/optf-has/has/has_teardown_script.sh +++ b/test/csit/scripts/optf-has/has/has_teardown_script.sh @@ -14,6 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # +echo "print meaningful data before scratching everything" +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM conductor.plans' + echo "optf/has scripts docker containers killing"; docker stop cond-api docker stop cond-solv diff --git a/test/csit/scripts/optf-has/has/music_script.sh b/test/csit/scripts/optf-has/has/music_script.sh index be4eb8c63..fdd9a3e26 100755 --- a/test/csit/scripts/optf-has/has/music_script.sh +++ b/test/csit/scripts/optf-has/has/music_script.sh @@ -47,15 +47,22 @@ docker network create music-net; # Start Cassandra docker run -d --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG}; +#CASSA_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-db` +CASSA_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-db` +echo "CASSANDRA_IP=${CASSA_IP}" +${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042 # Start Music war docker run -d --name music-war -v music-vol:/app ${MUSIC_IMG}; # Start Zookeeper docker run -d --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG}; +#ZOO_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-zk` +ZOO_IP=`docker inspect -f '{{ $network := index .NetworkSettings.Networks "music-net" }}{{ $network.IPAddress}}' music-zk` +echo "ZOOKEEPER_IP=${ZOO_IP}" -# Delay for Cassandra -sleep 20; +# Delay between Cassandra/Zookeeper and Tomcat +sleep 60; # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. docker run -d --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/logs:/opt/app/music/logs ${TOMCAT_IMG}; @@ -67,19 +74,13 @@ docker network connect bridge music-tomcat; # add here below the start of all docker containers needed for music CSIT testing # -CASSA_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-db` -echo "CASSANDRA_IP=${CASSA_IP}" - -ZOO_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-zk` -echo "ZOOKEEPER_IP=${ZOO_IP}" - -${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${CASSA_IP} 9042 - TOMCAT_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` echo "TOMCAT_IP=${TOMCAT_IP}" ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${TOMCAT_IP} 8080 +# wait a while to make sure music is totally up and configured +sleep 10 echo "inspect docker things for tracing purpose" docker inspect music-db @@ -89,8 +90,10 @@ docker inspect music-war docker volume inspect music-vol docker network inspect music-net - - +echo "dump music content just after music is started" +docker exec music-db /usr/bin/nodetool status +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM system_schema.keyspaces' +docker exec music-db /usr/bin/cqlsh -unelson24 -pwinman123 -e 'SELECT * FROM admin.keyspace_master' diff --git a/test/csit/scripts/optf-has/has/music_teardown_script.sh b/test/csit/scripts/optf-has/has/music_teardown_script.sh index fa91f6e97..605ebd4e8 100755 --- a/test/csit/scripts/optf-has/has/music_teardown_script.sh +++ b/test/csit/scripts/optf-has/has/music_teardown_script.sh @@ -34,6 +34,6 @@ echo "dump music.log files" ls -alF /tmp/music ls -alF /tmp/music/properties cat /tmp/music/properties/music.properties -cat /tmp/music/logs/MUSIC/music.log +#cat /tmp/music/logs/MUSIC/music.log cat /tmp/music/logs/MUSIC/error.log diff --git a/test/csit/scripts/optf-has/has/simulator_script.sh b/test/csit/scripts/optf-has/has/simulator_script.sh index 524728270..e5bc43dbe 100755 --- a/test/csit/scripts/optf-has/has/simulator_script.sh +++ b/test/csit/scripts/optf-has/has/simulator_script.sh @@ -59,7 +59,7 @@ echo "AAISIM_IP=${AAISIM_IP}" ${WORKSPACE}/test/csit/scripts/optf-has/has/wait_for_port.sh ${AAISIM_IP} 8081 # wait a while before continuing -sleep 5 +sleep 2 echo "inspect docker things for tracing purpose" docker inspect aaisim diff --git a/test/csit/scripts/policy/script1.sh b/test/csit/scripts/policy/script1.sh index cfa29ec6f..a09fa5f24 100755 --- a/test/csit/scripts/policy/script1.sh +++ b/test/csit/scripts/policy/script1.sh @@ -105,8 +105,6 @@ fi docker ps -#sleep 4m - POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` echo ${POLICY_IP} @@ -125,11 +123,26 @@ echo ${NEXUS_IP} MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` echo ${MARIADB_IP} +sleep 1m + +netstat -tnl + +docker logs mariadb ${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 + +docker logs pap ${DIR}/wait_for_port.sh ${PAP_IP} 9091 + +docker logs pdp ${DIR}/wait_for_port.sh ${PDP_IP} 8081 + +docker logs brmsgw ${DIR}/wait_for_port.sh ${BRMS_IP} 9989 + +docker logs nexus ${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 + +docker logs drools ${DIR}/wait_for_port.sh ${POLICY_IP} 6969 TIME_OUT=600 diff --git a/test/csit/tests/aaf/aaf-sms-suite/__init__.robot b/test/csit/tests/aaf/aaf-sms-suite/__init__.robot new file mode 100644 index 000000000..d1da7f385 --- /dev/null +++ b/test/csit/tests/aaf/aaf-sms-suite/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Integration - Suite 1
\ No newline at end of file diff --git a/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot b/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot new file mode 100644 index 000000000..1302abc79 --- /dev/null +++ b/test/csit/tests/aaf/aaf-sms-suite/aaf-sms-test.robot @@ -0,0 +1,94 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library json + +*** Variables *** +${MESSAGE} {"ping": "ok"} + +#global variables +${generatedAID} + +*** Test Cases *** +SMS Check SMS API Docker Container + [Documentation] Checks if SMS docker container is running + ${rc} ${output}= Run and Return RC and Output docker ps + Log To Console ********************* + Log To Console retrurn_code = ${rc} + Log To Console output = ${output} + Should Be Equal As Integers ${rc} 0 + Should Contain ${output} nexus3.onap.org:10001/onap/aaf/sms + +SMS GetStatus + [Documentation] Gets Backend Status + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request SMS /v1/sms/status headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +SMS CreateDomain + [Documentation] Creates a Secret Domain to hold Secrets + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + ${data} Get Binary File ${CURDIR}${/}data${/}create_domain.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request SMS /v1/sms/domain data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 201 + +SMS CreateSecret + [Documentation] Create A Secret within the Domain + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + ${data} Get Binary File ${CURDIR}${/}data${/}create_secret.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request SMS /v1/sms/domain/curltestdomain/secret data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 201 + +SMS ListSecret + [Documentation] Lists all Secret Names within Domain + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request SMS /v1/sms/domain/curltestdomain/secret headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +SMS GetSecret + [Documentation] Gets a single Secret with Values from Domain + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request SMS /v1/sms/domain/curltestdomain/secret/curltestsecret1 headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +SMS DeleteSecret + [Documentation] Deletes a Secret referenced by Name from Domain + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Delete Request SMS /v1/sms/domain/curltestdomain/secret/curltestsecret1 headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 204 + +SMS DeleteDomain + [Documentation] Deletes a Domain referenced by Name + Create Session SMS ${SMS_HOSTNAME}:${SMS_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Delete Request SMS /v1/sms/domain/curltestdomain headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 204 + +*** Keywords *** diff --git a/test/csit/tests/aaf/aaf-sms-suite/data/create_domain.json b/test/csit/tests/aaf/aaf-sms-suite/data/create_domain.json new file mode 100644 index 000000000..176f44431 --- /dev/null +++ b/test/csit/tests/aaf/aaf-sms-suite/data/create_domain.json @@ -0,0 +1,3 @@ +{ + "name": "curltestdomain" +} diff --git a/test/csit/tests/aaf/aaf-sms-suite/data/create_secret.json b/test/csit/tests/aaf/aaf-sms-suite/data/create_secret.json new file mode 100644 index 000000000..d99f4e2e0 --- /dev/null +++ b/test/csit/tests/aaf/aaf-sms-suite/data/create_secret.json @@ -0,0 +1,12 @@ +{ + "name": "curltestsecret1", + "values": { + "name":"rah", + "age":35, + "map":{ + "mapkey1": "mapvalue1", + "mapkey2": "mapvalue2" + }, + "array":["golang","c++","java","python"] + } +} diff --git a/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py b/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py index 63e4e8c6b..db59557db 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DMaaP.py @@ -1,423 +1,423 @@ -'''
-Created on Aug 15, 2017
-
-@author: sw6830
-'''
-import os
-import posixpath
-import BaseHTTPServer
-import urllib
-import urlparse
-import cgi, sys, shutil, mimetypes
-from jsonschema import validate
-import jsonschema, json
-import DcaeVariables
-import SimpleHTTPServer
-from robot.api import logger
-
-
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
-
-EvtSchema = None
-DMaaPHttpd = None
-
-
-def cleanUpEvent():
- sz = DcaeVariables.VESEventQ.qsize()
- for i in range(sz):
- try:
- self.evtQueue.get_nowait()
- except:
- pass
-
-def enqueEvent(evt):
- if DcaeVariables.VESEventQ != None:
- try:
- DcaeVariables.VESEventQ.put(evt)
- if DcaeVariables.IsRobotRun:
- logger.console("DMaaP Event enqued - size=" + str(len(evt)))
- else:
- print ("DMaaP Event enqueued - size=" + str(len(evt)))
- return True
- except Exception as e:
- print (str(e))
- return False
- return False
-
-def dequeEvent(waitSec=25):
- if DcaeVariables.IsRobotRun:
- logger.console("Enter DequeEvent")
- try:
- evt = DcaeVariables.VESEventQ.get(True, waitSec)
- if DcaeVariables.IsRobotRun:
- logger.console("DMaaP Event dequeued - size=" + str(len(evt)))
- else:
- print("DMaaP Event dequeued - size=" + str(len(evt)))
- return evt
- except Exception as e:
- if DcaeVariables.IsRobotRun:
- logger.console(str(e))
- logger.console("DMaaP Event dequeue timeout")
- else:
- print("DMaaP Event dequeue timeout")
- return None
-
-class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler):
-
- def do_PUT(self):
- self.send_response(405)
- return
-
- def do_POST(self):
-
- respCode = 0
- # Parse the form data posted
- '''
- form = cgi.FieldStorage(
- fp=self.rfile,
- headers=self.headers,
- environ={'REQUEST_METHOD':'POST',
- 'CONTENT_TYPE':self.headers['Content-Type'],
- })
-
-
- form = cgi.FieldStorage(
- fp=self.rfile,
- headers=self.headers,
- environ={"REQUEST_METHOD": "POST"})
-
- for item in form.list:
- print "%s=%s" % (item.name, item.value)
-
- '''
-
- if 'POST' not in self.requestline:
- respCode = 405
-
- '''
- if respCode == 0:
- if '/eventlistener/v5' not in self.requestline and '/eventlistener/v5/eventBatch' not in self.requestline and \
- '/eventlistener/v5/clientThrottlingState' not in self.requestline:
- respCode = 404
-
-
- if respCode == 0:
- if 'Y29uc29sZTpaakprWWpsbE1qbGpNVEkyTTJJeg==' not in str(self.headers):
- respCode = 401
- '''
-
- if respCode == 0:
- content_len = int(self.headers.getheader('content-length', 0))
- post_body = self.rfile.read(content_len)
-
- if DcaeVariables.IsRobotRun:
- logger.console("\n" + "DMaaP Receive Event:\n" + post_body)
- else:
- print("\n" + "DMaaP Receive Event:")
- print (post_body)
-
- indx = post_body.index("{")
- if indx != 0:
- post_body = post_body[indx:]
-
- if enqueEvent(post_body) == False:
- print "enque event fails"
-
- global EvtSchema
- try:
- if EvtSchema == None:
- with open(DcaeVariables.CommonEventSchemaV5) as file:
- EvtSchema = json.load(file)
- decoded_body = json.loads(post_body)
- jsonschema.validate(decoded_body, EvtSchema)
- except:
- respCode = 400
-
- # Begin the response
- if DcaeVariables.IsRobotRun == False:
- print ("Response Message:")
-
- '''
- {
- "200" : {
- "description" : "Success",
- "schema" : {
- "$ref" : "#/definitions/DR_Pub"
- }
- }
-
- rspStr = "{'responses' : {'200' : {'description' : 'Success'}}}"
- rspStr1 = "{'count': 1, 'serverTimeMs': 3}"
-
- '''
-
- if respCode == 0:
- if 'clientThrottlingState' in self.requestline:
- self.send_response(204)
- else:
- self.send_response(200)
- self.send_header('Content-Type', 'application/json')
- self.end_headers()
- #self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}")
- self.wfile.write("{'count': 1, 'serverTimeMs': 3}")
- self.wfile.close()
- else:
- self.send_response(respCode)
-
- '''
- self.end_headers()
- self.wfile.write('Client: %s\n' % str(self.client_address))
- self.wfile.write('User-agent: %s\n' % str(self.headers['user-agent']))
- self.wfile.write('Path: %s\n' % self.path)
- self.wfile.write('Form data:\n')
- self.wfile.close()
-
- # Echo back information about what was posted in the form
- for field in form.keys():
- field_item = form[field]
- if field_item.filename:
- # The field contains an uploaded file
- file_data = field_item.file.read()
- file_len = len(file_data)
- del file_data
- self.wfile.write('\tUploaded %s as "%s" (%d bytes)\n' % \
- (field, field_item.filename, file_len))
- else:
- # Regular form value
- self.wfile.write('\t%s=%s\n' % (field, form[field].value))
- '''
- return
-
-
- def do_GET(self):
- """Serve a GET request."""
- f = self.send_head()
- if f:
- try:
- self.copyfile(f, self.wfile)
- finally:
- f.close()
-
- def do_HEAD(self):
- """Serve a HEAD request."""
- f = self.send_head()
- if f:
- f.close()
-
- def send_head(self):
- """Common code for GET and HEAD commands.
-
- This sends the response code and MIME headers.
-
- Return value is either a file object (which has to be copied
- to the outputfile by the caller unless the command was HEAD,
- and must be closed by the caller under all circumstances), or
- None, in which case the caller has nothing further to do.
-
- """
- path = self.translate_path(self.path)
- f = None
- if os.path.isdir(path):
- parts = urlparse.urlsplit(self.path)
- if not parts.path.endswith('/'):
- # redirect browser - doing basically what apache does
- self.send_response(301)
- new_parts = (parts[0], parts[1], parts[2] + '/',
- parts[3], parts[4])
- new_url = urlparse.urlunsplit(new_parts)
- self.send_header("Location", new_url)
- self.end_headers()
- return None
- for index in "index.html", "index.htm":
- index = os.path.join(path, index)
- if os.path.exists(index):
- path = index
- break
- else:
- return self.list_directory(path)
- ctype = self.guess_type(path)
- try:
- # Always read in binary mode. Opening files in text mode may cause
- # newline translations, making the actual size of the content
- # transmitted *less* than the content-length!
- f = open(path, 'rb')
- except IOError:
- self.send_error(404, "File not found")
- return None
- try:
- self.send_response(200)
- self.send_header("Content-type", ctype)
- fs = os.fstat(f.fileno())
- self.send_header("Content-Length", str(fs[6]))
- self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
- self.end_headers()
- return f
- except:
- f.close()
- raise
-
- def list_directory(self, path):
- """Helper to produce a directory listing (absent index.html).
-
- Return value is either a file object, or None (indicating an
- error). In either case, the headers are sent, making the
- interface the same as for send_head().
-
- """
- try:
- list = os.listdir(path)
- except os.error:
- self.send_error(404, "No permission to list directory")
- return None
- list.sort(key=lambda a: a.lower())
- f = StringIO()
- displaypath = cgi.escape(urllib.unquote(self.path))
- f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
- f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)
- f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath)
- f.write("<hr>\n<ul>\n")
- for name in list:
- fullname = os.path.join(path, name)
- displayname = linkname = name
- # Append / for directories or @ for symbolic links
- if os.path.isdir(fullname):
- displayname = name + "/"
- linkname = name + "/"
- if os.path.islink(fullname):
- displayname = name + "@"
- # Note: a link to a directory displays with @ and links with /
- f.write('<li><a href="%s">%s</a>\n'
- % (urllib.quote(linkname), cgi.escape(displayname)))
- f.write("</ul>\n<hr>\n</body>\n</html>\n")
- length = f.tell()
- f.seek(0)
- self.send_response(200)
- encoding = sys.getfilesystemencoding()
- self.send_header("Content-type", "text/html; charset=%s" % encoding)
- self.send_header("Content-Length", str(length))
- self.end_headers()
- return f
-
- def translate_path(self, path):
- """Translate a /-separated PATH to the local filename syntax.
-
- Components that mean special things to the local file system
- (e.g. drive or directory names) are ignored. (XXX They should
- probably be diagnosed.)
-
- """
- # abandon query parameters
- path = path.split('?',1)[0]
- path = path.split('#',1)[0]
- # Don't forget explicit trailing slash when normalizing. Issue17324
- trailing_slash = path.rstrip().endswith('/')
- path = posixpath.normpath(urllib.unquote(path))
- words = path.split('/')
- words = filter(None, words)
- path = os.getcwd()
- for word in words:
- if os.path.dirname(word) or word in (os.curdir, os.pardir):
- # Ignore components that are not a simple file/directory name
- continue
- path = os.path.join(path, word)
- if trailing_slash:
- path += '/'
- return path
-
- def copyfile(self, source, outputfile):
- """Copy all data between two file objects.
-
- The SOURCE argument is a file object open for reading
- (or anything with a read() method) and the DESTINATION
- argument is a file object open for writing (or
- anything with a write() method).
-
- The only reason for overriding this would be to change
- the block size or perhaps to replace newlines by CRLF
- -- note however that this the default server uses this
- to copy binary data as well.
-
- """
- shutil.copyfileobj(source, outputfile)
-
- def guess_type(self, path):
- """Guess the type of a file.
-
- Argument is a PATH (a filename).
-
- Return value is a string of the form type/subtype,
- usable for a MIME Content-type header.
-
- The default implementation looks the file's extension
- up in the table self.extensions_map, using application/octet-stream
- as a default; however it would be permissible (if
- slow) to look inside the data to make a better guess.
-
- """
-
- base, ext = posixpath.splitext(path)
- if ext in self.extensions_map:
- return self.extensions_map[ext]
- ext = ext.lower()
- if ext in self.extensions_map:
- return self.extensions_map[ext]
- else:
- return self.extensions_map['']
-
- if not mimetypes.inited:
- mimetypes.init() # try to read system mime.types
- extensions_map = mimetypes.types_map.copy()
- extensions_map.update({
- '': 'application/octet-stream', # Default
- '.py': 'text/plain',
- '.c': 'text/plain',
- '.h': 'text/plain',
- })
-
-def test(HandlerClass = DMaaPHandler,
- ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904):
- print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5
- with open(DcaeVariables.CommonEventSchemaV5) as file:
- global EvtSchema
- EvtSchema = json.load(file)
-
- server_address = ('', port)
-
- HandlerClass.protocol_version = protocol
- httpd = ServerClass(server_address, HandlerClass)
-
- global DMaaPHttpd
- DMaaPHttpd = httpd
- DcaeVariables.HTTPD = httpd
-
- sa = httpd.socket.getsockname()
- print "Serving HTTP on", sa[0], "port", sa[1], "..."
- #httpd.serve_forever()
-
-def _main_ (HandlerClass = DMaaPHandler,
- ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"):
-
- if sys.argv[1:]:
- port = int(sys.argv[1])
- else:
- port = 3904
-
- print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5
- with open(DcaeVariables.CommonEventSchemaV5) as file:
- global EvtSchema
- EvtSchema = json.load(file)
-
- server_address = ('', port)
-
- HandlerClass.protocol_version = protocol
- httpd = ServerClass(server_address, HandlerClass)
-
- sa = httpd.socket.getsockname()
- print "Serving HTTP on", sa[0], "port", sa[1], "..."
- httpd.serve_forever()
-
-if __name__ == '__main__':
+''' +Created on Aug 15, 2017 + +@author: sw6830 +''' +import os +import posixpath +import BaseHTTPServer +import urllib +import urlparse +import cgi, sys, shutil, mimetypes +from jsonschema import validate +import jsonschema, json +import DcaeVariables +import SimpleHTTPServer +from robot.api import logger + + +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + +EvtSchema = None +DMaaPHttpd = None + + +def cleanUpEvent(): + sz = DcaeVariables.VESEventQ.qsize() + for i in range(sz): + try: + self.evtQueue.get_nowait() + except: + pass + +def enqueEvent(evt): + if DcaeVariables.VESEventQ != None: + try: + DcaeVariables.VESEventQ.put(evt) + if DcaeVariables.IsRobotRun: + logger.console("DMaaP Event enqued - size=" + str(len(evt))) + else: + print ("DMaaP Event enqueued - size=" + str(len(evt))) + return True + except Exception as e: + print (str(e)) + return False + return False + +def dequeEvent(waitSec=25): + if DcaeVariables.IsRobotRun: + logger.console("Enter DequeEvent") + try: + evt = DcaeVariables.VESEventQ.get(True, waitSec) + if DcaeVariables.IsRobotRun: + logger.console("DMaaP Event dequeued - size=" + str(len(evt))) + else: + print("DMaaP Event dequeued - size=" + str(len(evt))) + return evt + except Exception as e: + if DcaeVariables.IsRobotRun: + logger.console(str(e)) + logger.console("DMaaP Event dequeue timeout") + else: + print("DMaaP Event dequeue timeout") + return None + +class DMaaPHandler(BaseHTTPServer.BaseHTTPRequestHandler): + + def do_PUT(self): + self.send_response(405) + return + + def do_POST(self): + + respCode = 0 + # Parse the form data posted + ''' + form = cgi.FieldStorage( + fp=self.rfile, + headers=self.headers, + environ={'REQUEST_METHOD':'POST', + 'CONTENT_TYPE':self.headers['Content-Type'], + }) + + + form = cgi.FieldStorage( + fp=self.rfile, + headers=self.headers, + environ={"REQUEST_METHOD": "POST"}) + + for item in form.list: + print "%s=%s" % (item.name, item.value) + + ''' + + if 'POST' not in self.requestline: + respCode = 405 + + ''' + if respCode == 0: + if '/eventlistener/v5' not in self.requestline and '/eventlistener/v5/eventBatch' not in self.requestline and \ + '/eventlistener/v5/clientThrottlingState' not in self.requestline: + respCode = 404 + + + if respCode == 0: + if 'Y29uc29sZTpaakprWWpsbE1qbGpNVEkyTTJJeg==' not in str(self.headers): + respCode = 401 + ''' + + if respCode == 0: + content_len = int(self.headers.getheader('content-length', 0)) + post_body = self.rfile.read(content_len) + + if DcaeVariables.IsRobotRun: + logger.console("\n" + "DMaaP Receive Event:\n" + post_body) + else: + print("\n" + "DMaaP Receive Event:") + print (post_body) + + indx = post_body.index("{") + if indx != 0: + post_body = post_body[indx:] + + if enqueEvent(post_body) == False: + print "enque event fails" + + global EvtSchema + try: + if EvtSchema == None: + with open(DcaeVariables.CommonEventSchemaV5) as file: + EvtSchema = json.load(file) + decoded_body = json.loads(post_body) + jsonschema.validate(decoded_body, EvtSchema) + except: + respCode = 400 + + # Begin the response + if DcaeVariables.IsRobotRun == False: + print ("Response Message:") + + ''' + { + "200" : { + "description" : "Success", + "schema" : { + "$ref" : "#/definitions/DR_Pub" + } + } + + rspStr = "{'responses' : {'200' : {'description' : 'Success'}}}" + rspStr1 = "{'count': 1, 'serverTimeMs': 3}" + + ''' + + if respCode == 0: + if 'clientThrottlingState' in self.requestline: + self.send_response(204) + else: + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.end_headers() + #self.wfile.write("{'responses' : {'200' : {'description' : 'Success'}}}") + self.wfile.write("{'count': 1, 'serverTimeMs': 3}") + self.wfile.close() + else: + self.send_response(respCode) + + ''' + self.end_headers() + self.wfile.write('Client: %s\n' % str(self.client_address)) + self.wfile.write('User-agent: %s\n' % str(self.headers['user-agent'])) + self.wfile.write('Path: %s\n' % self.path) + self.wfile.write('Form data:\n') + self.wfile.close() + + # Echo back information about what was posted in the form + for field in form.keys(): + field_item = form[field] + if field_item.filename: + # The field contains an uploaded file + file_data = field_item.file.read() + file_len = len(file_data) + del file_data + self.wfile.write('\tUploaded %s as "%s" (%d bytes)\n' % \ + (field, field_item.filename, file_len)) + else: + # Regular form value + self.wfile.write('\t%s=%s\n' % (field, form[field].value)) + ''' + return + + + def do_GET(self): + """Serve a GET request.""" + f = self.send_head() + if f: + try: + self.copyfile(f, self.wfile) + finally: + f.close() + + def do_HEAD(self): + """Serve a HEAD request.""" + f = self.send_head() + if f: + f.close() + + def send_head(self): + """Common code for GET and HEAD commands. + + This sends the response code and MIME headers. + + Return value is either a file object (which has to be copied + to the outputfile by the caller unless the command was HEAD, + and must be closed by the caller under all circumstances), or + None, in which case the caller has nothing further to do. + + """ + path = self.translate_path(self.path) + f = None + if os.path.isdir(path): + parts = urlparse.urlsplit(self.path) + if not parts.path.endswith('/'): + # redirect browser - doing basically what apache does + self.send_response(301) + new_parts = (parts[0], parts[1], parts[2] + '/', + parts[3], parts[4]) + new_url = urlparse.urlunsplit(new_parts) + self.send_header("Location", new_url) + self.end_headers() + return None + for index in "index.html", "index.htm": + index = os.path.join(path, index) + if os.path.exists(index): + path = index + break + else: + return self.list_directory(path) + ctype = self.guess_type(path) + try: + # Always read in binary mode. Opening files in text mode may cause + # newline translations, making the actual size of the content + # transmitted *less* than the content-length! + f = open(path, 'rb') + except IOError: + self.send_error(404, "File not found") + return None + try: + self.send_response(200) + self.send_header("Content-type", ctype) + fs = os.fstat(f.fileno()) + self.send_header("Content-Length", str(fs[6])) + self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) + self.end_headers() + return f + except: + f.close() + raise + + def list_directory(self, path): + """Helper to produce a directory listing (absent index.html). + + Return value is either a file object, or None (indicating an + error). In either case, the headers are sent, making the + interface the same as for send_head(). + + """ + try: + list = os.listdir(path) + except os.error: + self.send_error(404, "No permission to list directory") + return None + list.sort(key=lambda a: a.lower()) + f = StringIO() + displaypath = cgi.escape(urllib.unquote(self.path)) + f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">') + f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath) + f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath) + f.write("<hr>\n<ul>\n") + for name in list: + fullname = os.path.join(path, name) + displayname = linkname = name + # Append / for directories or @ for symbolic links + if os.path.isdir(fullname): + displayname = name + "/" + linkname = name + "/" + if os.path.islink(fullname): + displayname = name + "@" + # Note: a link to a directory displays with @ and links with / + f.write('<li><a href="%s">%s</a>\n' + % (urllib.quote(linkname), cgi.escape(displayname))) + f.write("</ul>\n<hr>\n</body>\n</html>\n") + length = f.tell() + f.seek(0) + self.send_response(200) + encoding = sys.getfilesystemencoding() + self.send_header("Content-type", "text/html; charset=%s" % encoding) + self.send_header("Content-Length", str(length)) + self.end_headers() + return f + + def translate_path(self, path): + """Translate a /-separated PATH to the local filename syntax. + + Components that mean special things to the local file system + (e.g. drive or directory names) are ignored. (XXX They should + probably be diagnosed.) + + """ + # abandon query parameters + path = path.split('?',1)[0] + path = path.split('#',1)[0] + # Don't forget explicit trailing slash when normalizing. Issue17324 + trailing_slash = path.rstrip().endswith('/') + path = posixpath.normpath(urllib.unquote(path)) + words = path.split('/') + words = filter(None, words) + path = os.getcwd() + for word in words: + if os.path.dirname(word) or word in (os.curdir, os.pardir): + # Ignore components that are not a simple file/directory name + continue + path = os.path.join(path, word) + if trailing_slash: + path += '/' + return path + + def copyfile(self, source, outputfile): + """Copy all data between two file objects. + + The SOURCE argument is a file object open for reading + (or anything with a read() method) and the DESTINATION + argument is a file object open for writing (or + anything with a write() method). + + The only reason for overriding this would be to change + the block size or perhaps to replace newlines by CRLF + -- note however that this the default server uses this + to copy binary data as well. + + """ + shutil.copyfileobj(source, outputfile) + + def guess_type(self, path): + """Guess the type of a file. + + Argument is a PATH (a filename). + + Return value is a string of the form type/subtype, + usable for a MIME Content-type header. + + The default implementation looks the file's extension + up in the table self.extensions_map, using application/octet-stream + as a default; however it would be permissible (if + slow) to look inside the data to make a better guess. + + """ + + base, ext = posixpath.splitext(path) + if ext in self.extensions_map: + return self.extensions_map[ext] + ext = ext.lower() + if ext in self.extensions_map: + return self.extensions_map[ext] + else: + return self.extensions_map[''] + + if not mimetypes.inited: + mimetypes.init() # try to read system mime.types + extensions_map = mimetypes.types_map.copy() + extensions_map.update({ + '': 'application/octet-stream', # Default + '.py': 'text/plain', + '.c': 'text/plain', + '.h': 'text/plain', + }) + +def test(HandlerClass = DMaaPHandler, + ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0", port=3904): + print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5 + with open(DcaeVariables.CommonEventSchemaV5) as file: + global EvtSchema + EvtSchema = json.load(file) + + server_address = ('', port) + + HandlerClass.protocol_version = protocol + httpd = ServerClass(server_address, HandlerClass) + + global DMaaPHttpd + DMaaPHttpd = httpd + DcaeVariables.HTTPD = httpd + + sa = httpd.socket.getsockname() + print "Serving HTTP on", sa[0], "port", sa[1], "..." + #httpd.serve_forever() + +def _main_ (HandlerClass = DMaaPHandler, + ServerClass = BaseHTTPServer.HTTPServer, protocol="HTTP/1.0"): + + if sys.argv[1:]: + port = int(sys.argv[1]) + else: + port = 3904 + + print "Load event schema file: " + DcaeVariables.CommonEventSchemaV5 + with open(DcaeVariables.CommonEventSchemaV5) as file: + global EvtSchema + EvtSchema = json.load(file) + + server_address = ('', port) + + HandlerClass.protocol_version = protocol + httpd = ServerClass(server_address, HandlerClass) + + sa = httpd.socket.getsockname() + print "Serving HTTP on", sa[0], "port", sa[1], "..." + httpd.serve_forever() + +if __name__ == '__main__': _main_()
\ No newline at end of file diff --git a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py index 0242ad7ab..e581f1b2c 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py +++ b/test/csit/tests/dcaegen2/testcases/resources/DcaeLibrary.py @@ -1,159 +1,159 @@ -'''
-Created on Aug 18, 2017
-
-@author: sw6830
-'''
-from robot.api import logger
-from Queue import Queue
-import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko
-import DcaeVariables
-import DMaaP
-
-class DcaeLibrary(object):
-
- def __init__(self):
- pass
-
- def setup_dmaap_server(self, portNum=3904):
- if DcaeVariables.HttpServerThread != None:
- DMaaP.cleanUpEvent()
- logger.console("Clean up event from event queue before test")
- logger.info("DMaaP Server already started")
- return "true"
-
- DcaeVariables.IsRobotRun = True
- DMaaP.test(port=portNum)
- try:
- DcaeVariables.VESEventQ = Queue()
- DcaeVariables.HttpServerThread = threading.Thread(name='DMAAP_HTTPServer', target=DMaaP.DMaaPHttpd.serve_forever)
- DcaeVariables.HttpServerThread.start()
- logger.console("DMaaP Mockup Sever started")
- time.sleep(2)
- return "true"
- except Exception as e:
- print (str(e))
- return "false"
-
- def shutdown_dmaap(self):
- if DcaeVariables.HTTPD != None:
- DcaeVariables.HTTPD.shutdown()
- logger.console("DMaaP Server shut down")
- time.sleep(3)
- return "true"
- else:
- return "false"
-
- def cleanup_ves_events(self):
- if DcaeVariables.HttpServerThread != None:
- DMaaP.cleanUpEvent()
- logger.console("DMaaP event queue is cleaned up")
- 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'):
-
- evtStr = DMaaP.dequeEvent()
- while evtStr != None:
- logger.console("DMaaP receive VES Event:\n" + evtStr)
- if action == 'contain':
- if evtobj in evtStr:
- logger.info("DMaaP Receive Expected Publish Event:\n" + evtStr)
- return 'true'
- if action == 'sizematch':
- if len(evtobj) == len(evtStr):
- return 'true'
- if action == 'dictmatch':
- evtDict = json.loads(evtStr)
- if cmp(evtobj, evtDict) == 0:
- return 'true'
- evtStr = DMaaP.dequeEvent()
- return 'false'
-
- def create_header_from_string(self, dictStr):
- logger.info("Enter create_header_from_string: dictStr")
- return dict(u.split("=") for u in dictStr.split(","))
-
- def is_json_empty(self, resp):
- logger.info("Enter is_json_empty: resp.text: " + resp.text)
- if resp.text == None or len(resp.text) < 2:
- return 'True'
- return 'False'
-
- def Generate_UUID(self):
- """generate a uuid"""
- return uuid.uuid4()
-
- def get_json_value_list(self, jsonstr, keyval):
- logger.info("Enter Get_Json_Key_Value_List")
- if jsonstr == None or len(jsonstr) < 2:
- logger.info("No Json data found")
- return []
- try:
- data = json.loads(jsonstr)
- nodelist = []
- for item in data:
- nodelist.append(item[keyval])
- return nodelist
- except Exception as e:
- logger.info("Json data parsing fails")
- print str(e)
- return []
-
- def generate_MilliTimestamp_UUID(self):
- """generate a millisecond timestamp uuid"""
- then = datetime.datetime.now()
- return int(time.mktime(then.timetuple())*1e3 + then.microsecond/1e3)
-
- def test (self):
- import json
- from pprint import pprint
-
- with open('robot/assets/dcae/ves_volte_single_fault_event.json') as data_file:
- data = json.load(data_file)
-
- data['event']['commonEventHeader']['version'] = '5.0'
- pprint(data)
-
-
-
-if __name__ == '__main__':
- '''
- dictStr = "action=getTable,Accept=application/json,Content-Type=application/json,X-FromAppId=1234908903284"
- cls = DcaeLibrary()
- #dict = cls.create_header_from_string(dictStr)
- #print str(dict)
- jsonStr = "[{'Node': 'onapfcnsl00', 'CheckID': 'serfHealth', 'Name': 'Serf Health Status', 'ServiceName': '', 'Notes': '', 'ModifyIndex': 6, 'Status': 'passing', 'ServiceID': '', 'ServiceTags': [], 'Output': 'Agent alive and reachable', 'CreateIndex': 6}]"
- lsObj = cls.get_json_value_list(jsonStr, 'Status')
- print lsObj
- '''
-
- lib = DcaeLibrary()
- lib.enable_vesc_https_auth()
-
- ret = lib.setup_dmaap_server()
- print ret
- time.sleep(100000)
-
+''' +Created on Aug 18, 2017 + +@author: sw6830 +''' +from robot.api import logger +from Queue import Queue +import uuid, time, datetime,json, threading,os, platform, subprocess,paramiko +import DcaeVariables +import DMaaP + +class DcaeLibrary(object): + + def __init__(self): + pass + + def setup_dmaap_server(self, portNum=3904): + if DcaeVariables.HttpServerThread != None: + DMaaP.cleanUpEvent() + logger.console("Clean up event from event queue before test") + logger.info("DMaaP Server already started") + return "true" + + DcaeVariables.IsRobotRun = True + DMaaP.test(port=portNum) + try: + DcaeVariables.VESEventQ = Queue() + DcaeVariables.HttpServerThread = threading.Thread(name='DMAAP_HTTPServer', target=DMaaP.DMaaPHttpd.serve_forever) + DcaeVariables.HttpServerThread.start() + logger.console("DMaaP Mockup Sever started") + time.sleep(2) + return "true" + except Exception as e: + print (str(e)) + return "false" + + def shutdown_dmaap(self): + if DcaeVariables.HTTPD != None: + DcaeVariables.HTTPD.shutdown() + logger.console("DMaaP Server shut down") + time.sleep(3) + return "true" + else: + return "false" + + def cleanup_ves_events(self): + if DcaeVariables.HttpServerThread != None: + DMaaP.cleanUpEvent() + logger.console("DMaaP event queue is cleaned up") + 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'): + + evtStr = DMaaP.dequeEvent() + while evtStr != None: + logger.console("DMaaP receive VES Event:\n" + evtStr) + if action == 'contain': + if evtobj in evtStr: + logger.info("DMaaP Receive Expected Publish Event:\n" + evtStr) + return 'true' + if action == 'sizematch': + if len(evtobj) == len(evtStr): + return 'true' + if action == 'dictmatch': + evtDict = json.loads(evtStr) + if cmp(evtobj, evtDict) == 0: + return 'true' + evtStr = DMaaP.dequeEvent() + return 'false' + + def create_header_from_string(self, dictStr): + logger.info("Enter create_header_from_string: dictStr") + return dict(u.split("=") for u in dictStr.split(",")) + + def is_json_empty(self, resp): + logger.info("Enter is_json_empty: resp.text: " + resp.text) + if resp.text == None or len(resp.text) < 2: + return 'True' + return 'False' + + def Generate_UUID(self): + """generate a uuid""" + return uuid.uuid4() + + def get_json_value_list(self, jsonstr, keyval): + logger.info("Enter Get_Json_Key_Value_List") + if jsonstr == None or len(jsonstr) < 2: + logger.info("No Json data found") + return [] + try: + data = json.loads(jsonstr) + nodelist = [] + for item in data: + nodelist.append(item[keyval]) + return nodelist + except Exception as e: + logger.info("Json data parsing fails") + print str(e) + return [] + + def generate_MilliTimestamp_UUID(self): + """generate a millisecond timestamp uuid""" + then = datetime.datetime.now() + return int(time.mktime(then.timetuple())*1e3 + then.microsecond/1e3) + + def test (self): + import json + from pprint import pprint + + with open('robot/assets/dcae/ves_volte_single_fault_event.json') as data_file: + data = json.load(data_file) + + data['event']['commonEventHeader']['version'] = '5.0' + pprint(data) + + + +if __name__ == '__main__': + ''' + dictStr = "action=getTable,Accept=application/json,Content-Type=application/json,X-FromAppId=1234908903284" + cls = DcaeLibrary() + #dict = cls.create_header_from_string(dictStr) + #print str(dict) + jsonStr = "[{'Node': 'onapfcnsl00', 'CheckID': 'serfHealth', 'Name': 'Serf Health Status', 'ServiceName': '', 'Notes': '', 'ModifyIndex': 6, 'Status': 'passing', 'ServiceID': '', 'ServiceTags': [], 'Output': 'Agent alive and reachable', 'CreateIndex': 6}]" + lsObj = cls.get_json_value_list(jsonStr, 'Status') + print lsObj + ''' + + lib = DcaeLibrary() + lib.enable_vesc_https_auth() + + ret = lib.setup_dmaap_server() + print ret + time.sleep(100000) + diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot index 59d44e158..98b341529 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -1,133 +1,133 @@ - *** 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
-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
- #Log Creating session ${GLOBAL_DCAE_CONSUL_URL}
- ${session}= Create Session dcae ${GLOBAL_DCAE_CONSUL_URL}
- ${uuid}= Generate UUID
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-Consul-Token=abcd1234 X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
- ${resp}= Get Request dcae /v1/catalog/nodes headers=${headers}
- Log Received response from dcae consul: ${resp.json()}
- Should Be Equal As Strings ${resp.status_code} 200
- ${NodeList}= Get Json Value List ${resp.text} Node
- ${NodeListLength}= Get Length ${NodeList}
- ${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}
- ${session}= Create Session dcae-${NodeName} ${GLOBAL_DCAE_CONSUL_URL}
- ${uuid}= Generate UUID
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-Consul-Token=abcd1234 X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
- ${hcpath}= Catenate SEPARATOR= /v1/health/node/ ${NodeName}
- ${resp}= Get Request dcae-${NodeName} ${hcpath} headers=${headers}
- Log Received response from dcae consul: ${resp.json()}
- Should Be Equal As Strings ${resp.status_code} 200
- ${StatusList}= Get Json Value List ${resp.text} Status
- ${len}= Get Length ${StatusList}
- 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
- \ Append To List ${columns} ${colName}
- # Process each row making sure status=GREEN
- :for ${row} in @{rows}
- \ ${cells}= Get From Dictionary ${row} cells
- \ ${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}
- :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}
- ${auth}= Create List ${usr} ${passwd}
- ${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 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 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}
- ${auth}= Create List ${user} ${pd}
- Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url} auth=${auth}
- ${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}
- Log Creating session ${url}
- ${session}= Create Session dcae-d1 ${url}
- ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
- #Log Received response from dcae ${resp.json()}
- [return] ${resp}
+ *** 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 +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 + #Log Creating session ${GLOBAL_DCAE_CONSUL_URL} + ${session}= Create Session dcae ${GLOBAL_DCAE_CONSUL_URL} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-Consul-Token=abcd1234 X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Get Request dcae /v1/catalog/nodes headers=${headers} + Log Received response from dcae consul: ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${NodeList}= Get Json Value List ${resp.text} Node + ${NodeListLength}= Get Length ${NodeList} + ${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} + ${session}= Create Session dcae-${NodeName} ${GLOBAL_DCAE_CONSUL_URL} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-Consul-Token=abcd1234 X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${hcpath}= Catenate SEPARATOR= /v1/health/node/ ${NodeName} + ${resp}= Get Request dcae-${NodeName} ${hcpath} headers=${headers} + Log Received response from dcae consul: ${resp.json()} + Should Be Equal As Strings ${resp.status_code} 200 + ${StatusList}= Get Json Value List ${resp.text} Status + ${len}= Get Length ${StatusList} + 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 + \ Append To List ${columns} ${colName} + # Process each row making sure status=GREEN + :for ${row} in @{rows} + \ ${cells}= Get From Dictionary ${row} cells + \ ${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} + :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} + ${auth}= Create List ${usr} ${passwd} + ${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 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 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} + ${auth}= Create List ${user} ${pd} + Log Creating session ${url} + ${session}= Create Session dcae-d1 ${url} auth=${auth} + ${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} + Log Creating session ${url} + ${session}= Create Session dcae-d1 ${url} + ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + #Log Received response from dcae ${resp.json()} + [return] ${resp} diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot index be072d73c..692488814 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_properties.robot @@ -1,15 +1,15 @@ -Documentation store all properties that can change or are used in multiple places here
-... format is all caps with underscores between words and prepended with GLOBAL
-... make sure you prepend them with GLOBAL so that other files can easily see it is from this file.
-
-
-
-*** Variables ***
-${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
+Documentation store all properties that can change or are used in multiple places here +... format is all caps with underscores between words and prepended with GLOBAL +... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. + + + +*** Variables *** +${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/multicloud-vmware/hosts/sanity-host.robot b/test/csit/tests/multicloud-vmware/hosts/sanity-host.robot new file mode 100644 index 000000000..e74a79973 --- /dev/null +++ b/test/csit/tests/multicloud-vmware/hosts/sanity-host.robot @@ -0,0 +1,24 @@ +*** settings *** +Resource ../../common.robot +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library HttpLibrary.HTTP + + +*** Variables *** +@{return_ok_list}= 200 201 202 + + +*** Test Cases *** + +TestGetHost + [Documentation] Sanity Test - Get Host + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/1234/hosts/1 + ${response_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${response_code} + ${response_json} json.loads ${resp.content} + #Log To Console ${response_json} diff --git a/test/csit/tests/multicloud-vmware/images/sanity-image.robot b/test/csit/tests/multicloud-vmware/images/sanity-image.robot new file mode 100644 index 000000000..390433d5c --- /dev/null +++ b/test/csit/tests/multicloud-vmware/images/sanity-image.robot @@ -0,0 +1,24 @@ +*** settings *** +Resource ../../common.robot +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library HttpLibrary.HTTP + + +*** Variables *** +@{return_ok_list}= 200 201 202 + + +*** Test Cases *** + +TestGetHost + [Documentation] Sanity Test - Get Image + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/1234/images/1 + ${response_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${response_code} + ${response_json} json.loads ${resp.content} + #Log To Console ${response_json} diff --git a/test/csit/tests/multicloud-vmware/networks/sanity-network.robot b/test/csit/tests/multicloud-vmware/networks/sanity-network.robot new file mode 100644 index 000000000..5433f18cb --- /dev/null +++ b/test/csit/tests/multicloud-vmware/networks/sanity-network.robot @@ -0,0 +1,24 @@ +*** settings *** +Resource ../../common.robot +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library HttpLibrary.HTTP + + +*** Variables *** +@{return_ok_list}= 200 201 202 + + +*** Test Cases *** + +TestGetHost + [Documentation] Sanity Test - Get Network + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= Get Request web_session api/multicloud-vio/v0/vmware_fake/1234/networks/1 + ${response_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${response_code} + ${response_json} json.loads ${resp.content} + #Log To Console ${response_json} diff --git a/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json b/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json new file mode 100644 index 000000000..1e3cac6f5 --- /dev/null +++ b/test/csit/tests/multicloud-vmware/provision/jsoninput/image_file.json @@ -0,0 +1,7 @@ +{ + "name": "cirros-0.3.2-x86_64-disk", + "container_format": "bare", + "disk_format": "qcow2", + "visibility": "public", + "schema": "/v2/schemas/image" +}
\ No newline at end of file diff --git a/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot b/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot index 0a6f2f5e8..e8e36dc14 100644 --- a/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot +++ b/test/csit/tests/multicloud-vmware/provision/sanity_test_image.robot @@ -13,10 +13,13 @@ Library HttpLibrary.HTTP ${get_token_url} /api/multicloud-vio/v0/vmware_fake/identity/v3/auth/tokens ${get_image_url} /api/multicloud-vio/v0/vmware_fake/glance/v2/images ${get_image_schema_url} /api/multicloud-vio/v0/vmware_fake/glance/v2/schemas/image +${image_service} /api/multicloud-vio/v0/vmware_fake/glance/v2/image/file + #json files ${auth_info_json} ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/auth_info.json +${image_file} ${SCRIPTS}/../tests/multicloud-vmware/provision/jsoninput/image_file.json #global vars ${TOKEN} @@ -42,7 +45,7 @@ GetAuthToken -TestCaseShoeImageSchema +TestCaseShowImageSchema [Documentation] Sanity test - Show Image Schema ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN} Create Session web_session http://${VIO_IP}:9004 headers=${headers} @@ -76,3 +79,32 @@ TestCaseShowImage List Should Contain Value ${return_ok_list} ${responese_code} ${response_json} json.loads ${resp.content} Should Be Equal ${response_json['status']} active + + + + +TestCaseUploadImage + [Documentation] Sanity test - Upload Image + ${json_value}= json_from_file ${image_file} + ${json_string}= string_from_json ${json_value} + ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN} + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= POST Request web_session ${image_service} ${json_string} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${IMAGEID}= Convert To String ${response_json['id']} + Set Global Variable ${IMAGEID} + + + + +TestCaseDownloadImage + [Documentation] Sanity test - Download Image + ${headers} Create Dictionary Content-Type=application/json Accept=application/json X-Auth-Token=${TOKEN} + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= Get Request web_session ${image_service}/${IMAGEID} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + Should Be Equal ${response_json['status']} active
\ No newline at end of file diff --git a/test/csit/tests/multicloud-vmware/samples/sanity-sample.robot b/test/csit/tests/multicloud-vmware/samples/sanity-sample.robot new file mode 100644 index 000000000..fcb784b27 --- /dev/null +++ b/test/csit/tests/multicloud-vmware/samples/sanity-sample.robot @@ -0,0 +1,25 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +@{return_ok_list}= 200 201 202 +${querysample_vio_url} /samples + +*** Test Cases *** +VioSwaggerTest + [Documentation] query swagger info rest test + ${headers} Create Dictionary Content-Type=application/json X-TRANSACTIONID=123456 Accept=application/json + Create Session web_session http://${VIO_IP}:9004 headers=${headers} + ${resp}= Get Request web_session ${querysample_vio_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + # verify logging output + ${response_json} json.loads ${resp.content} + ${logs}= Convert To String ${response_json['logs']} + Log To Console ${logs} + Should Contain ${logs} 123456 + Should Contain ${logs} multicloud-vio + Should Contain ${logs} vio.samples.views
\ No newline at end of file diff --git a/test/csit/tests/multicloud/provision/data/capacity.json b/test/csit/tests/multicloud/provision/data/capacity.json new file mode 100644 index 000000000..9b1130d08 --- /dev/null +++ b/test/csit/tests/multicloud/provision/data/capacity.json @@ -0,0 +1,6 @@ +{ + "vCPU": 1, + "Memory": 1, + "Storage": 1, + "VIMs": ["vmware_fake"] +}
\ No newline at end of file diff --git a/test/csit/tests/multicloud/provision/sanity_test_multivim.robot b/test/csit/tests/multicloud/provision/sanity_test_multivim.robot index 2c1ec3f9f..4848b7459 100644 --- a/test/csit/tests/multicloud/provision/sanity_test_multivim.robot +++ b/test/csit/tests/multicloud/provision/sanity_test_multivim.robot @@ -1,4 +1,5 @@ *** settings *** +Resource ../../common.robot Library Collections Library RequestsLibrary Library OperatingSystem @@ -7,6 +8,7 @@ Library json *** Variables *** @{return_ok_list}= 200 201 202 ${queryswagger_broker_url} /api/multicloud/v0/swagger.json +${check_capacity_broker_url} /api/multicloud/v0/check_vim_capacity *** Test Cases *** @@ -20,3 +22,12 @@ BrokerSwaggerTest ${response_json} json.loads ${resp.content} ${swagger_version}= Convert To String ${response_json['swagger']} Should Be Equal ${swagger_version} 2.0 + +BrokerCapacityTest + [Documentation] Check VIMs capacity + ${data}= Get Binary File ${CURDIR}${/}data${/}capacity.json + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${BROKER_IP}:9001 headers=${headers} + ${resp}= Post Request web_session ${check_capacity_broker_url} ${data} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} diff --git a/test/csit/tests/music/music-distributed-kv-store-suite/__init__.robot b/test/csit/tests/music/music-distributed-kv-store-suite/__init__.robot new file mode 100644 index 000000000..d1da7f385 --- /dev/null +++ b/test/csit/tests/music/music-distributed-kv-store-suite/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Integration - Suite 1
\ No newline at end of file diff --git a/test/csit/tests/music/music-distributed-kv-store-suite/data/register_domain.json b/test/csit/tests/music/music-distributed-kv-store-suite/data/register_domain.json new file mode 100644 index 000000000..96811ee97 --- /dev/null +++ b/test/csit/tests/music/music-distributed-kv-store-suite/data/register_domain.json @@ -0,0 +1,3 @@ +{ + "domain":"test_domain" +}
\ No newline at end of file diff --git a/test/csit/tests/music/music-distributed-kv-store-suite/music-distributed-kv-store-test.robot b/test/csit/tests/music/music-distributed-kv-store-suite/music-distributed-kv-store-test.robot new file mode 100644 index 000000000..de26e5f6e --- /dev/null +++ b/test/csit/tests/music/music-distributed-kv-store-suite/music-distributed-kv-store-test.robot @@ -0,0 +1,53 @@ +*** Settings *** +Library OperatingSystem +Library RequestsLibrary +Library json + +*** Variables *** +${MESSAGE} {"ping": "ok"} + +#global variables +${generatedAID} + +*** Test Cases *** +DKV Check Distributed KV Store API Docker Container + [Documentation] Checks if DKV docker container is running + ${rc} ${output}= Run and Return RC and Output docker ps + Log To Console ********************* + Log To Console retrurn_code = ${rc} + Log To Console output = ${output} + Should Be Equal As Integers ${rc} 0 + Should Contain ${output} nexus3.onap.org:10001/onap/music/distributed-kv-store + +DKV LoadDefaultProperties + [Documentation] Loads default configuration files into Consul + Create Session dkv ${DKV_HOSTNAME}:${DKV_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request dkv /v1/config/load-default headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +DKV FetchDefaultProperties + [Documentation] Fetches all default keys from Consul + Create Session dkv ${DKV_HOSTNAME}:${DKV_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request dkv /v1/getconfigs headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +#DKV RegisterDomain +# [Documentation] Send a POST request to create a domain +# Create Session dkv ${DKV_HOSTNAME}:${DKV_PORT} +# ${data}= Get Binary File ${CURDIR}${/}data${/}register_domain.json +# &{headers}= Create Dictionary Content-Type=application/json Accept=application/json +# ${resp}= Post Request dkv v1/register data=${data} headers=${headers} +# Log To Console ********************* +# Log To Console response = ${resp} +# Log To Console body = ${resp.text} +# Should Be Equal As Integers ${resp.status_code} 200 + +*** Keywords *** diff --git a/test/csit/tests/optf-has/has/data/healthcheck.json b/test/csit/tests/optf-has/has/data/healthcheck.json new file mode 100644 index 000000000..926bb2898 --- /dev/null +++ b/test/csit/tests/optf-has/has/data/healthcheck.json @@ -0,0 +1,19 @@ +{ + "consistencyInfo": { + "type": "eventual" + }, + "values": { + "created": 1479482603641, + "message": "", + "name": "foo", + "recommend_max": 1, + "solution": "{\"healthcheck\": \" healthcheck\"}", + "status": "solved", + "template": "{\"healthcheck\": \"healthcheck\"}", + "timeout": 3600, + "translation": "{\"healthcheck\": \" healthcheck\"}", + "updated": 1484324150629 + } +} + + diff --git a/test/csit/tests/optf-has/has/data/onboard.json b/test/csit/tests/optf-has/has/data/onboard.json new file mode 100644 index 000000000..a4939c459 --- /dev/null +++ b/test/csit/tests/optf-has/has/data/onboard.json @@ -0,0 +1,6 @@ +{ + "appname": "conductor", + "userId": "conductor", + "isAAF": "false", + "password": "c0nduct0r" +} diff --git a/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json new file mode 100644 index 000000000..5e35d6abf --- /dev/null +++ b/test/csit/tests/optf-has/has/data/plan_with_lati_and_longi.json @@ -0,0 +1,41 @@ +{ + "name":"onap template with lati and longi without constraints and without optimizations", + "template":{ + "homing_template_version":"2017-10-10", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":45.395968, + "customer_long":-71.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" + }, + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" + } + } + }, + "demands":{ + "vG":[ + { + "inventory_provider":"aai", + "inventory_type":"cloud" + } + ] + }, + "constraints":{ + + }, + "optimization":{ + + } + } +} + diff --git a/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json new file mode 100644 index 000000000..68a7e119b --- /dev/null +++ b/test/csit/tests/optf-has/has/data/plan_with_short_distance_constraint.json @@ -0,0 +1,64 @@ +{ + "name":"onap template with short distance constraint", + "template":{ + "homing_template_version":"2017-10-10", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":25.395968, + "customer_long":-51.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" + }, + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" + } + } + }, + "demands":{ + "vG":[ + { + "inventory_provider":"aai", + "inventory_type":"cloud" + } + ] + }, + "constraints":{ + "distance-vg":{ + "type":"distance_to_location", + "demands":[ + "vG" + ], + "properties":{ + "distance":"< 1 km", + "location":"customer_loc" + } + } + }, + "optimization":{ + "minimize": { + "sum": [ + { + "distance_between": [ + "customer_loc", + "vG" + ] + }, + { + "distance_between": [ + "customer_loc", + "vG" + ] + } + ] + } + } + } +} diff --git a/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json b/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json new file mode 100644 index 000000000..9f25c2dff --- /dev/null +++ b/test/csit/tests/optf-has/has/data/plan_with_wrong_distance_constraint.json @@ -0,0 +1,63 @@ +{ + "name":"onap template with wrong distance constraint", + "template":{ + "homing_template_version":"2017-10-10", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":45.395968, + "customer_long":-71.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" + }, + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" + } + } + }, + "demands":{ + "vG":[ + { + "inventory_provider":"aai", + "inventory_type":"cloud" + } + ] + }, + "constraints":{ + "distance-vg":{ + "demands":[ + "vG" + ], + "properties":{ + "distance":"< 1 km", + "location":"customer_loc" + } + } + }, + "optimization":{ + "minimize": { + "sum": [ + { + "distance_between": [ + "customer_loc", + "vG" + ] + }, + { + "distance_between": [ + "customer_loc", + "vG" + ] + } + ] + } + } + } +} diff --git a/test/csit/tests/optf-has/has/data/plan_with_wrong_version.json b/test/csit/tests/optf-has/has/data/plan_with_wrong_version.json index 9471fbf82..c0618bfbf 100644 --- a/test/csit/tests/optf-has/has/data/plan_with_wrong_version.json +++ b/test/csit/tests/optf-has/has/data/plan_with_wrong_version.json @@ -1,175 +1,41 @@ { - "name": "onap optf has plan with wrong version", - "template": { - "conductor_template_version": "yyyy-mm-dd", - "parameters": { - "UCPEHOST": "chcil129snd", - "CUSTOMER":"21014aa2-526b-11e6-beb8-9e71128cae77" - }, - "locations": { - "customer_loc": { - "host_name": { - "get_param": "UCPEHOST" - } - } - }, - "demands": { - "vHNPortalaaS_PRIMARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "HNPORTAL", - "customer_id": {"get_param": "CUSTOMER"} + "name":"onap template with wrong version", + "template":{ + "homing_template_version":"xxxx-yy-zz", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":45.395968, + "customer_long":-71.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" }, - { - "inventory_provider": "aai", - "inventory_type": "cloud" - } - ], - "vHNPortalaaS_SECONDARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "HNPORTAL", - "customer_id": {"get_param": "CUSTOMER"} + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" + } + } }, - { - "inventory_provider": "aai", - "inventory_type": "cloud" - } - ], - "vHNGWaaS_PRIMARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "HNGATEWAY", - "customer_id": {"get_param": "CUSTOMER"} + "demands":{ + "vG":[ + { + "inventory_provider":"aai", + "inventory_type":"cloud" + } + ] }, - { - "inventory_provider": "aai", - "inventory_type": "cloud" - } - ], - "vHNGWaaS_SECONDARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "HNGATEWAY", - "customer_id": {"get_param": "CUSTOMER"} + "constraints":{ + }, - { - "inventory_provider": "aai", - "inventory_type": "cloud" - } - ], - "vVIGaaS_PRIMARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "VVIG", - "customer_id": {"get_param": "CUSTOMER"} - } - ], - "vVIGaaS_SECONDARY_1": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "VVIG", - "customer_id": {"get_param": "CUSTOMER"} - } - ], - "vVIGaaS_PRIMARY_2": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "VVIG", - "customer_id": {"get_param": "CUSTOMER"} + "optimization":{ + } - ], - "vVIGaaS_SECONDARY_2": [ - { - "inventory_provider": "aai", - "inventory_type": "service", - "service_type": "VVIG", - "customer_id": {"get_param": "CUSTOMER"} - } - ] - }, - "constraints": { - "distance-vvig": { - "type": "distance_to_location", - "demands": [ - "vVIGaaS_SECONDARY_1", - "vVIGaaS_PRIMARY_1" - ], - "properties": { - "distance": "< 5000 km", - "location": "customer_loc" - } - }, - "distance-vgw": { - "type": "distance_to_location", - "demands": [ - "vHNGWaaS_SECONDARY_1", - "vHNGWaaS_PRIMARY_1" - ], - "properties": { - "distance": "< 5000 km", - "location": "customer_loc" - } - }, - "zone-vhngw": { - "type": "zone", - "demands": [ - "vHNGWaaS_SECONDARY_1", - "vHNGWaaS_PRIMARY_1" - ], - "properties": { - "qualifier": "different", - "category": "complex" - } - }, - "zone-vhnportal": { - "type": "zone", - "demands": [ - "vHNPortalaaS_SECONDARY_1", - "vHNPortalaaS_PRIMARY_1" - ], - "properties": { - "qualifier": "different", - "category": "complex" - } - } - }, - "optimization": { - "minimize": { - "sum": [ - { - "product": [ - 1, - { - "distance_between": [ - "customer_loc", - "vVIGaaS_PRIMARY_1" - ] - } - ] - }, - { - "product": [ - 1, - { - "distance_between": [ - "customer_loc", - "vHNGWaaS_PRIMARY_1" - ] - } - ] - } - ] - } - } -}, - "timeout": 5, - "limit": 3 + } } + diff --git a/test/csit/tests/optf-has/has/data/plan_without_demand_section.json b/test/csit/tests/optf-has/has/data/plan_without_demand_section.json index 87a459d87..fe5d2fa65 100644 --- a/test/csit/tests/optf-has/has/data/plan_without_demand_section.json +++ b/test/csit/tests/optf-has/has/data/plan_without_demand_section.json @@ -1,93 +1,33 @@ { - "name": "onap optf has plan with wrong version", - "template": { - "conductor_template_version": "2016-11-01", - "parameters": { - "UCPEHOST": "chcil129snd", - "CUSTOMER":"21014aa2-526b-11e6-beb8-9e71128cae77" - }, - "locations": { - "customer_loc": { - "host_name": { - "get_param": "UCPEHOST" - } - } - }, - "constraints": { - "distance-vvig": { - "type": "distance_to_location", - "demands": [ - "vVIGaaS_SECONDARY_1", - "vVIGaaS_PRIMARY_1" - ], - "properties": { - "distance": "< 5000 km", - "location": "customer_loc" - } - }, - "distance-vgw": { - "type": "distance_to_location", - "demands": [ - "vHNGWaaS_SECONDARY_1", - "vHNGWaaS_PRIMARY_1" - ], - "properties": { - "distance": "< 5000 km", - "location": "customer_loc" - } - }, - "zone-vhngw": { - "type": "zone", - "demands": [ - "vHNGWaaS_SECONDARY_1", - "vHNGWaaS_PRIMARY_1" - ], - "properties": { - "qualifier": "different", - "category": "complex" - } - }, - "zone-vhnportal": { - "type": "zone", - "demands": [ - "vHNPortalaaS_SECONDARY_1", - "vHNPortalaaS_PRIMARY_1" - ], - "properties": { - "qualifier": "different", - "category": "complex" - } - } - }, - "optimization": { - "minimize": { - "sum": [ - { - "product": [ - 1, - { - "distance_between": [ - "customer_loc", - "vVIGaaS_PRIMARY_1" - ] - } - ] - }, - { - "product": [ - 1, - { - "distance_between": [ - "customer_loc", - "vHNGWaaS_PRIMARY_1" - ] + "name":"onap template without demand section", + "template":{ + "homing_template_version":"2017-10-10", + "parameters":{ + "service_name":"Residential vCPE", + "service_id":"vcpe_service_id", + "customer_lat":45.395968, + "customer_long":-71.135344, + "physical_location":"DLLSTX233", + "REQUIRED_MEM":4, + "REQUIRED_DISK":100, + "pnf_id":"some_pnf_id" + }, + "locations":{ + "customer_loc":{ + "latitude":{ + "get_param":"customer_lat" + }, + "longitude":{ + "get_param":"customer_long" } - ] - } - ] - } - } -}, - "timeout": 5, - "limit": 3 + } + }, + "constraints":{ + + }, + "optimization":{ + + } + } } + diff --git a/test/csit/tests/optf-has/has/optf_has_test.robot b/test/csit/tests/optf-has/has/optf_has_test.robot index 4882c229f..62db10774 100644 --- a/test/csit/tests/optf-has/has/optf_has_test.robot +++ b/test/csit/tests/optf-has/has/optf_has_test.robot @@ -11,6 +11,8 @@ ${RESP_MESSAGE_WITHOUT_DEMANDS} Undefined Demand #global variables ${generatedPlanId} +${generatedAID} +${resultStatus} *** Test Cases *** Check Cassandra Docker Container @@ -114,6 +116,186 @@ Get Root Url Log To Console body = ${resp.text} Should Be Equal As Integers ${resp.status_code} 200 +Conductor AddHealthcheck Row Into Music + [Documentation] It sends a REST PUT request to Music to inject healthcheck plan + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}healthcheck.json + &{headers}= Create Dictionary ns=conductor userId=conductor password=c0nduct0r Content-Type=application/json Accept=application/json + ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows?id=healthcheck data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + Should Be Equal As Integers ${resp.status_code} 200 + Sleep 5s Wait Injection effectiveness + +Healthcheck + [Documentation] It sends a REST GET request to healthcheck url + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/healthcheck headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + +SendPlanWithWrongVersion + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_wrong_version.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 10s Wait Plan Resolution + +GetPlanWithWrongVersion + [Documentation] It sends a REST GET request to capture error + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal error ${resultStatus} + +SendPlanWithoutDemandSection + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_without_demand_section.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 10s Wait Plan Resolution + +GetPlanWithoutDemandSection + [Documentation] It sends a REST GET request to capture error + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal error ${resultStatus} + +SendPlanWithWrongConstraint + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_wrong_distance_constraint.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 10s Wait Plan Resolution + +GetPlanWithWrongConstraint + [Documentation] It sends a REST GET request to capture error + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal error ${resultStatus} + + +SendPlanWithLatiAndLongi + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_lati_and_longi.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 60s Wait Plan Resolution + +GetPlanWithLatiAndLongi + [Documentation] It sends a REST GET request to capture recommendations + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal done ${resultStatus} + +SendPlanWithShortDistanceConstraint + [Documentation] It sends a POST request to conductor + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + ${data}= Get Binary File ${CURDIR}${/}data${/}plan_with_short_distance_constraint.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request optf-cond /v1/plans data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + ${response_json} json.loads ${resp.content} + ${generatedPlanId}= Convert To String ${response_json['id']} + Set Global Variable ${generatedPlanId} + Log To Console generatedPlanId = ${generatedPlanId} + Should Be Equal As Integers ${resp.status_code} 201 + Sleep 60s Wait Plan Resolution + +GetPlanWithShortDistanceConstraint + [Documentation] It sends a REST GET request to capture recommendations + Create Session optf-cond ${COND_HOSTNAME}:${COND_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request optf-cond /v1/plans/${generatedPlanId} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + ${response_json} json.loads ${resp.content} + ${resultStatus}= Convert To String ${response_json['plans'][0]['status']} + Set Global Variable ${resultStatus} + Log To Console resultStatus = ${resultStatus} + Log To Console body = ${resp.text} + Should Be Equal As Integers ${resp.status_code} 200 + Should Be Equal not found ${resultStatus} + + *** Keywords *** diff --git a/test/csit/tests/portal-sdk/testsuites/test1.robot b/test/csit/tests/portal-sdk/testsuites/test1.robot index 84579d017..00714024f 100644 --- a/test/csit/tests/portal-sdk/testsuites/test1.robot +++ b/test/csit/tests/portal-sdk/testsuites/test1.robot @@ -6,15 +6,15 @@ Library XvfbRobot *** Variables *** -${PORTAL_URL} http://portal.api.simpledemo.onap.org:8989 -${PORTAL_ENV} /ONAPPORTAL +${PORTAL_URL} http://portal.api.simpledemo.onap.org:8990 +${PORTAL_ENV} /ONAPPORTALSDK ${PORTAL_LOGIN_URL} ${PORTAL_URL}${PORTAL_ENV}/login.htm -${PORTAL_HOME_PAGE} ${PORTAL_URL}${PORTAL_ENV}/applicationsHome +${PORTAL_HOME_PAGE} ${PORTAL_URL}${PORTAL_ENV}/welcome ${PORTAL_MICRO_ENDPOINT} ${PORTAL_URL}${PORTAL_ENV}/commonWidgets ${PORTAL_HOME_URL} ${PORTAL_URL}${PORTAL_ENV}/applicationsHome ${GLOBAL_APPLICATION_ID} robot-functional ${GLOBAL_PORTAL_ADMIN_USER} demo -${GLOBAL_PORTAL_ADMIN_PWD} demo123456! +${GLOBAL_PORTAL_ADMIN_PWD} demo ${GLOBAL_SELENIUM_BROWSER} chrome ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary ${GLOBAL_SELENIUM_DELAY} 0 @@ -36,115 +36,105 @@ Portal admin Login To Portal GUI Set Selenium Speed ${GLOBAL_SELENIUM_DELAY} Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} Log Logging in to ${PORTAL_URL}${PORTAL_ENV} - # Handle Proxy Warning + # Handle Proxy Warning Title Should Be Login - Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_PORTAL_ADMIN_USER} - Input Password xpath=//input[@ng-model='password'] ${GLOBAL_PORTAL_ADMIN_PWD} - Click Link xpath=//a[@id='loginBtn'] - Wait Until Page Contains Element xpath=//img[@alt='Onap Logo'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Input Text xpath=//input[@id='loginId'] ${GLOBAL_PORTAL_ADMIN_USER} + Input Password xpath=//input[@id='password'] ${GLOBAL_PORTAL_ADMIN_PWD} + Click Element //*[@id="loginBtn"] + Wait Until Page Contains Element xpath=//img[@src='app/fusionapp/icons/logo_onap_transbg.png'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} Log Logged in to ${PORTAL_URL}${PORTAL_ENV} - -Portal Admin Navigation Application Link Tab - [Documentation] Logs into Portal GUI as Portal admin - Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] - Go To ${PORTAL_HOME_PAGE} - Dismiss Alert accept=false - #Scroll Element Into View xpath=//span[@id='tab-Home'] - #Click Element xpath=//span[@id='tab-Home'] +SDKPortalAdmin Navigation Application Link Tab + [Documentation] Logs into Portal GUI as Portal admin + Comment Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] + Comment Go To ${PORTAL_HOME_PAGE} + Comment Dismiss Alert accept=false + #Scroll Element Into View xpath=//span[@id='tab-Home'] + #Click Element xpath=//span[@id='tab-Home'] #Click Element xpath=(//span[@id='tab-xDemo-App']/following::i[@class='ion-close-round'])[1] - Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] - - - -Validate SDK Sub Menu - [Documentation] Logs into SDK GUI as Portal admin - Page Should Contain Home - Page Should Contain Sample Pages - Page Should Contain Reports - Page Should Contain Profile - Page Should Contain Admin - -Click Sample Pages and validate sub Menu - [Documentation] Click Sample Pages - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Sample-Pages'] - Element Text Should Be xpath=//a[@title='Collaboration'] Collaboration - Element Text Should Be xpath=//a[@title='Notebook'] Notebook - Click Link xpath=//a[contains(@title,'Collaboration')] - Page Should Contain User List - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Sample-Pages'] - Click Link xpath=//a[contains(@title,'Notebook')] - Element Text Should Be xpath=//h1[contains(.,'Notebook')] Notebook - -Click Reports and validate sub Menu - [Documentation] Click Reports Tab + Comment Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] + +Validate SDK Sub Menu + [Documentation] Logs into SDK GUI as Portal admin + Page Should Contain Home + Page Should Contain Sample Pages + Page Should Contain Reports + Page Should Contain Profile + Page Should Contain Admin + +#Click Sample Pages and validate sub Menu + #[Documentation] Click Sample Pages + #Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + #Click Link xpath=//a[@id='parent-item-Sample-Pages'] + #Element Text Should Be xpath=//a[@title='Collaboration'] Collaboration + #Element Text Should Be xpath=//a[@title='Notebook'] Notebook + #Click Link xpath=//a[contains(@title,'Collaboration')] + #Page Should Contain User List + #Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + #Click Link xpath=//a[@id='parent-item-Sample-Pages'] + #Click Link xpath=//a[contains(@title,'Notebook')] + #Element Text Should Be xpath=//h1[contains(.,'Notebook')] Notebook + +Click Reports and validate sub Menu + [Documentation] Click Reports Tab #Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Reports'] - Element Text Should Be xpath=//a[@title='All Reports'] All Reports - Element Text Should Be xpath=//a[@title='Create Reports'] Create Reports - Click Link xpath=//a[contains(@title,'All Reports')] - Page Should Contain Report search - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Reports'] - Click Link xpath=//a[contains(@title,'Create Reports')] - Page Should Contain Report Wizard - -Click Profile and validate sub Menu - [Documentation] Click Profile Tab - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Profile'] - Element Text Should Be xpath=//a[@title='Search'] Search - Element Text Should Be xpath=//a[@title='Self'] Self - Click Link xpath=//a[contains(@title,'Search')] - Page Should Contain Profile Search - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Profile'] - Click Link xpath=//a[contains(@title,'Self')] - Page Should Contain Self Profile Detail - - -Click Admin and validate sub Menu - [Documentation] Click Admin Tab - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Admin'] - Element Text Should Be xpath=//a[@title='Roles'] Roles - Element Text Should Be xpath=//a[@title='Role Functions'] Role Functions - Element Text Should Be xpath=//a[@title='Cache Admin'] Cache Admin - Element Text Should Be xpath=//a[@title='Menus'] Menus - Element Text Should Be xpath=//a[@title='Usage'] Usage - Click Link xpath=//a[contains(@title,'Roles')] - Page Should Contain Roles - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Admin'] - Click Link xpath=//a[contains(@title,'Role Function')] - Page Should Contain Role Function - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=.//a[@id='parent-item-Admin'] - #Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Admin'] - Click Link xpath=//a[contains(@title,'Cache Admin')] - Page Should Contain Cache Regions - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=.//a[@id='parent-item-Admin'] - Click Link xpath=//a[@id='parent-item-Admin'] - Click Link xpath=//a[contains(@title,'Menus')] - Page Should Contain Admin Menu Items - Select frame xpath=.//*[@id='tabframe-xDemo-App'] - Click Link xpath=//a[@id='parent-item-Admin'] - Click Link xpath=//a[@id='parent-item-Admin'] - Click Link xpath=//a[contains(@title,'Usage')] - Page Should Contain Current Usage - - -Teardown - [Documentation] Close All Open browsers - Close All Browsers - + Click Link xpath=//a[@id='parent-item-Reports'] + Element Text Should Be xpath=//a[@title='All Reports'] All Reports + Element Text Should Be xpath=//a[@title='Create Reports'] Create Reports + Click Link xpath=//a[contains(@title,'All Reports')] + Page Should Contain Report search + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Reports'] + Click Link xpath=//a[contains(@title,'Create Reports')] + Page Should Contain Report Wizard + +Click Profile and validate sub Menu + [Documentation] Click Profile Tab + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Profile'] + Element Text Should Be xpath=//a[@title='Search'] Search + Element Text Should Be xpath=//a[@title='Self'] Self + Click Link xpath=//a[contains(@title,'Search')] + Page Should Contain Profile Search + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Profile'] + Click Link xpath=//a[contains(@title,'Self')] + Page Should Contain Self Profile Detail - +Click Admin and validate sub Menu + [Documentation] Click Admin Tab + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Admin'] + Element Text Should Be xpath=//a[@title='Roles'] Roles + Element Text Should Be xpath=//a[@title='Role Functions'] Role Functions + Element Text Should Be xpath=//a[@title='Cache Admin'] Cache Admin + Element Text Should Be xpath=//a[@title='Menus'] Menus + Element Text Should Be xpath=//a[@title='Usage'] Usage + Click Link xpath=//a[contains(@title,'Roles')] + Page Should Contain Roles + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Admin'] + Click Link xpath=//a[contains(@title,'Role Function')] + Page Should Contain Role Function + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=.//a[@id='parent-item-Admin'] + #Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Admin'] + Click Link xpath=//a[contains(@title,'Cache Admin')] + Page Should Contain Cache Regions + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=.//a[@id='parent-item-Admin'] + Click Link xpath=//a[@id='parent-item-Admin'] + Click Link xpath=//a[contains(@title,'Menus')] + Page Should Contain Admin Menu Items + Comment Select frame xpath=.//*[@id='tabframe-xDemo-App'] + Click Link xpath=//a[@id='parent-item-Admin'] + Click Link xpath=//a[@id='parent-item-Admin'] + Click Link xpath=//a[contains(@title,'Usage')] + Page Should Contain Current Usage - +Teardown + [Documentation] Close All Open browsers + Close All Browsers *** Keywords *** diff --git a/test/csit/tests/portal/testsuites/test1.robot b/test/csit/tests/portal/testsuites/test1.robot index bbbe5172f..90aa10788 100644 --- a/test/csit/tests/portal/testsuites/test1.robot +++ b/test/csit/tests/portal/testsuites/test1.robot @@ -62,6 +62,7 @@ ${jira} jira ${RESOURCE_PATH} ONAPPORTAL/auxapi/ticketevent ${portal_Template} ${CURDIR}/portal.template +${Result} FALSE *** Test Cases *** @@ -72,133 +73,128 @@ Portal Health Check Login into Portal URL Portal admin Login To Portal GUI -Portal R1 Release - [Documentation] ONAP Portal R1 functionality test - Notification on ONAP Portal - Portal Application Account Management validation +# Portal R1 Release + # [Documentation] ONAP Portal R1 functionality test + # Notification on ONAP Portal + # Portal Application Account Management validation Portal R1 Release for AAF [Documentation] ONAP Portal R1 functionality for AAF test Portal AAF new fields -Create Microse service onboarding - Portal admin Microservice Onboarding +#Create Microse service onboarding + #Portal admin Microservice Onboarding +#Delete Microse service + #Portal admin Microservice Delete -Create Widget for all users - Portal Admin Create Widget for All users - -Delete Widget for all users - Portal Admin Delete Widget for All users - -Create Widget for Application Roles - Portal Admin Create Widget for Application Roles - -Delete Widget for Application Roles - Portal Admin Delete Widget for Application Roles +#Create Widget for all users + #Portal Admin Create Widget for All users + +# Delete Widget for all users + # Portal Admin Delete Widget for All users + +#Create Widget for Application Roles + #Portal Admin Create Widget for Application Roles + +#Delete Widget for Application Roles + #Portal Admin Delete Widget for Application Roles -Validate Functional Top Menu Get Access - Functional Top Menu Get Access +#Validate Functional Top Menu Get Access + #Functional Top Menu Get Access -Validate Functional Top Menu Contact Us - Functional Top Menu Contact Us +#Validate Functional Top Menu Contact Us + #Functional Top Menu Contact Us -Edit Functional Menu - Portal admin Edit Functional menu +#Edit Functional Menu + #Portal admin Edit Functional menu -Broadbond Notification functionality - ${AdminBroadCastMsg}= Portal Admin Broadcast Notifications - set global variable ${AdminBroadCastMsg} +# Broadbond Notification functionality + # ${AdminBroadCastMsg}= Portal Admin Broadcast Notifications + # set global variable ${AdminBroadCastMsg} - -Category Notification functionality - ${AdminCategoryMsg}= Portal Admin Category Notifications - set global variable ${AdminCategoryMsg} - -Create a Test user for Application Admin -Test - Portal admin Add Application admin User New user -Test +# Category Notification functionality + # ${AdminCategoryMsg}= Portal Admin Category Notifications + # set global variable ${AdminCategoryMsg} + +#Create a Test user for Application Admin -Test + #Portal admin Add Application admin User New user -Test -Create a Test User for Apllication Admin - Portal admin Add Application admin User New user +#Create a Test User for Apllication Admin + #Portal admin Add Application admin User New user -Add Application Admin for Existing User Test user - Portal admin Add Application Admin Exiting User -APPDEMO +#Add Application Admin for Existing User Test user + #Portal admin Add Application Admin Exiting User -APPDEMO -Create a Test user for Standared User - Portal admin Add Standard User New user +#Create a Test user for Standared User + #Portal admin Add Standard User New user -Add Application Admin for Exisitng User - Portal admin Add Application Admin Exiting User +#Add Application Admin for Exisitng User + #Portal admin Add Application Admin Exiting User -Delete Application Admin for Exisitng User - Portal admin Delete Application Admin Existing User +#Delete Application Admin for Exisitng User + #Portal admin Delete Application Admin Existing User -Add Standard User Role for Existing user - Portal admin Add Standard User Existing user +# Add Standard User Role for Existing user + # Portal admin Add Standard User Existing user -Edit Standard User Role for Existing user - Portal admin Edit Standard User Existing user +# Edit Standard User Role for Existing user + # Portal admin Edit Standard User Existing user -Delete Standard User Role for Existing user - Portal admin Delete Standard User Existing user - - - - +#Delete Standard User Role for Existing user + #Portal admin Delete Standard User Existing user + Logout from Portal GUI as Portal Admin Portal admin Logout from Portal GUI - -Login To Portal GUI as APP Admin - Application admin Login To Portal GUI - - +# Application Admin user Test cases + +#Login To Portal GUI as APP Admin + #Application admin Login To Portal GUI + ##Navigate Functional Link as APP Admin ## Application Admin Navigation Functional Menu -Add Standard User Role for Existing user as APP Admin - Application admin Add Standard User Existing user +# Add Standard User Role for Existing user as APP Admin + # Application admin Add Standard User Existing user -Edit Standard User Role for Existing user as APP Admin - Application admin Edit Standard User Existing user +# Edit Standard User Role for Existing user as APP Admin + # Application admin Edit Standard User Existing user -Delete Standard User Role for Existing user as APP Admin - Application admin Delete Standard User Existing user +# Delete Standard User Role for Existing user as APP Admin + # Application admin Delete Standard User Existing user -#Navigate Application Link as APP Admin -# Application Admin Navigation Application Link Tab +# #Navigate Application Link as APP Admin +# # Application Admin Navigation Application Link Tab -Logout from Portal GUI as APP Admin - Application admin Logout from Portal GUI +#Logout from Portal GUI as APP Admin + #Application admin Logout from Portal GUI +#Standard User Test cases -Login To Portal GUI as Standared User - Standared user Login To Portal GUI +#Login To Portal GUI as Standared User + #Standared user Login To Portal GUI #Navigate Application Link as Standared User # Standared user Navigation Application Link Tab ##Navigate Functional Link as Standared User ## Standared user Navigation Functional Menu + -Broadcast Notifications Standared user - Standared user Broadcast Notifications ${AdminBroadCastMsg} +# Broadcast Notifications Standared user + # Standared user Broadcast Notifications ${AdminBroadCastMsg} -Category Notifications Standared user - Standared user Category Notifications ${AdminCategoryMsg} +# Category Notifications Standared user + # Standared user Category Notifications ${AdminCategoryMsg} Teardown [Documentation] Close All Open browsers Close All Browsers - - - - - *** Keywords *** Setup Browser @@ -296,6 +292,8 @@ Portal admin Add Application Admin Exiting User Click Button xpath=//input[@value='Select application'] Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'xDemo App' )])[1] Click Element xpath=(//li[contains(.,'xDemo App' )])[2] +# Scroll Element Into View xpath=(//input[@value='Select application']/following::*[contains(text(),'Default' )])[1] +# Click Element xpath=(//li[contains(.,'Default' )])[2] #Select From List xpath=(//input[@value='Select application']/following::*[contains(text(),'xDemo App')])[1] xDemo App Click Button xpath=//button[@id='div-updateAdminAppsRoles'] Click Element xpath=//button[@id='admin-div-ok-button'] @@ -303,6 +301,7 @@ Portal admin Add Application Admin Exiting User Get Selenium Implicit Wait Click Link xpath=//a[@aria-label='Admins'] Click Element xpath=//input[@id='dropdown1'] +# Click Element xpath=//li[contains(.,'Default' )] Click Element xpath=//li[contains(.,'xDemo App' )] Input Text xpath=//input[@id='input-table-search'] ${Existing_User} Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${Existing_User} @@ -312,9 +311,16 @@ Portal admin Add Application Admin Exiting User Portal admin Delete Application Admin Existing User [Documentation] Naviage to Admins tab + Wait Until Element Is Visible xpath=//a[@title='Admins'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Click Link xpath=//a[@title='Admins'] + Wait Until Element Is Visible xpath=//h1[contains(.,'Admins')] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Page Should Contain Admins + Click Button xpath=//button[@ng-click='toggleSidebar()'] + Input Text xpath=//input[@id='input-table-search'] ${Existing_User} Click Element xpath=(//span[contains(.,'portal')] )[1] #Click Element xpath=(//span[contains(.,'demo')] )[1] Click Element xpath=//*[@id='select-app-xDemo-App']/following::i[@id='i-delete-application'] +# Click Element xpath=//*[@id='select-app-Default']/following::i[@id='i-delete-application'] Click Element xpath=//button[@id='div-confirm-ok-button'] Click Button xpath=//button[@id='div-updateAdminAppsRoles'] Click Element xpath=//button[@id='admin-div-ok-button'] @@ -340,6 +346,21 @@ Portal admin Add Application admin User New user Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwd'] ${App_Loginpwd} Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwdCheck'] ${App_LoginPwdCheck} Click Button xpath=//button[@ng-click='searchUsers.addNewUserFun()'] + + ${Result}= Get Matching XPath Count xpath=//*[contains(text(),'User with same loginId already exists')] + + #log ${Result} + #${type_result}= Evaluate type(${Result}) + #log ${type_result} + + Run Keyword if '${Result}'== 0 AdminUser does not exist already + ... ELSE Goto Home Image + Set Selenium Implicit Wait 3000 + +Goto Home Image + Click Image xpath=//img[@alt='Onap Logo'] + +AdminUser does not exist already Click Button xpath=//button[@id='next-button'] #Scroll Element Into View xpath=//div[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] @@ -372,6 +393,18 @@ Portal admin Add Standard User New user Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwd'] ${Sta_Loginpwd} Input Text xpath=//input[@ng-model='searchUsers.newUser.loginPwdCheck'] ${Sta_LoginPwdCheck} Click Button xpath=//button[@ng-click='searchUsers.addNewUserFun()'] + + ${Result}= Get Matching XPath Count xpath=//*[contains(text(),'User with same loginId already exists')] + + #log ${Result} + #${type_result}= Evaluate type(${Result}) + #log ${type_result} + + Run Keyword if '${Result}'== 0 StaUser does not exist already + ... ELSE Goto Home Image + Set Selenium Implicit Wait 3000 + +StaUser does not exist already Click Button xpath=//button[@id='next-button'] #Scroll Element Into View xpath=//div[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] @@ -455,13 +488,7 @@ Portal admin Add Application Admin Exiting User -APPDEMO Table Column Should Contain xpath=//*[@table-data='admins.adminsTableData'] 1 ${App_First_Name} Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 - - - - - - - + Portal admin Add Standard User Existing user [Documentation] Naviage to Users tab Click Link xpath=//a[@title='Users'] @@ -472,10 +499,10 @@ Portal admin Add Standard User Existing user Click Button xpath=//button[@id='button-search-users'] Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='next-button'] - Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - #Click Element xpath=//div[@id='div-app-name-dropdown-xDemo-App'] - #Click Element xpath=//div[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] +# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] + Click Element xpath=//div[@id='div-app-name-dropdown-xDemo-App'] + Click Element xpath=//div[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] Set Selenium Implicit Wait 3000 Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 @@ -487,19 +514,24 @@ Portal admin Add Standard User Existing user Go To ${PORTAL_HOME_PAGE} Click Link xpath=//a[@title='Users'] Click Element xpath=//input[@id='dropdown1'] - Click Element xpath=//li[contains(.,'xDemo App')] - #Click Element xpath=//li[contains(.,'XDemo App')] +# Click Element xpath=//li[contains(.,'Default')] + Click Element xpath=//li[contains(.,'XDemo App')] Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User - - - + Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] Standard User + Set Selenium Implicit Wait 3000 + Portal admin Edit Standard User Existing user [Documentation] Naviage to Users tab Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='System-Administrator-checkbox'] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Portal-Notification-Admin-checkbox'] +# Click Element xpath=//*[@id='div-app-name-dropdown-SDC'] +# Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Standard-User-checkbox'] +# Click Element xpath=//*[@id='div-app-name-SDC']/following::input[@id='Portal-Notification-Admin-checkbox'] Set Selenium Implicit Wait 3000 Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 @@ -508,22 +540,24 @@ Portal admin Edit Standard User Existing user #Click Element xpath=//li[contains(.,'xDemo App')] Input Text xpath=//input[@id='input-table-search'] ${Existing_User} Element Text Should Be xpath=(.//*[@id='rowheader_t1_0'])[2] System Administrator - + Set Selenium Implicit Wait 3000 Portal admin Delete Standard User Existing user [Documentation] Naviage to Users tab Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] +# Scroll Element Into View xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-SDC']/following::*[@id='app-item-delete'][1] Click Element xpath=//button[@id='div-confirm-ok-button'] Click Button xpath=//button[@id='new-user-save-button'] #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] - Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] portal - #Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] demo - - - + #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] + Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal + #Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] demo + Set Selenium Implicit Wait 3000 Functional Top Menu Get Access [Documentation] Naviage to Support tab @@ -531,7 +565,7 @@ Functional Top Menu Get Access Mouse Over xpath=//*[contains(text(),'Get Access')] Click Link xpath=//a[contains(.,'Get Access')] Element Text Should Be xpath=//h1[contains(.,'Get Access')] Get Access - + Set Selenium Implicit Wait 3000 Functional Top Menu Contact Us [Documentation] Naviage to Support tab @@ -540,7 +574,7 @@ Functional Top Menu Contact Us Click Link xpath=//a[contains(.,'Contact Us')] Element Text Should Be xpath=//h1[contains(.,'Contact Us')] Contact Us Click Image xpath=//img[@alt='Onap Logo'] - + Set Selenium Implicit Wait 3000 Portal admin Edit Functional menu [Documentation] Naviage to Edit Functional menu tab @@ -583,7 +617,7 @@ Portal admin Edit Functional menu Mouse Over xpath=//*[contains(text(),'Design')] Set Selenium Implicit Wait 3000 Element Should Not Contain xpath=(.//*[contains(.,'Design')]/following::ul[1])[1] ONAP Test - + Set Selenium Implicit Wait 3000 Portal admin Microservice Onboarding @@ -605,11 +639,32 @@ Portal admin Microservice Onboarding Click Button xpath=//button[@id='microservice-details-save-button'] Table Column Should Contain xpath=//*[@table-data='serviceList'] 1 Test Microservice #Element Text Should Be xpath=//*[@table-data='serviceList'] Test Microservice - - - + Set Selenium Implicit Wait 3000 + +Portal admin Microservice Delete + [Documentation] Naviage to Edit Functional menu tab + Click Link xpath=//a[@title='Microservice Onboarding'] + Click Button xpath=//button[@id='microservice-onboarding-button-add'] + Input Text xpath=//input[@name='name'] TestMS + Input Text xpath=//*[@name='desc'] TestMS + Click Element xpath=//input[@id='microservice-details-input-app'] + Scroll Element Into View xpath=//li[contains(.,'xDemo App')] + Click Element xpath=//li[contains(.,'xDemo App')] + Click Element xpath=//*[@name='desc'] + Input Text xpath=//input[@name='url'] ${PORTAL_MICRO_ENDPOINT} + Click Element xpath=//input[@id='microservice-details-input-security-type'] + Scroll Element Into View xpath=//li[contains(.,'Basic Authentication')] + Click Element xpath=//li[contains(.,'Basic Authentication')] + Input Text xpath=//input[@name='username'] ${GLOBAL_PORTAL_ADMIN_USER} + Input Text xpath=//input[@name='password'] ${GLOBAL_PORTAL_ADMIN_PWD} + Click Button xpath=//button[@id='microservice-details-save-button'] + Table Column Should Contain xpath=//*[@table-data='serviceList'] 1 TestMS + Click Element xpath=(.//*[contains(text(),'TestMS')]/following::*[@ng-click='microserviceOnboarding.deleteService(rowData)'])[1] + Click Button xpath=//button[@id="div-confirm-ok-button"] + Set Selenium Implicit Wait 3000 + Portal Admin Create Widget for All users - [Documentation] Naviage to Create Widget menu tab + [Documentation] Navigate to Create Widget menu tab ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}//news_widget.zip Click Link xpath=//a[@title='Widget Onboarding'] Click Button xpath=//button[@ng-click='toggleSidebar()'] @@ -647,7 +702,6 @@ Portal Admin Delete Widget for All users #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo #Set Selenium Implicit Wait 3000 - Portal Admin Create Widget for Application Roles [Documentation] Naviage to Create Widget menu tab ${WidgetAttachment}= Catenate ${PORTAL_ASSETS_DIRECTORY}//news_widget.zip @@ -677,10 +731,7 @@ Portal Admin Create Widget for Application Roles Page Should Contain ONAP-xDemo Set Selenium Implicit Wait 3000 GO TO ${PORTAL_HOME_PAGE} - - - - + Portal Admin Delete Widget for Application Roles #Wait Until Page Contains ONAP-xDemo ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} #Page Should Contain ONAP-xDemo @@ -698,7 +749,7 @@ Portal Admin Delete Widget for Application Roles Element Should Not Contain xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] ONAP-xDemo #Is Element Visible xpath=//*[@table-data='portalAdmin.portalAdminsTableData'] #Table Column Should Contain .//*[@table-data='portalAdmin.portalAdminsTableData'] 0 ONAP-xDemo - #Set Selenium Implicit Wait 3000 + Set Selenium Implicit Wait 3000 @@ -720,15 +771,14 @@ Portal Admin Edit Widget Click Element xpath=//div[@id='confirmation-button-next'] Element Should Not Contain xpath=//*[@table-data='ignoredTableData'] ONAP_VID Click Link xpath=//a[@id='close-button'] - - - + Set Selenium Implicit Wait 3000 Portal Admin Broadcast Notifications [Documentation] Portal Test Admin Broadcast Notifications - ${CurrentDay}= Get Current Date result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y - ${CurrentDate}= Get Current Date result_format=%m%d%y%H%M + + ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y + ${CurrentDate}= Get Current Date increment=24:00:00 result_format=%m%d%y%H%M ${AdminBroadCastMsg}= catenate ONAP VID Broadcast Automation${CurrentDate} Click Image xpath=//img[@alt='Onap Logo'] Set Selenium Implicit Wait 3000 @@ -744,15 +794,17 @@ Portal Admin Broadcast Notifications click element xpath=//*[@id="megamenu-notification-button"] click element xpath=//*[@id="notification-history-link"] Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 - Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminBroadCastMsg} + Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminBroadCastMsg} + Set Selenium Implicit Wait 3000 log ${AdminBroadCastMsg} [Return] ${AdminBroadCastMsg} Portal Admin Category Notifications [Documentation] Portal Admin Broadcast Notifications - ${CurrentDay}= Get Current Date result_format=%m/%d/%Y - ${NextDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y - ${CurrentDate}= Get Current Date result_format=%m%d%y%H%M + ${CurrentDay}= Get Current Date increment=24:00:00 result_format=%m/%d/%Y + ${NextDay}= Get Current Date increment=48:00:00 result_format=%m/%d/%Y +# ${CurrentDay}= Get Current Date result_format=%m/%d/%Y + ${CurrentDate}= Get Current Date increment=24:00:00 result_format=%m%d%y%H%M ${AdminCategoryMsg}= catenate ONAP VID Category Automation${CurrentDate} Click Link xpath=//a[@id='parent-item-Home'] Click Link xpath=//*[@id="parent-item-User-Notifications"] @@ -772,9 +824,10 @@ Portal Admin Category Notifications click element xpath=//*[@id="megamenu-notification-button"] click element xpath=//*[@id="notification-history-link"] Wait until Element is visible xpath=//*[@id="notification-history-table"] timeout=10 - Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminCategoryMsg} + Table Column Should Contain xpath=//*[@id="notification-history-table"] 2 ${AdminCategoryMsg} + Set Selenium Implicit Wait 3000 log ${AdminCategoryMsg} - [Return] ${AdminCategoryMsg} + [Return] ${AdminCategoryMsg} Portal admin Logout from Portal GUI @@ -834,6 +887,7 @@ Application admin Add Standard User Existing user Click Element xpath=//span[@id='result-uuid-0'] Click Button xpath=//button[@id='next-button'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] + Set Selenium Implicit Wait 3000 Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] Set Selenium Implicit Wait 3000 Click Button xpath=//button[@id='new-user-save-button'] @@ -854,9 +908,12 @@ Application admin Add Standard User Existing user Application admin Edit Standard User Existing user [Documentation] Naviage to Users tab Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Click Element xpath=//*[@id='div-app-name-dropdown-Default'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Standard-User-checkbox'] +# Click Element xpath=//*[@id='div-app-name-Default']/following::input[@id='Portal-Notification-Admin-checkbox'] Click Element xpath=//*[@id='div-app-name-dropdown-xDemo-App'] Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Standard-User-checkbox'] - Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='System-Administrator-checkbox'] + Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::input[@id='Portal-Notification-Admin-checkbox'] Set Selenium Implicit Wait 3000 Click Button xpath=//button[@id='new-user-save-button'] Set Selenium Implicit Wait 3000 @@ -870,15 +927,17 @@ Application admin Edit Standard User Existing user Application admin Delete Standard User Existing user [Documentation] Naviage to Users tab Click Element xpath=(.//*[@id='rowheader_t1_0'])[2] +# Scroll Element Into View xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] +# Click Element xpath=//*[@id='div-app-name-Default']/following::*[@id='app-item-delete'][1] Scroll Element Into View xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] Click Element xpath=//*[@id='div-app-name-xDemo-App']/following::*[@id='app-item-delete'][1] Click Element xpath=//button[@id='div-confirm-ok-button'] Click Button xpath=//button[@id='new-user-save-button'] - #Input Text xpath=//input[@id='input-table-search'] ${Existing_User} - #Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] +# Input Text xpath=//input[@id='input-table-search'] ${Existing_User} +# Is Element Visible xpath=(//*[contains(.,'Portal')] )[2] Element Should Not Contain xpath=//*[@table-data='users.accountUsers'] Portal #Click Image xpath=//img[@alt='Onap Logo'] - #Set Selenium Implicit Wait 3000 + Set Selenium Implicit Wait 3000 @@ -918,16 +977,16 @@ Standared user Navigation Application Link Tab Click Element xpath=.//h3[contains(text(),'xDemo App')]/following::div[1] Page Should Contain ONAP Portal Click Element xpath=(.//span[@id='tab-Home'])[1] - + Set Selenium Implicit Wait 3000 Standared user Navigation Functional Menu [Documentation] Logs into Portal GUI as application admin Click Link xpath=//a[contains(.,'Manage')] - Mouse Over xpath=//*[contains(text(),'Technology Insertion')] - Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] - Page Should Contain Welcome to VID - Click Element xpath=(.//span[@id='tab-Home'])[1] - + Mouse Over xpath=//*[contains(text(),'Technology Insertion')] + Click Link xpath= //*[contains(text(),'Infrastructure VNF Provisioning')] + Page Should Contain Welcome to VID + Click Element xpath=(.//span[@id='tab-Home'])[1] + Set Selenium Implicit Wait 3000 Standared user Broadcast Notifications diff --git a/test/csit/tests/vfc/nfvo-multivimproxy/test.robot b/test/csit/tests/vfc/nfvo-multivimproxy/test.robot new file mode 100644 index 000000000..fab3694e4 --- /dev/null +++ b/test/csit/tests/vfc/nfvo-multivimproxy/test.robot @@ -0,0 +1,24 @@ +*** settings *** +Resource ../../common.robot +Library Collections +Library RequestsLibrary +Library simplejson +Library OperatingSystem +Library json +Library HttpLibrary.HTTP + +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_url} /api/multivimproxy/v1/swagger.json + +*** Test Cases *** +SwaggerFuncTest + [Documentation] query swagger info rest test + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${RESMGR_IP}:8481 headers=${headers} + ${resp}= Get Request web_session ${queryswagger_url} + ${responese_code}= Convert To String ${resp.status_code} + 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
\ No newline at end of file diff --git a/test/csit/tests/vfc/nfvo-wfengine/workflow.robot b/test/csit/tests/vfc/nfvo-wfengine/workflow.robot index 07bfe6979..c9dbe6c46 100644 --- a/test/csit/tests/vfc/nfvo-wfengine/workflow.robot +++ b/test/csit/tests/vfc/nfvo-wfengine/workflow.robot @@ -1,113 +1,113 @@ -*** Settings ***
-Resource ../../common.robot
-Library Collections
-Library json
-Library OperatingSystem
-Library RequestsLibrary
-Library HttpLibrary.HTTP
-
-*** Variables ***
-${MSB_IP} 127.0.0.1
-${MSB_PORT} 10550
-${ACTIVITI_IP} 127.0.0.1
-${ACTIVITI_PORT} 8804
-${MGRSERVICE_IP} 127.0.0.1
-${MGRSERVICE_PORT} 8805
-${processId} demo
-${deployid} 0
-${bmpfilepath} ${SCRIPTS}/nfvo-wfengine/demo.bpmn20.xml
-
-*** Test Cases ***
-Deploy BPMN File Test On Activiti
- [Documentation] Check if the test bpmn file can be deployed in activiti engine
- ${auth}= Create List kermit kermit
- ${headers}= Create Dictionary Accept=application/json
- Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth}
- ${files}= evaluate {"file":open('${bmpfilepath}','rb')}
- ${resp}= Post Request web_session /activiti-rest/service/repository/deployments files=${files}
- Should Be Equal ${resp.status_code} ${201}
- Log ${resp.json()}
- ${deployedId}= Set Variable ${resp.json()["id"]}
- Set Global Variable ${deployedId}
-
-Exectue BPMN File Testt On Activiti
- [Documentation] Check if the test bpmn file can be exectued in activiti engine
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA==
- Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers}
- ${body} Create Dictionary processDefinitionKey=${processId}
- ${body} dumps ${body}
- ${resp}= Post Request web_session /activiti-rest/service/runtime/process-instances ${body}
- Should Be Equal ${resp.status_code} ${201}
-
-UnDeploy BPMN File Testt On Activiti
- [Documentation] Check if the test bpmn file can be undeployed in activiti engine
- log ${deployedId}
- ${auth}= Create List kermit kermit
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json
- Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth}
- ${resp}= Delete Request web_session /activiti-rest/service/repository/deployments/${deployedId}?cascade=true
- Should Be Equal ${resp.status_code} ${204}
-
-Deploy BPMN File Test On MgrService
- [Documentation] Check if the test bpmn file can be deployed in Management Service
- ${auth}= Create List kermit kermit
- ${headers}= Create Dictionary Accept=application/json
- Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth}
- ${files}= evaluate {"file":open('${bmpfilepath}','rb')}
- ${resp}= Post Request web_session api/workflow/v1/package files=${files}
- Should Be Equal ${resp.status_code} ${200}
- Log ${resp.json()}
- ${deployedId}= Set Variable ${resp.json()["deployedId"]}
- Set Global Variable ${deployedId}
-
-Exectue BPMN File Testt On MgrService
- [Documentation] Check if the test bpmn file can be exectued in Management Service
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA==
- Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers}
- ${body} Create Dictionary processDefinitionKey=${processId}
- ${body} dumps ${body}
- ${resp}= Post Request web_session api/workflow/v1/process/instance ${body}
- Should Be Equal ${resp.status_code} ${200}
- Log ${resp.json()}
- Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId}
-
-UnDeploy BPMN File Testt On MgrService
- [Documentation] Check if the test bpmn file can be undeployed in Management Service
- log ${deployedId}
- ${auth}= Create List kermit kermit
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json
- Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth}
- ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId}
- Should Be Equal ${resp.status_code} ${200}
-
-Deploy BPMN File Test On MSB
- [Documentation] Check if the test bpmn file can be deployed in activiti engine
- ${auth}= Create List kermit kermit
- ${headers}= Create Dictionary Accept=application/json
- Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth}
- ${files}= evaluate {"file":open('${bmpfilepath}','rb')}
- ${resp}= Post Request web_session api/workflow/v1/package files=${files}
- Should Be Equal ${resp.status_code} ${200}
- Log ${resp.json()}
- ${deployedId}= Set Variable ${resp.json()["deployedId"]}
- Set Global Variable ${deployedId}
-
-Exectue BPMN File Testt On MSB
- [Documentation] Check if the test bpmn file can be exectued in MSB
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA==
- Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers}
- ${body} Create Dictionary processDefinitionKey=${processId}
- ${body} dumps ${body}
- ${resp}= Post Request web_session api/workflow/v1/process/instance ${body}
- Should Be Equal ${resp.status_code} ${200}
- Log ${resp.json()}
- Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId}
-
-UnDeploy BPMN File Testt On MSB
- [Documentation] Check if the test bpmn file can be undeployed in MSB
- log ${deployedId}
- ${auth}= Create List kermit kermit
- ${headers} Create Dictionary Content-Type=application/json Accept=application/json
- Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth}
- ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId}
- Should Be Equal ${resp.status_code} ${200}
+*** Settings *** +Resource ../../common.robot +Library Collections +Library json +Library OperatingSystem +Library RequestsLibrary +Library HttpLibrary.HTTP + +*** Variables *** +${MSB_IP} 127.0.0.1 +${MSB_PORT} 10550 +${ACTIVITI_IP} 127.0.0.1 +${ACTIVITI_PORT} 8804 +${MGRSERVICE_IP} 127.0.0.1 +${MGRSERVICE_PORT} 8805 +${processId} demo +${deployid} 0 +${bmpfilepath} ${SCRIPTS}/nfvo-wfengine/demo.bpmn20.xml + +*** Test Cases *** +Deploy BPMN File Test On Activiti + [Documentation] Check if the test bpmn file can be deployed in activiti engine + ${auth}= Create List kermit kermit + ${headers}= Create Dictionary Accept=application/json + Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth} + ${files}= evaluate {"file":open('${bmpfilepath}','rb')} + ${resp}= Post Request web_session /activiti-rest/service/repository/deployments files=${files} + Should Be Equal ${resp.status_code} ${201} + Log ${resp.json()} + ${deployedId}= Set Variable ${resp.json()["id"]} + Set Global Variable ${deployedId} + +Exectue BPMN File Testt On Activiti + [Documentation] Check if the test bpmn file can be exectued in activiti engine + ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== + Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} + ${body} Create Dictionary processDefinitionKey=${processId} + ${body} dumps ${body} + ${resp}= Post Request web_session /activiti-rest/service/runtime/process-instances ${body} + Should Be Equal ${resp.status_code} ${201} + +UnDeploy BPMN File Testt On Activiti + [Documentation] Check if the test bpmn file can be undeployed in activiti engine + log ${deployedId} + ${auth}= Create List kermit kermit + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth} + ${resp}= Delete Request web_session /activiti-rest/service/repository/deployments/${deployedId}?cascade=true + Should Be Equal ${resp.status_code} ${204} + +Deploy BPMN File Test On MgrService + [Documentation] Check if the test bpmn file can be deployed in Management Service + ${auth}= Create List kermit kermit + ${headers}= Create Dictionary Accept=application/json + Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth} + ${files}= evaluate {"file":open('${bmpfilepath}','rb')} + ${resp}= Post Request web_session api/workflow/v1/package files=${files} + Should Be Equal ${resp.status_code} ${200} + Log ${resp.json()} + ${deployedId}= Set Variable ${resp.json()["deployedId"]} + Set Global Variable ${deployedId} + +Exectue BPMN File Testt On MgrService + [Documentation] Check if the test bpmn file can be exectued in Management Service + ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== + Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} + ${body} Create Dictionary processDefinitionKey=${processId} + ${body} dumps ${body} + ${resp}= Post Request web_session api/workflow/v1/process/instance ${body} + Should Be Equal ${resp.status_code} ${200} + Log ${resp.json()} + Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId} + +UnDeploy BPMN File Testt On MgrService + [Documentation] Check if the test bpmn file can be undeployed in Management Service + log ${deployedId} + ${auth}= Create List kermit kermit + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth} + ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId} + Should Be Equal ${resp.status_code} ${200} + +Deploy BPMN File Test On MSB + [Documentation] Check if the test bpmn file can be deployed in activiti engine + ${auth}= Create List kermit kermit + ${headers}= Create Dictionary Accept=application/json + Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth} + ${files}= evaluate {"file":open('${bmpfilepath}','rb')} + ${resp}= Post Request web_session api/workflow/v1/package files=${files} + Should Be Equal ${resp.status_code} ${200} + Log ${resp.json()} + ${deployedId}= Set Variable ${resp.json()["deployedId"]} + Set Global Variable ${deployedId} + +Exectue BPMN File Testt On MSB + [Documentation] Check if the test bpmn file can be exectued in MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== + Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} + ${body} Create Dictionary processDefinitionKey=${processId} + ${body} dumps ${body} + ${resp}= Post Request web_session api/workflow/v1/process/instance ${body} + Should Be Equal ${resp.status_code} ${200} + Log ${resp.json()} + Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId} + +UnDeploy BPMN File Testt On MSB + [Documentation] Check if the test bpmn file can be undeployed in MSB + log ${deployedId} + ${auth}= Create List kermit kermit + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth} + ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId} + Should Be Equal ${resp.status_code} ${200} diff --git a/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test_entry.mf b/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test_entry.mf index 710d1a201..4441457e8 100644 --- a/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test_entry.mf +++ b/test/csit/tests/vnfsdk-pkgtools/tosca-metadata/csar/test_entry.mf @@ -1,5 +1,5 @@ metadata: vnf_product_name: test vnf_provider_id: test -vnf_pacakage_version: 1.0 -vnf_release_date_time: 2017.09.15T15:00+8:00 +vnf_package_version: 1.0 +vnf_release_data_time: 2017-09-15T15:00:03+08:00 |