From d181b0e51b6385105362c9b59239ab581cace45e Mon Sep 17 00:00:00 2001 From: JosephKeenan Date: Fri, 1 Oct 2021 10:40:47 +0100 Subject: CPS-615 - CSIT for model sync & passthrough This commit contains -Registration and sync test cases -Passthrough read and write test case Issue-ID: CPS-615 Change-Id: I1ad70dbc8c0af96bd5cf69476acdad42cf3c179d Signed-off-by: JosephKeenan --- csit/plans/cps/pnfsim/docker-compose.yml | 28 +++++ csit/plans/cps/pnfsim/netconf-config/LICENSE | 13 ++ csit/plans/cps/pnfsim/netconf-config/stores.yang | 63 ++++++++++ csit/plans/cps/pnfsim/netconf-config/subscriber.py | 131 +++++++++++++++++++++ csit/plans/cps/sdnc/certs/certs.properties | 2 + csit/plans/cps/sdnc/certs/keys0.zip | Bin 0 -> 5057 bytes csit/plans/cps/sdnc/docker-compose.yml | 64 ++++++++++ csit/plans/cps/sdnc/sdnc_setup.sh | 49 ++++++++ csit/plans/cps/setup.sh | 129 ++++++++++++++++++++ csit/plans/cps/teardown.sh | 32 +++++ csit/plans/cps/testplan.txt | 24 ++++ csit/plans/default/setup.sh | 76 ------------ csit/plans/default/teardown.sh | 25 ---- csit/plans/default/testplan.txt | 6 - 14 files changed, 535 insertions(+), 107 deletions(-) create mode 100755 csit/plans/cps/pnfsim/docker-compose.yml create mode 100755 csit/plans/cps/pnfsim/netconf-config/LICENSE create mode 100644 csit/plans/cps/pnfsim/netconf-config/stores.yang create mode 100755 csit/plans/cps/pnfsim/netconf-config/subscriber.py create mode 100644 csit/plans/cps/sdnc/certs/certs.properties create mode 100644 csit/plans/cps/sdnc/certs/keys0.zip create mode 100644 csit/plans/cps/sdnc/docker-compose.yml create mode 100644 csit/plans/cps/sdnc/sdnc_setup.sh create mode 100755 csit/plans/cps/setup.sh create mode 100755 csit/plans/cps/teardown.sh create mode 100644 csit/plans/cps/testplan.txt delete mode 100755 csit/plans/default/setup.sh delete mode 100755 csit/plans/default/teardown.sh delete mode 100644 csit/plans/default/testplan.txt (limited to 'csit/plans') diff --git a/csit/plans/cps/pnfsim/docker-compose.yml b/csit/plans/cps/pnfsim/docker-compose.yml new file mode 100755 index 000000000..568f98f41 --- /dev/null +++ b/csit/plans/cps/pnfsim/docker-compose.yml @@ -0,0 +1,28 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation +# ================================================================================ +# 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========================================================= + +version: '3' + +services: + netconf-pnp-simulator: + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 + container_name: netconf-simulator + restart: always + ports: + - "831:830" + - "6512:6513" + volumes: + - ./netconf-config:/config/modules/stores diff --git a/csit/plans/cps/pnfsim/netconf-config/LICENSE b/csit/plans/cps/pnfsim/netconf-config/LICENSE new file mode 100755 index 000000000..3bc5b026c --- /dev/null +++ b/csit/plans/cps/pnfsim/netconf-config/LICENSE @@ -0,0 +1,13 @@ +Copyright (C) 2021 Nordix Foundation + +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. diff --git a/csit/plans/cps/pnfsim/netconf-config/stores.yang b/csit/plans/cps/pnfsim/netconf-config/stores.yang new file mode 100644 index 000000000..b24ac0e1a --- /dev/null +++ b/csit/plans/cps/pnfsim/netconf-config/stores.yang @@ -0,0 +1,63 @@ +module stores { + + yang-version 1.1; + + namespace "org:onap:ccsdk:sample"; + + prefix book-store; + + import ietf-yang-types { prefix yang; } + import ietf-inet-types { prefix inet; } + + revision "2020-09-15" { + description + "Sample Model"; + } + + typedef year { + type uint16 { + range "1000..9999"; + } + } + + container bookstore { + + leaf bookstore-name { + type string; + } + + list categories { + + key "code"; + + leaf code { + type string; + } + + leaf name { + type string; + } + + list books { + key title; + + leaf title { + type string; + } + leaf lang { + type string; + } + leaf-list authors { + type string; + } + leaf pub_year { + type year; + } + leaf price { + type uint64; + } + } + } + } +} + diff --git a/csit/plans/cps/pnfsim/netconf-config/subscriber.py b/csit/plans/cps/pnfsim/netconf-config/subscriber.py new file mode 100755 index 000000000..5147c9345 --- /dev/null +++ b/csit/plans/cps/pnfsim/netconf-config/subscriber.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 + +__author__ = "Mislav Novakovic " +__copyright__ = "Copyright 2018, Deutsche Telekom AG" +__license__ = "Apache 2.0" + +# ============LICENSE_START======================================================= +# Copyright (C) 2018 Deutsche Telekom AG +# Modifications Copyright (C) 2021 Nordix Foundation +# ================================================================================ +# 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========================================================= + +import sysrepo as sr +import sys + + +# Helper function for printing changes given operation, old and new value. +def print_change(op, old_val, new_val): + if op == sr.SR_OP_CREATED: + print(f"CREATED: {new_val.to_string()}") + elif op == sr.SR_OP_DELETED: + print(f"DELETED: {old_val.to_string()}") + elif op == sr.SR_OP_MODIFIED: + print(f"MODIFIED: {old_val.to_string()} to {new_val.to_string()}") + elif op == sr.SR_OP_MOVED: + print(f"MOVED: {new_val.xpath()} after {old_val.xpath()}") + + +# Helper function for printing events. +def ev_to_str(ev): + if ev == sr.SR_EV_VERIFY: + return "verify" + elif ev == sr.SR_EV_APPLY: + return "apply" + elif ev == sr.SR_EV_ABORT: + return "abort" + else: + return "unknown" + + +# Function to print current configuration state. +# It does so by loading all the items of a session and printing them out. +def print_current_config(session, module_name): + select_xpath = f"/{module_name}:*//*" + + values = session.get_items(select_xpath) + + if values is not None: + print("========== BEGIN CONFIG ==========") + for i in range(values.val_cnt()): + print(values.val(i).to_string(), end='') + print("=========== END CONFIG ===========") + + +# Function to be called for subscribed client of given session whenever configuration changes. +def module_change_cb(sess, module_name, event, private_ctx): + try: + print("========== Notification " + ev_to_str(event) + " =============================================") + if event == sr.SR_EV_APPLY: + print_current_config(sess, module_name) + + print("========== CHANGES: =============================================") + + change_path = f"/{module_name}:*" + + it = sess.get_changes_iter(change_path) + + while True: + change = sess.get_change_next(it) + if change is None: + break + print_change(change.oper(), change.old_val(), change.new_val()) + + print("========== END OF CHANGES =======================================") + except Exception as e: + print(e) + + return sr.SR_ERR_OK + + +def main(): + # Notable difference between c implementation is using exception mechanism for open handling unexpected events. + # Here it is useful because `Connection`, `Session` and `Subscribe` could throw an exception. + try: + module_name = "ietf-interfaces" + if len(sys.argv) > 1: + module_name = sys.argv[1] + else: + print("\nYou can pass the module name to be subscribed as the first argument") + + print(f"Application will watch for changes in {module_name}") + + # connect to sysrepo + conn = sr.Connection(module_name) + + # start session + sess = sr.Session(conn) + + # subscribe for changes in running config */ + subscribe = sr.Subscribe(sess) + + subscribe.module_change_subscribe(module_name, module_change_cb) + + try: + print_current_config(sess, module_name) + except Exception as e: + print(e) + + print("========== STARTUP CONFIG APPLIED AS RUNNING ==========") + + sr.global_loop() + + print("Application exit requested, exiting.") + + except Exception as e: + print(e) + + +if __name__ == '__main__': + main() diff --git a/csit/plans/cps/sdnc/certs/certs.properties b/csit/plans/cps/sdnc/certs/certs.properties new file mode 100644 index 000000000..f8f3fa72b --- /dev/null +++ b/csit/plans/cps/sdnc/certs/certs.properties @@ -0,0 +1,2 @@ +keys0.zip +***** diff --git a/csit/plans/cps/sdnc/certs/keys0.zip b/csit/plans/cps/sdnc/certs/keys0.zip new file mode 100644 index 000000000..48b4d90a1 Binary files /dev/null and b/csit/plans/cps/sdnc/certs/keys0.zip differ diff --git a/csit/plans/cps/sdnc/docker-compose.yml b/csit/plans/cps/sdnc/docker-compose.yml new file mode 100644 index 000000000..1b7fe1f48 --- /dev/null +++ b/csit/plans/cps/sdnc/docker-compose.yml @@ -0,0 +1,64 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation +# ================================================================================ +# 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========================================================= + +version: '3' + +services: + mariadb: + image: mariadb:10.1.11 + ports: + - "3306:3306" + container_name: mariadb + environment: + - MYSQL_ROOT_PASSWORD=password + hostname: + mariadb.so.testlab.onap.org + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + sdnc: + image: onap/sdnc-image:1.8.1 + container_name: sdnc + volumes: + - /etc/localtime:/etc/localtime:ro + - $SDNC_CERT_PATH:/opt/opendaylight/current/certs + entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"] + ports: + - "8282:8181" + hostname: + sdnc + depends_on: + - mariadb + environment: + - MYSQL_ROOT_PASSWORD=password + - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties + - MYSQL_PASSWD=password + - ODL_CERT_DIR=/opt/opendaylight/current/certs + - ODL_ADMIN_USERNAME=admin + - ODL_ADMIN_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + dns: + - ${DNS_IP_ADDR-10.0.100.1} + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + extra_hosts: + - sdnctldb02:${LOCAL_IP} + - sdnctldb01:${LOCAL_IP} + - dbhost:${LOCAL_IP} \ No newline at end of file diff --git a/csit/plans/cps/sdnc/sdnc_setup.sh b/csit/plans/cps/sdnc/sdnc_setup.sh new file mode 100644 index 000000000..18d21b388 --- /dev/null +++ b/csit/plans/cps/sdnc/sdnc_setup.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# @author Rahul Tyagi (rahul.tyagi@est.tech) +# setup sdnc + +export SDNC_CERT_PATH=$WORKSPACE/plans/cps/sdnc/certs + +#start SDNC containers with docker compose and configuration from docker-compose.yml +docker-compose -f $WORKSPACE/plans/cps/sdnc/docker-compose.yml up -d + +# WAIT 10 minutes maximum and test every 30 seconds if SDNC is up using HealthCheck API +TIME_OUT=600 +INTERVAL=30 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); + echo $response + + if [ "$response" == "200" ]; then + echo SDNC started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi \ No newline at end of file diff --git a/csit/plans/cps/setup.sh b/csit/plans/cps/setup.sh new file mode 100755 index 000000000..2fc0ec487 --- /dev/null +++ b/csit/plans/cps/setup.sh @@ -0,0 +1,129 @@ +#!/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. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd. +# Modifications Copyright (C) 2021 Pantheon.tech +# Modifications Copyright (C) 2021 Bell Canada. +# Modifications Copyright (C) 2021 Nordix Foundation. +# +# Branched from ccsdk/distribution to this repository Feb 23, 2021 +# + +# Copy docker-compose.yml and application.yml to archives +mkdir -p $WORKSPACE/archives/docker-compose +cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/docker-compose +cd $WORKSPACE/archives/docker-compose + +# Set env variables for docker compose +export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') +export DMI_SERVICE_URL=http://$LOCAL_IP:8783 +export DB_HOST=$LOCAL_IP +export SDNC_HOST=$LOCAL_IP +export CPS_CORE_HOST=$LOCAL_IP +export DB_USERNAME=cps +export DB_PASSWORD=cps +# Use latest image version +export VERSION=latest + +# download docker-compose of a required version (1.25.0 supports configuration of version 3.7) +curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose +chmod +x docker-compose + +# start CPS and PostgreSQL containers with docker compose +docker network create test_network +./docker-compose up -d + +###################### setup sdnc ############################ +source $WORKSPACE/plans/cps/sdnc/sdnc_setup.sh + +###################### setup pnfsim ########################## +docker-compose -f $WORKSPACE/plans/cps/pnfsim/docker-compose.yml up -d + +# Allow time for netconf-pnp-simulator & SDNC to come up fully +sleep 30s + +SDNC_TIME_OUT=250 +SDNC_INTERVAL=10 +SDNC_TIME=0 + +while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do + + # Mount netconf node + + curl --location --request PUT 'http://'"$LOCAL_IP"':8282/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \ + --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "node": [ + { + "node-id": "PNFDemo", + "netconf-node-topology:protocol": { + "name": "TLS" + }, + "netconf-node-topology:host": '"$LOCAL_IP"', + "netconf-node-topology:key-based": { + "username": "netconf", + "key-id": "ODL_private_key_0" + }, + "netconf-node-topology:port": 6512, + "netconf-node-topology:tcp-only": false, + "netconf-node-topology:max-connection-attempts": 5 + } + ] + }' + + # Verify node has been mounted + + RESPONSE=$( curl --location --request GET 'http://'"$LOCAL_IP"':8282/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==') + + if [[ "$RESPONSE" == *"PNFDemo"* ]]; then + echo "Node mounted in $SDNC_TIME" + break; + fi + + sleep $SDNC_INTERVAL + SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL)) + +done + +# Validate CPS service initialization completed via periodic log checking for line like below: +# org.onap.cps.Application ... Started Application in X.XXX seconds + +TIME_OUT=300 +INTERVAL=5 +TIME=0 + +while [ "$TIME" -le "$TIME_OUT" ]; do + LOG_FOUND=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.Application" | egrep -c "Started Application in" ) + + if [ "$LOG_FOUND" -gt 0 ]; then + echo "CPS Service started" + break; + fi + + echo "Sleep $INTERVAL seconds before next check for CPS initialization (waiting $TIME seconds; timeout is $TIME_OUT seconds)" + sleep $INTERVAL + TIME=$((TIME + INTERVAL)) +done + +if [ "$TIME" -gt "$TIME_OUT" ]; then + echo "TIME OUT: CPS Service wasn't able to start in $TIME_OUT seconds, setup failed." + exit 1; +fi + +# Pass variables required for Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v CPS_HOST:$LOCAL_IP -v CPS_PORT:8883 -v DMI_HOST:$LOCAL_IP -v DMI_PORT:8783 -v MANAGEMENT_PORT:8887 -v DATADIR:$WORKSPACE/data" \ No newline at end of file diff --git a/csit/plans/cps/teardown.sh b/csit/plans/cps/teardown.sh new file mode 100755 index 000000000..3ef50d414 --- /dev/null +++ b/csit/plans/cps/teardown.sh @@ -0,0 +1,32 @@ +#!/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. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# Modifications copyright (c) 2020 Samsung Electronics Co., Ltd. +# Modifications Copyright (C) 2021 Pantheon.tech +# Modifications Copyright (C) 2021 Nordix Foundation +# Branched from ccsdk/distribution to this repository Feb 23, 2021 +# + +echo 'Stopping, Removing all running containers...' +docker stop $(docker ps -aq) && docker rm $(docker ps -aq) + +echo 'Removing Volumes...' +echo y | docker volume prune + +echo 'Removing Networks...' +echo y | docker network prune + diff --git a/csit/plans/cps/testplan.txt b/csit/plans/cps/testplan.txt new file mode 100644 index 000000000..8069bb72e --- /dev/null +++ b/csit/plans/cps/testplan.txt @@ -0,0 +1,24 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation +# ================================================================================ +# 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========================================================= + +# Test suites are relative paths under csit/tests/. +# Place the suites in run order. +actuator +cps-model-sync +ncmp-passthrough +cps-admin +cps-data + diff --git a/csit/plans/default/setup.sh b/csit/plans/default/setup.sh deleted file mode 100755 index e8074ddc0..000000000 --- a/csit/plans/default/setup.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/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. -# -# Modifications copyright (c) 2017 AT&T Intellectual Property -# Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd. -# Modifications Copyright (C) 2021 Pantheon.tech -# Modifications Copyright (C) 2021 Bell Canada. -# -# Branched from ccsdk/distribution to this repository Feb 23, 2021 -# - -# Copy docker-compose.yml and application.yml to archives -mkdir -p $WORKSPACE/archives/docker-compose -cp $WORKSPACE/../docker-compose/*.yml $WORKSPACE/archives/docker-compose -cd $WORKSPACE/archives/docker-compose - -# Set env variables for docker compose -export DB_HOST=dbpostgresql -export DB_USERNAME=cps -export DB_PASSWORD=cps -# Use latest image version -export VERSION=latest - -# download docker-compose of a required version (1.25.0 supports configuration of version 3.7) -curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose -chmod +x docker-compose - -# start CPS and PostgreSQL containers with docker compose -./docker-compose up -d -# Validate CPS service initialization completed via periodic log checking for line like below: -# org.onap.cps.Application ... Started Application in X.XXX seconds - -TIME_OUT=300 -INTERVAL=5 -TIME=0 - -while [ "$TIME" -le "$TIME_OUT" ]; do - LOG_FOUND=$( ./docker-compose logs --tail="all" | grep "org.onap.cps.Application" | egrep -c "Started Application in" ) - - if [ "$LOG_FOUND" -gt 0 ]; then - echo "CPS Service started" - break; - fi - - echo "Sleep $INTERVAL seconds before next check for CPS initialization (waiting $TIME seconds; timeout is $TIME_OUT seconds)" - sleep $INTERVAL - TIME=$((TIME + INTERVAL)) -done - -if [ "$TIME" -gt "$TIME_OUT" ]; then - echo "TIME OUT: CPS Service wasn't able to start in $TIME_OUT seconds, setup failed." - exit 1; -fi - -# The CPS host according to docker-compose.yml -CPS_HOST="localhost" -CPS_PORT="8883" - -MANAGEMENT_PORT="8887" - -# Pass variables required for Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v CPS_HOST:$CPS_HOST -v CPS_PORT:$CPS_PORT -v MANAGEMENT_PORT:$MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data" - diff --git a/csit/plans/default/teardown.sh b/csit/plans/default/teardown.sh deleted file mode 100755 index f9368f9df..000000000 --- a/csit/plans/default/teardown.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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. -# -# Modifications copyright (c) 2017 AT&T Intellectual Property -# Modifications copyright (c) 2020 Samsung Electronics Co., Ltd. -# Modifications Copyright (C) 2021 Pantheon.tech -# -# Branched from ccsdk/distribution to this repository Feb 23, 2021 -# - -cd $WORKSPACE/archives/docker-compose -./docker-compose down -v diff --git a/csit/plans/default/testplan.txt b/csit/plans/default/testplan.txt deleted file mode 100644 index e4e875988..000000000 --- a/csit/plans/default/testplan.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Test suites are relative paths under csit/tests/. -# Place the suites in run order. -actuator -cps-admin -cps-data - -- cgit 1.2.3-korg