From 9002c53de67fd594efbf8f66f3b0706ad9a9bec2 Mon Sep 17 00:00:00 2001 From: ecaiyanlinux Date: Thu, 2 Sep 2021 12:21:00 +0200 Subject: Improvement & Enhancement of csit tests Improve integration with sdnc Use env variables to replace image urls & tags Signed-off-by: ecaiyanlinux Issue-ID: CCSDK-3433 Change-Id: Id6d6e428e5ddba018b50710710d077613d02b2e8 --- csit/scripts/healthcheck/.env | 32 ++++++++ .../config/application_configuration.json.sdnc | 2 +- csit/scripts/healthcheck/docker-compose.yml | 8 +- csit/scripts/healthcheck/sdnc/docker-compose.yml | 86 +++++++++------------- csit/scripts/healthcheck/test/health_check.sh | 4 +- csit/scripts/healthcheck/test/pms_a1sim.sh | 4 +- csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh | 5 +- csit/tests/healthcheck/test3.robot | 16 ++++ 8 files changed, 96 insertions(+), 61 deletions(-) create mode 100644 csit/scripts/healthcheck/.env create mode 100644 csit/tests/healthcheck/test3.robot diff --git a/csit/scripts/healthcheck/.env b/csit/scripts/healthcheck/.env new file mode 100644 index 00000000..2794b027 --- /dev/null +++ b/csit/scripts/healthcheck/.env @@ -0,0 +1,32 @@ +# ============LICENSE_START=============================================== +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= +# + +#PMS +PMS_IMAGE_BASE="onap/ccsdk-oran-a1policymanagementservice" +PMS_IMAGE_TAG="1.2.1-SNAPSHOT-latest" + +#A1_SIM +A1_SIM_IMAGE_BASE="nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator" +A1_SIM_IMAGE_TAG="2.1.0" + +#DB +DB_IMAGE_BASE="mysql/mysql-server" +DB_IMAGE_TAG="5.6" + +#A1CONTROLLER +A1CONTROLLER_IMAGE_BASE="nexus3.onap.org:10002/onap/sdnc-image" +A1CONTROLLER_IMAGE_TAG="2.1.2" \ No newline at end of file diff --git a/csit/scripts/healthcheck/config/application_configuration.json.sdnc b/csit/scripts/healthcheck/config/application_configuration.json.sdnc index 66af21fd..d38efb81 100644 --- a/csit/scripts/healthcheck/config/application_configuration.json.sdnc +++ b/csit/scripts/healthcheck/config/application_configuration.json.sdnc @@ -3,7 +3,7 @@ "controller": [ { "name": "controller1", - "baseUrl": "https://sdnc:8443", + "baseUrl": "https://a1controller:8443", "userName": "admin", "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" } diff --git a/csit/scripts/healthcheck/docker-compose.yml b/csit/scripts/healthcheck/docker-compose.yml index 06befdc6..d6dda495 100644 --- a/csit/scripts/healthcheck/docker-compose.yml +++ b/csit/scripts/healthcheck/docker-compose.yml @@ -21,7 +21,7 @@ networks: services: policy-agent: - image: onap/ccsdk-oran-a1policymanagementservice:1.2.1-SNAPSHOT-latest + image: "${PMS_IMAGE_BASE}:${PMS_IMAGE_TAG}" container_name: policy-agent networks: default: @@ -39,7 +39,7 @@ services: # - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro a1-sim-OSC: - image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0 + image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}" container_name: a1-sim-OSC networks: - default @@ -52,7 +52,7 @@ services: - ALLOW_HTTP=true a1-sim-STD: - image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0 + image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}" container_name: a1-sim-STD networks: - default @@ -65,7 +65,7 @@ services: - ALLOW_HTTP=true a1-sim-STD-v2: - image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0 + image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}" container_name: a1-sim-STD-v2 networks: - default diff --git a/csit/scripts/healthcheck/sdnc/docker-compose.yml b/csit/scripts/healthcheck/sdnc/docker-compose.yml index ace2dec2..f6902f92 100644 --- a/csit/scripts/healthcheck/sdnc/docker-compose.yml +++ b/csit/scripts/healthcheck/sdnc/docker-compose.yml @@ -20,73 +20,55 @@ networks: driver: bridge services: - mariadb: - image: nexus3.onap.org:10001/mariadb:10.1.11 + db: + image: "${DB_IMAGE_BASE}:${DB_IMAGE_TAG}" + container_name: sdncdb + networks: + - default ports: - - "3306:3306" - container_name: mariadb - volumes: - - /etc/localtime:/etc/localtime:ro + - "3306" environment: - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - - MYSQL_USER=${MYSQL_USER} - - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_DATABASE=${MYSQL_DATABASE} - hostname: - mariadb.so.testlab.onap.org + - MYSQL_ROOT_PASSWORD=itsASecret + - MYSQL_ROOT_HOST=% + - MYSQL_USER=sdnctl + - MYSQL_PASSWORD=gamma + - MYSQL_DATABASE=sdnctl logging: - driver: "json-file" + driver: "json-file" options: max-size: "30m" max-file: "5" - sdnc: - image: onap/sdnc-image:2.1.2 - container_name: sdnc - volumes: - - /etc/localtime:/etc/localtime:ro - - ./sdnc/config:/opt/opendaylight/current/certs + a1controller: + image: "${A1CONTROLLER_IMAGE_BASE}:${A1CONTROLLER_IMAGE_TAG}" + depends_on : + - db + container_name: a1controller + networks: + - default entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"] ports: - - "8282:8181" - hostname: - sdnc + - 8282:8181 + - 8444:8443 links: - - mariadb:dbhost - - mariadb:sdnctldb01 - - mariadb:sdnctldb02 + - db:dbhost + - db:sdnctldb01 + - db:sdnctldb02 environment: - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - - MYSQL_USER=${MYSQL_USER} - - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_ROOT_PASSWORD=itsASecret + - MYSQL_USER=sdnctl + - MYSQL_PASSWORD=gamma + - MYSQL_DATABASE=sdnctl - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties - SDNC_BIN=/opt/onap/sdnc/bin - ODL_CERT_DIR=/tmp - - ODL_ADMIN_USERNAME=${ODL_USER} - - ODL_ADMIN_PASSWORD=${ODL_PASSWORD} - - ODL_USER=${ODL_USER} - - ODL_PASSWORD=${ODL_PASSWORD} - - ODL_CERT_DIR=/opt/opendaylight/current/certs - - SDNC_DB_INIT=true - - HONEYCOMB_USER=${HONEYCOMB_USER} - - HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD} - - TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD} - - KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD} - - SO_USER=${SO_USER} - - SO_PASSWORD=${SO_PASSWORD} - - NENG_USER=${NENG_USER} - - NENG_PASSWORD=${NENG_PASSWORD} - - CDS_USER=${CDS_USER} - - CDS_PASSWORD=${CDS_PASSWORD} - - ANSIBLE_USER=${ANSIBLE_USER} - - ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD} - - SQL_CRYPTKEY=${SQL_CRYPTKEY} + - ODL_ADMIN_USERNAME=admin + - ODL_ADMIN_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + - ODL_USER=admin + - ODL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + - SDNC_DB_INIT=true - A1_TRUSTSTORE_PASSWORD=a1adapter - depends_on: - - mariadb - dns: - - ${DNS_IP_ADDR-10.0.100.1} + - AAI_TRUSTSTORE_PASSWORD=changeit logging: driver: "json-file" options: diff --git a/csit/scripts/healthcheck/test/health_check.sh b/csit/scripts/healthcheck/test/health_check.sh index 409e85fb..e08cc3e8 100755 --- a/csit/scripts/healthcheck/test/health_check.sh +++ b/csit/scripts/healthcheck/test/health_check.sh @@ -29,9 +29,9 @@ cp application_configuration.json.nosdnc application_configuration.json cd ${SHELL_FOLDER}/../ # start NONRTRIC containers with docker compose and configuration from docker-compose.yml -curl -L https://github.com/docker/compose/releases/download/1.27.0/docker-compose-`uname -s`-`uname -m` > docker-compose +curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose chmod +x docker-compose -./docker-compose up -d +./docker-compose --env-file .env up -d checkStatus(){ diff --git a/csit/scripts/healthcheck/test/pms_a1sim.sh b/csit/scripts/healthcheck/test/pms_a1sim.sh index fadc056b..b28cc02c 100755 --- a/csit/scripts/healthcheck/test/pms_a1sim.sh +++ b/csit/scripts/healthcheck/test/pms_a1sim.sh @@ -25,7 +25,9 @@ cd ${SHELL_FOLDER}/../config cp application_configuration.json.nosdnc application_configuration.json cd ${SHELL_FOLDER}/../ -docker-compose up -d +curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose +chmod +x docker-compose +./docker-compose --env-file .env up -d checkStatus(){ for i in {1..60}; do diff --git a/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh index c75d6056..c80e68a9 100755 --- a/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh +++ b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh @@ -26,7 +26,10 @@ cd ${SHELL_FOLDER}/../config cp application_configuration.json.sdnc application_configuration.json cd ${SHELL_FOLDER}/../ -docker-compose -f docker-compose.yml -f sdnc/docker-compose.yml up -d + +curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose +chmod +x docker-compose +./docker-compose --env-file .env -f docker-compose.yml -f sdnc/docker-compose.yml up -d checkStatus(){ for i in {1..60}; do diff --git a/csit/tests/healthcheck/test3.robot b/csit/tests/healthcheck/test3.robot new file mode 100644 index 00000000..cedac7e5 --- /dev/null +++ b/csit/tests/healthcheck/test3.robot @@ -0,0 +1,16 @@ +*** Settings *** +Library OperatingSystem +Library Process + +*** Variables *** + +${pms_a1sim_sdnc} ${SCRIPTS}/healthcheck/test/pms_a1sim_sdnc.sh + + +*** Test Cases *** + +Health check test case for NONRTRIC + [Documentation] Deploy NONRTRIC with SDNC + Start Process ${pms_a1sim_sdnc} >> log_hc.txt shell=yes + ${cli_cmd_output}= Wait For Process timeout=600 + Should Be Equal as Integers ${cli_cmd_output.rc} 0 -- cgit 1.2.3-korg