From b0995b45deb46fa0066effa920084281c6df862d Mon Sep 17 00:00:00 2001 From: Leonardo Bellini Date: Sat, 17 Mar 2018 05:26:31 -0500 Subject: Align csit testing to latest optf-has merged code Issue-ID: OPTFRA-190 Change-Id: If17ea42fdd40cf9d512decbdaa05b626fe341352 Signed-off-by: Leonardo Bellini --- .../has/has-properties/conductor.conf.onap | 8 +-- .../optf-has/has/has-properties/log.conf.onap | 65 ++++++++++++++++++++++ .../scripts/optf-has/has/has_proxy_settings.sh | 31 +++++++++++ test/csit/scripts/optf-has/has/has_script.sh | 45 +++++++-------- 4 files changed, 122 insertions(+), 27 deletions(-) create mode 100644 test/csit/scripts/optf-has/has/has-properties/log.conf.onap create mode 100755 test/csit/scripts/optf-has/has/has_proxy_settings.sh (limited to 'test') 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 e0405dade..d3e391cde 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 @@ -34,7 +34,7 @@ debug = true # example, logging_context_format_string). (string value) # Note: This option can be changed without restarting. # Deprecated group/name - [DEFAULT]/log_config -#log_config_append = /home/saisree/conductor/etc/conductor/log.conf +log_config_append = /usr/local/bin/log.conf # Defines the format string for %%(asctime)s in log records. Default: # %(default)s . This option is ignored if log_config_append is set. (string @@ -51,7 +51,7 @@ log_date_format = %d-%m-%Y %H:%M:%S # (Optional) The base directory used for relative log_file paths. This option # is ignored if log_config_append is set. (string value) # Deprecated group/name - [DEFAULT]/logdir -#log_dir = /home/saisree/Log/ +log_dir = /var/log @@ -143,7 +143,7 @@ server_url = http://localhost:8081/aai/ # The version of A&AI (string value) -server_url_version = v11 +server_url_version = v13 # SSL/TLS certificate file in pem format. This certificate must be registered # with the A&AI endpoint. (string value) @@ -255,8 +255,6 @@ server_url = http://localhost:8080/MUSIC/rest/v2 # This option is deprecated for removal. # Its value may be silently ignored in the future. # Reason: Use server_url instead -# hostnames = 135.197.226.85 -# 135.197.226.83, 135.197.226.85 # DEPRECATED: Port (integer value) # This option is deprecated for removal. diff --git a/test/csit/scripts/optf-has/has/has-properties/log.conf.onap b/test/csit/scripts/optf-has/has/has-properties/log.conf.onap new file mode 100644 index 000000000..41d66444e --- /dev/null +++ b/test/csit/scripts/optf-has/has/has-properties/log.conf.onap @@ -0,0 +1,65 @@ +[loggers] +keys=root + +[handlers] +keys=trfhand,consoleHandler,audithand,metrichand,errhand,debughand + +[logger_root] +level=NOTSET +handlers=trfhand,consoleHandler,audithand,metrichand,errhand,debughand + +[handler_consoleHandler] +class=StreamHandler +level=NOTSET +formatter=generic +args=(sys.stdout,) + +[handler_trfhand] +class=handlers.TimedRotatingFileHandler +level=NOTSET +formatter=generic +args=('application.log','midnight', 1, 10) + +[handler_audithand] +class=handlers.TimedRotatingFileHandler +level=INFO +formatter=audit +args=('audit.log', 'midnight', 1, 10) + +[handler_metrichand] +class=handlers.TimedRotatingFileHandler +level=INFO +formatter=metric +args=('metric.log','midnight', 1, 10) + +[handler_errhand] +class=handlers.TimedRotatingFileHandler +level=ERROR +formatter=error +args=('error.log','midnight', 1, 10) + +[handler_debughand] +class=handlers.TimedRotatingFileHandler +level=DEBUG +formatter=generic +args=('debug.log','midnight', 1, 10) + +[formatters] +keys=generic,audit,metric,error + +[formatter_audit] +format=%(asctime)s|%(asctime)s|00000000-0000-0000-0000-000000000000||%(thread)d||Conductor|N/A|COMPLETE|200|sucessful||%(levelname)s|||0|%(module)s|||||||||%(name)s : [-] %(message)s +datefmt= + +[formatter_metric] +format=%(asctime)s|%(asctime)s|00000000-0000-0000-0000-000000000000||%(thread)d||Conductor|N/A|N/A|N/A|COMPLETE|200|sucessful||%(levelname)s|||0|%(module)s||||||||||%(name)s : [-] %(message)s +datefmt= + +[formatter_error] +format=%(asctime)s|00000000-0000-0000-0000-000000000000|%(thread)d|Conductor|N/A|N/A|N/A|ERROR|500|N/A|%(name)s : [-] %(message)s +datefmt= + +[formatter_generic] +format=%(asctime)s||%(thread)d|%(levelname)s|%(module)s|%(name)s: [-] %(message)s +datefmt= + diff --git a/test/csit/scripts/optf-has/has/has_proxy_settings.sh b/test/csit/scripts/optf-has/has/has_proxy_settings.sh new file mode 100755 index 000000000..92f8d93c7 --- /dev/null +++ b/test/csit/scripts/optf-has/has/has_proxy_settings.sh @@ -0,0 +1,31 @@ +#!/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. +# +# put into this file local proxy settings in case they are needed on your local environment +echo "### This is ${WORKSPACE}/test/csit/scripts/optf-has/has/has_proxy_settings.sh" + +echo "optf/has proxy settings" +if [ "$#" -eq "1" ]; then + echo "$1" + cd $1 + pwd +else + exit 1 +fi + +# don't remove following lines: commands can be attached here + + diff --git a/test/csit/scripts/optf-has/has/has_script.sh b/test/csit/scripts/optf-has/has/has_script.sh index fcf4e0711..9a8a62e03 100755 --- a/test/csit/scripts/optf-has/has/has_script.sh +++ b/test/csit/scripts/optf-has/has/has_script.sh @@ -23,7 +23,6 @@ echo "### This is ${WORKSPACE}/test/csit/scripts/optf-has/has/has_script.sh" DIR=/tmp # the directory of the script -#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo ${DIR} cd ${DIR} @@ -42,31 +41,35 @@ fi git clone https://gerrit.onap.org/r/optf/has cd has -cd conductor/docker +#git fetch https://gerrit.onap.org/r/optf/has refs/changes/91/35991/1 && git checkout FETCH_HEAD -echo "i am ${USER} : only non jenkins users need proxy settings" +echo "i am ${USER} : only non jenkins users may 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\\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 + # add proxy settings into this script when you work behind a proxy + ${WORKSPACE}/test/csit/scripts/optf-has/has/has_proxy_settings.sh ${WORK_DIR} fi +# check Dockerfile content +cat conductor/docker/Dockerfile + # ./build-dockers.sh -docker build -t api api/ -docker build -t controller controller/ -docker build -t data data/ -docker build -t solver solver/ -docker build -t reservation reservation/ +./build-dockers.sh # create directory for volume and copy configuration file +# run docker containers +COND_CONF=/tmp/conductor/properties/conductor.conf +LOG_CONF=/tmp/conductor/properties/log.conf +IMAGE_NAME=nexus3.onap.org:10003/onap/optf-has +CERT=/tmp/conductor/properties/cert.cer +KEY=/tmp/conductor/properties/cert.key +BUNDLE=/tmp/conductor/properties/cert.pem + 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/log.conf.onap /tmp/conductor/properties/log.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 @@ -75,16 +78,14 @@ cp ${WORKSPACE}/test/csit/scripts/optf-has/has/has-properties/cert.pem /tmp/cond MUSIC_IP=`docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat` echo "MUSIC_IP=${MUSIC_IP}" -# change MUSIC reference +# change MUSIC reference to the local instance 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-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 +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 +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 +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 +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 +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 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 -- cgit 1.2.3-korg