diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-03-15 15:53:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-15 15:53:20 +0000 |
commit | 889f3a26a84d0d3f38efddfc71023ec814ef4d1f (patch) | |
tree | ef05c97d4ac6b3a4520849fa6acf8b8787ae1276 /test/csit/scripts | |
parent | 1e1211339f41e99217592d021fcd4705a53a280c (diff) | |
parent | 50ee9d628b2da68cc72933b00a699bf855193eed (diff) |
Merge "Integrate optf-has with music - first step"
Diffstat (limited to 'test/csit/scripts')
8 files changed, 246 insertions, 12 deletions
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 |