diff options
author | Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> | 2021-09-03 14:57:16 +0200 |
---|---|---|
committer | Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> | 2021-09-07 06:57:15 +0000 |
commit | 1cb88f315b0ead933e8b6051a498daf85271d950 (patch) | |
tree | 1c00a2343a28e2e80b181d25f7b77132301159c1 /test/mocks/datafilecollector-testharness/common | |
parent | ee8669cc6b2dd8591c84dff3ccc4e2394f99fc33 (diff) |
Update DFC tests to use file based conifg
To remove Consul/CBS dependency in DCAE DFC was updated
to use file based configuration
Tests updates:
- file based config use in DFC
- removal of Consul/CBS from DFC tests
- coversion config files from json to yaml
Issue-ID: DCAEGEN2-2692
Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Change-Id: I7267f99cc1354dee84afc1c187b7e4ca0b89af94
Diffstat (limited to 'test/mocks/datafilecollector-testharness/common')
3 files changed, 21 insertions, 30 deletions
diff --git a/test/mocks/datafilecollector-testharness/common/README.md b/test/mocks/datafilecollector-testharness/common/README.md index 736ed4819..13cbd46fd 100644 --- a/test/mocks/datafilecollector-testharness/common/README.md +++ b/test/mocks/datafilecollector-testharness/common/README.md @@ -28,13 +28,9 @@ dfc instance to start. DFC app will get a name like 'dfc_app0' to 'dfc_app4'. **kill_dfc \<dfc-instance-id>**: Stop and remove the dfc app container with the instance id. -**consul_config_app \<dfc-instance-id> \<json-file-path>**: -Configure consul with json file with app config for a dfc instance using the dfc -instance id and the json file. - -**consul_config_dmaap \<dfc-instance-id> \<json-file-path>**: -Configure consul with json file with dmaap config for a dfc instance using the dfc -instance id and the json file. +**dfc_config_app \<dfc-instance-id> \<yaml-file-path>**: +Apply app configuration for a dfc instance using the dfc +instance id and the yaml file. **kill_dr**: Stop and remove the DR simulator container diff --git a/test/mocks/datafilecollector-testharness/common/test_env.sh b/test/mocks/datafilecollector-testharness/common/test_env.sh index 35d82ab53..f76af323f 100644 --- a/test/mocks/datafilecollector-testharness/common/test_env.sh +++ b/test/mocks/datafilecollector-testharness/common/test_env.sh @@ -31,8 +31,6 @@ DFC_PORT=8100 #Up to five dfc apps can be used, dfc_app DFC_PORT_SECURE=8433 #Up to five dfc apps can be used, dfc_app0 will be mapped to 8433 on local machine for hhtps, dfc_app1 mapped to 8434 etc DFC_LOGPATH="/var/log/ONAP/application.log" #Path the application log in the dfc container DOCKER_SIM_NWNAME="dfcnet" #Name of docker private network -CONSUL_HOST="consul-server" #Host name of consul -CONSUL_PORT=8500 #Port number of consul CONFIG_BINDING_SERVICE="config-binding-service" #Host name of CBS CONFIG_BINDING_SERVICE_SERVICE_PORT=10000 #CBS port MR_PORT=2222 #MR simulator port number http diff --git a/test/mocks/datafilecollector-testharness/common/testcase_common.sh b/test/mocks/datafilecollector-testharness/common/testcase_common.sh index 601c093e1..ba665f655 100755 --- a/test/mocks/datafilecollector-testharness/common/testcase_common.sh +++ b/test/mocks/datafilecollector-testharness/common/testcase_common.sh @@ -181,8 +181,6 @@ echo "DR redir simulator: " $(docker images | grep drsim_common) echo "SFTP: " $(docker images | grep atmoz/sftp) echo "FTPES: " $(docker images | grep ftpes_vsftpd) echo "HTTP/HTTPS/HTTPS no auth: " $(docker images | grep http_https_httpd) -echo "Consul: " $(docker images | grep consul) -echo "CBS: " $(docker images | grep platform.configbinding) echo "" #Configure MR sim to use correct host:port for running dfc as an app or as a container @@ -391,7 +389,7 @@ __start_dfc_image() { docker network ls| grep "$DOCKER_SIM_NWNAME" > /dev/null || docker network create "$DOCKER_SIM_NWNAME" echo "Starting DFC: " $appname " with ports mapped to " $localport " and " $localport_secure " in docker network "$DOCKER_SIM_NWNAME - docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -e CONSUL_HOST=$CONSUL_HOST -e CONSUL_PORT=$CONSUL_PORT -e CONFIG_BINDING_SERVICE=$CONFIG_BINDING_SERVICE -e CONFIG_BINDING_SERVICE_SERVICE_PORT=$CONFIG_BINDING_SERVICE_SERVICE_PORT -e HOSTNAME=$appname --name $appname $DFC_IMAGE + docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ --volume $(pwd)/../simulator-group/dfc_config_volume/:/app-config/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -e CONFIG_BINDING_SERVICE=$CONFIG_BINDING_SERVICE -e CONFIG_BINDING_SERVICE_SERVICE_PORT=$CONFIG_BINDING_SERVICE_SERVICE_PORT -e HOSTNAME=$appname --name $appname $DFC_IMAGE sleep 3 set +x dfc_started=false @@ -489,8 +487,6 @@ __wait_for_dfc() { http=$(($DFC_PORT+$2)) https=$((DFC_PORT_SECURE+$2)) echo "The app is expected to listen to http port ${http} and https port ${https}" - echo "The app shall use 'localhost' and '8500' for CONSUL_HOST and CONSUL_PORT." - echo "The app shale use 'config-binding-service-localhost' for CONFIG_BINDING_SERVICE" echo "The app shall use ${1} for HOSTNAME." read -p "Press enter to continue when app mapping to ${1} has been manually started" } @@ -584,12 +580,12 @@ start_dfc() { fi } -# Configure consul with dfc config, args <dfc-instance-id> <json-file-path> +# Configure volume with dfc config, args <dfc-instance-id> <yaml-file-path> # Not intended to be called directly by test scripts. -__consul_config() { +__dfc_config() { if [ $# != 2 ]; then - __print_err "need two args, <dfc-instance-id> <json-file-path>" + __print_err "need two args, <dfc-instance-id> <yaml-file-path>" exit 1 fi @@ -598,26 +594,27 @@ __consul_config() { exit 1 fi if ! [ -f $2 ]; then - __print_err "json file does not extis: "$2 + __print_err "yaml file does not exist: "$2 exit 1 fi appname=$DFC_APP_BASE$1 - echo "Configuring consul for " $appname " from " $2 - curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$2 >/dev/null + echo "Applying configuration for " $appname " from " $2 + mkdir $(pwd)/../simulator-group/dfc_config_volume/ + cp $2 $(pwd)/../simulator-group/dfc_config_volume/application_config.yaml } -# Configure consul with dfc app config, args <dfc-instance-id> <json-file-path> -consul_config_app() { +# Configure volume with dfc app config, args <dfc-instance-id> <yaml-file-path> +dfc_config_app() { if [ $START_ARG == "manual-app" ]; then - echo "Replacing 'mrsim' with 'localhost' in json app config for consul" - sed 's/mrsim/localhost/g' $2 > .tmp_app.json - echo "Replacing 'drsim' with 'localhost' in json dmaap config for consul" - sed 's/drsim/localhost/g' .tmp_app.json > .app.json - __consul_config $1 .app.json + echo "Replacing 'mrsim' with 'localhost' in yaml app config" + sed 's/mrsim/localhost/g' $2 > .tmp_app.yaml + echo "Replacing 'drsim' with 'localhost' in yaml dmaap config" + sed 's/drsim/localhost/g' .tmp_app.yaml > .app.yaml + __dfc_config $1 .app.yaml else - __consul_config $1 $2 + __dfc_config $1 $2 fi } @@ -645,6 +642,8 @@ kill_dfc() { elif [ $START_ARG == "manual-app" ]; then __wait_for_dfc_gone $appname fi + + rm -rf $(pwd)/../simulator-group/dfc_config_volume } # Stop and remove the DR simulator container @@ -1222,8 +1221,6 @@ store_logs() { docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1 done - docker logs dfc_consul > $TESTLOGS/$ATC/$1_consul.log 2>&1 - docker logs dfc_cbs > $TESTLOGS/$ATC/$1_cbs.log 2>&1 } # Check the dfc application log, for all dfc instances, for WARN and ERR messages and print the count. check_dfc_logs() { |