diff options
author | Leonardo Bellini <leonardo.bellini@att.com> | 2018-03-15 04:39:25 -0500 |
---|---|---|
committer | Leonardo Bellini <leonardo.bellini@att.com> | 2018-03-15 04:39:40 -0500 |
commit | 50ee9d628b2da68cc72933b00a699bf855193eed (patch) | |
tree | e7e6629dee8e69e55e06d2002a5fd891ff6133e2 /test | |
parent | 5ae17fe0c827f93e2065a1648fc7073009fe293e (diff) |
Integrate optf-has with music - first step
Issue-ID: OPTFRA-186
Change-Id: I0e92332af26105273db2a07e2d9bf04f0980338c
Signed-off-by: Leonardo Bellini <leonardo.bellini@att.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/csit/plans/optf-has/has/setup.sh | 29 | ||||
-rwxr-xr-x | test/csit/plans/optf-has/has/teardown.sh | 30 | ||||
-rw-r--r-- | test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap | 20 | ||||
-rwxr-xr-x | test/csit/scripts/optf-has/has/has_script.sh | 35 | ||||
-rwxr-xr-x | test/csit/scripts/optf-has/has/has_teardown_script.sh | 29 | ||||
-rw-r--r-- | test/csit/scripts/optf-has/has/music-properties/log4j.properties | 3 | ||||
-rw-r--r-- | test/csit/scripts/optf-has/has/music-properties/music.properties | 17 | ||||
-rwxr-xr-x | test/csit/scripts/optf-has/has/music_script.sh | 97 | ||||
-rwxr-xr-x | test/csit/scripts/optf-has/has/music_teardown_script.sh | 39 | ||||
-rwxr-xr-x | test/csit/scripts/optf-has/has/wait_for_port.sh | 18 | ||||
-rw-r--r-- | test/csit/tests/optf-has/has/optf_has_test.robot | 46 |
11 files changed, 315 insertions, 48 deletions
diff --git a/test/csit/plans/optf-has/has/setup.sh b/test/csit/plans/optf-has/has/setup.sh index 347399bf8..f2ae3c78b 100755 --- a/test/csit/plans/optf-has/has/setup.sh +++ b/test/csit/plans/optf-has/has/setup.sh @@ -15,44 +15,39 @@ # limitations under the License. # + +# +# add here eventual scripts needed for music +# +echo "# music scripts calling"; +source ${WORKSPACE}/test/csit/scripts/optf-has/has/music_script.sh + + # # add here eventual scripts needed for optf/has # -echo "##########################################################"; -echo "#"; echo "# optf/has scripts calling"; -echo "#"; -echo "##########################################################"; source ${WORKSPACE}/test/csit/scripts/optf-has/has/has_script.sh # # add here below the start of all docker containers needed for optf/has CSIT testing # -echo "##########################################################"; -echo "#"; echo "# optf/has scripts docker containers spinoff"; -echo "#"; -echo "##########################################################"; # # add here all the configuration steps eventually needed to be carried out for optf/has CSIT testing # -echo "##########################################################"; -echo "#"; echo "# optf/has configuration step"; -echo "#"; -echo "##########################################################"; # # add here all ROBOT_VARIABLES settings # -echo "##########################################################"; -echo "#"; echo "# optf/has robot variables settings"; -echo "#"; -echo "##########################################################"; -ROBOT_VARIABLES="-v MUSIC_HOSTNAME:http://localhost -v MUSIC_PORT:8080 -v COND_HOSTNAME:http://localhost -v COND_PORT:8091" +echo "conductor ip = ${COND_IP}" +echo "music ip = ${TOMCAT_IP}" + +ROBOT_VARIABLES="-v MUSIC_HOSTNAME:http://${TOMCAT_IP} -v MUSIC_PORT:8080 -v COND_HOSTNAME:http://${COND_IP} -v COND_PORT:8091" echo ${ROBOT_VARIABLES} diff --git a/test/csit/plans/optf-has/has/teardown.sh b/test/csit/plans/optf-has/has/teardown.sh index 80a85f9a9..f4a91f9d5 100755 --- a/test/csit/plans/optf-has/has/teardown.sh +++ b/test/csit/plans/optf-has/has/teardown.sh @@ -19,25 +19,17 @@ # # add here below the killing of all docker containers used for optf/has CSIT testing # -echo "##########################################################"; -echo "#"; + +# echo "# optf/has scripts docker containers killing"; -echo "#"; -echo "##########################################################"; -#kill-instance.sh cond-api -#kill-instance.sh cond-solv -#kill-instance.sh cond-cont -#kill-instance.sh cond-data -#kill-instance.sh cond-resv -docker stop cond-api -docker stop cond-solv -docker stop cond-cont -docker stop cond-data -docker stop cond-resv +# +echo "# optf/has scripts calling"; +source ${WORKSPACE}/test/csit/scripts/optf-has/has/has_teardown_script.sh + -docker rm cond-api -docker rm cond-solv -docker rm cond-cont -docker rm cond-data -docker rm cond-resv +# +echo "# optf/has scripts docker containers killing"; +# +echo "# optf/has scripts calling"; +source ${WORKSPACE}/test/csit/scripts/optf-has/has/music_teardown_script.sh 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 43a7453db..e0405dade 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 @@ -9,7 +9,7 @@ #api_paste_config = api_paste.ini # Music keyspace for content (string value) -keyspace = conductor_saisree +keyspace = conductor # # From oslo.log @@ -169,6 +169,18 @@ certificate_authority_bundle_file = /usr/local/bin/cert.pem # Minimum value: 1 #default_api_return_limit = 100 +[conductor_api] + +# Basic Authentication Username (string value) +username = admin1 + +# Basic Authentication Password (string value) +password = plan.15 + +# To disable basic_auth_secure = false and to enable basic_auth_secure = true +basic_auth_secure = false + + [controller] @@ -206,7 +218,7 @@ certificate_authority_bundle_file = /usr/local/bin/cert.pem # # Music keyspace for messages (string value) -keyspace = conductor_rpc_saisree +keyspace = conductor_rpc # Wait interval while checking for a message response. Default value is 1 # second. (integer value) @@ -237,7 +249,7 @@ timeout = 3600 # # Base URL for Music REST API without a trailing slash. (string value) -server_url = http://localhost:8080/MUSIC/rest +server_url = http://localhost:8080/MUSIC/rest/v2 # DEPRECATED: List of hostnames (round-robin access) (list value) # This option is deprecated for removal. @@ -298,7 +310,7 @@ server_url = http://localhost:8080/MUSIC/rest #table_prefix = sdnc # Base URL for SDN-C. (string value) -server_url = https://localhost:8082/restconf/ +server_url = http://localhost:8082/restconf/ # Basic Authentication Username (string value) username = admin diff --git a/test/csit/scripts/optf-has/has/has_script.sh b/test/csit/scripts/optf-has/has/has_script.sh index ac14020bf..fcf4e0711 100755 --- a/test/csit/scripts/optf-has/has/has_script.sh +++ b/test/csit/scripts/optf-has/has/has_script.sh @@ -40,7 +40,6 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then exit 1 fi - git clone https://gerrit.onap.org/r/optf/has cd has cd conductor/docker @@ -49,11 +48,11 @@ echo "i am ${USER} : only non jenkins users need proxy settings" if [ ${USER} != 'jenkins' ]; then # Comment sed for true integration lab - sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" api/Dockerfile - sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" controller/Dockerfile - sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" data/Dockerfile - sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" reservation/Dockerfile - sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080%g" solver/Dockerfile + sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV no_proxy localhost,0,1,2,3,4,5,6,7,8,9%g" api/Dockerfile + sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV no_proxy localhost,0,1,2,3,4,5,6,7,8,9%g" controller/Dockerfile + sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV no_proxy localhost,0,1,2,3,4,5,6,7,8,9%g" data/Dockerfile + sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV no_proxy localhost,0,1,2,3,4,5,6,7,8,9%g" reservation/Dockerfile + sed -i -e "s%FROM python:2\.7%FROM python:2\.7\\nENV http_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV https_proxy http:\/\/one\.proxy\.att\.com:8080\\nENV no_proxy localhost,0,1,2,3,4,5,6,7,8,9%g" solver/Dockerfile fi @@ -64,22 +63,42 @@ docker build -t data data/ docker build -t solver solver/ docker build -t reservation reservation/ - # create directory for volume and copy configuration file mkdir -p /tmp/conductor/properties +mkdir -p /tmp/conductor/logs cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/conductor.conf.onap /tmp/conductor/properties/conductor.conf cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.cer /tmp/conductor/properties/cert.cer cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.key /tmp/conductor/properties/cert.key cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.pem /tmp/conductor/properties/cert.pem #chmod -R 777 /tmp/conductor/properties +MUSIC_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` +echo "MUSIC_IP=${MUSIC_IP}" + +# change MUSIC reference +sed -i -e "s%localhost:8080/MUSIC%${MUSIC_IP}:8080/MUSIC%g" /tmp/conductor/properties/conductor.conf + + # run docker containers docker run -d --name cond-data -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf -v /tmp/conductor/properties/cert.key:/usr/local/bin/cert.key -v /tmp/conductor/properties/cert.cer:/usr/local/bin/cert.cer -v /tmp/conductor/properties/cert.pem:/usr/local/bin/cert.pem data -#docker run -d --name cond-data -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf data docker run -d --name cond-cont -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf controller docker run -d --name cond-api -p 8091:8091 -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf api docker run -d --name cond-solv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf solver docker run -d --name cond-resv -v /tmp/conductor/properties/conductor.conf:/usr/local/bin/conductor.conf reservation +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 30 + +echo "inspect docker things for tracing purpose" +docker inspect cond-data +docker inspect cond-cont +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' diff --git a/test/csit/scripts/optf-has/has/has_teardown_script.sh b/test/csit/scripts/optf-has/has/has_teardown_script.sh new file mode 100755 index 000000000..40a536a87 --- /dev/null +++ b/test/csit/scripts/optf-has/has/has_teardown_script.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +echo "optf/has scripts docker containers killing"; +docker stop cond-api +docker stop cond-solv +docker stop cond-cont +docker stop cond-data +docker stop cond-resv + +docker rm cond-api +docker rm cond-solv +docker rm cond-cont +docker rm cond-data +docker rm cond-resv + diff --git a/test/csit/scripts/optf-has/has/music-properties/log4j.properties b/test/csit/scripts/optf-has/has/music-properties/log4j.properties new file mode 100644 index 000000000..1312e9bb9 --- /dev/null +++ b/test/csit/scripts/optf-has/has/music-properties/log4j.properties @@ -0,0 +1,3 @@ +# No longer needed, please see the logback properties + + diff --git a/test/csit/scripts/optf-has/has/music-properties/music.properties b/test/csit/scripts/optf-has/has/music-properties/music.properties new file mode 100644 index 000000000..02fb52df1 --- /dev/null +++ b/test/csit/scripts/optf-has/has/music-properties/music.properties @@ -0,0 +1,17 @@ +my.public.ip=localhost +all.public.ips=localhost +my.id=0 +all.ids=0 +####################################### +# Optional current values are defaults +####################################### +zookeeper.host=music-zk +cassandra.host=music-db +#music.ip=localhost +#debug=true +#music.rest.ip=localhost +#lock.lease.period=6000 +cassandra.user=nelson24 +cassandra.password=winman123 + + diff --git a/test/csit/scripts/optf-has/has/music_script.sh b/test/csit/scripts/optf-has/has/music_script.sh new file mode 100755 index 000000000..be4eb8c63 --- /dev/null +++ b/test/csit/scripts/optf-has/has/music_script.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +echo "### This is ${WORKSPACE}/test/csit/scripts/optf-has/has/music_script.sh" +# +# add here whatever commands is needed to prepare the music setup for optf-has CSIT testing +# + +# +# add here all the configuration steps eventually needed to be carried out for music CSIT testing +# +echo "# music configuration step"; + +CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest +TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0 +ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4 +MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest +WORK_DIR=/tmp/music +CASS_USERNAME=nelson24 +CASS_PASSWORD=winman123 +MUSIC_SOURCE_PROPERTIES=${WORKSPACE}/test/csit/scripts/optf-has/has/music-properties +MUSIC_PROPERTIES=/tmp/music/properties +MUSIC_LOGS=/tmp/music/logs +mkdir -p ${MUSIC_PROPERTIES} +mkdir -p ${MUSIC_LOGS} + +cp ${MUSIC_SOURCE_PROPERTIES}/* ${WORK_DIR}/properties + +# Create Volume for mapping war file and tomcat +docker volume create --name music-vol; + +# Create a network for all the containers to run in. +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}; + +# 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; + +# 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}; + +# 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/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 + + +echo "inspect docker things for tracing purpose" +docker inspect music-db +docker inspect music-zk +docker inspect music-tomcat +docker inspect music-war +docker volume inspect music-vol +docker network inspect music-net + + + + + + + diff --git a/test/csit/scripts/optf-has/has/music_teardown_script.sh b/test/csit/scripts/optf-has/has/music_teardown_script.sh new file mode 100755 index 000000000..fa91f6e97 --- /dev/null +++ b/test/csit/scripts/optf-has/has/music_teardown_script.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +echo "music scripts docker containers killing"; +docker stop music-tomcat +docker stop music-war +docker stop music-zk +docker stop music-db + +docker rm music-zk +docker rm music-tomcat +docker rm music-war +docker rm music-db + +docker network rm music-net; +sleep 5; + +docker volume rm music-vol + +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/error.log + diff --git a/test/csit/scripts/optf-has/has/wait_for_port.sh b/test/csit/scripts/optf-has/has/wait_for_port.sh new file mode 100755 index 000000000..10f08ded1 --- /dev/null +++ b/test/csit/scripts/optf-has/has/wait_for_port.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ $# -ne 2 ]]; then + echo "Usage: wait-for-port hostname port" >&2 + exit 1 +fi + +host=$1 +port=$2 + +echo "Waiting for $host port $port open" +until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do + sleep 1 +done + +echo "$host port $port is open" + +exit 0 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 ab5ded6ca..4882c229f 100644 --- a/test/csit/tests/optf-has/has/optf_has_test.robot +++ b/test/csit/tests/optf-has/has/optf_has_test.robot @@ -13,6 +13,52 @@ ${RESP_MESSAGE_WITHOUT_DEMANDS} Undefined Demand ${generatedPlanId} *** Test Cases *** +Check Cassandra Docker Container + [Documentation] It checks cassandra 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} music-db + +Check Zookeeper Docker Container + [Documentation] It checks zookeeper 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} music-zk + +Check Tomcat Docker Container + [Documentation] It checks tomcat 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} music-tomcat + +Check Music War Docker Container + [Documentation] It checks music.war 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} music-war + +Get Music Version + [Documentation] It sends a REST GET request to retrieve the Music.war version + Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Get Request musicaas /MUSIC/rest/v2/version 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 + Check ConductorApi Docker Container [Documentation] It checks conductor-api docker container is running ${rc} ${output}= Run and Return RC and Output docker ps |