diff options
author | Dan Timoney <dtimoney@att.com> | 2021-05-14 14:52:24 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2021-05-17 14:05:19 -0400 |
commit | 1ab7133b8e2fcbda0e4ac3f2e69790506b79b952 (patch) | |
tree | 9a7c0f64d2821377a24c115c6eeb96f30ee6e189 /csit | |
parent | a07e237412fc8b5fd7f1cc79909320a69a977306 (diff) |
Add CSIT test cases to sdnc/oam repo
Refactored csit tests currently in integration/csit and moved them as
part of sdnc/oam project so that we can trigger csit tests as part of
our docker builds.
Change-Id: I3acd25c7a6f1bc0ea9b2a2bd756cedc5fb2bf701
Issue-ID: SDNC-1545
Signed-off-by: Dan Timoney <dtimoney@att.com>
Former-commit-id: 16a6e0ea52a4a681ed2799612e310c867e720a61
Diffstat (limited to 'csit')
-rw-r--r-- | csit/.gitignore | 3 | ||||
-rw-r--r-- | csit/config/mount.xml.tmpl | 14 | ||||
-rw-r--r-- | csit/plans/sdnc/setup.sh | 161 | ||||
-rw-r--r-- | csit/plans/sdnc/teardown.sh | 22 | ||||
-rw-r--r-- | csit/plans/sdnc/testplan.txt | 3 | ||||
-rwxr-xr-x | csit/prepare-csit.sh | 49 | ||||
-rwxr-xr-x | csit/run-csit.sh | 200 | ||||
-rwxr-xr-x | csit/run-project-csit.sh | 33 | ||||
-rwxr-xr-x | csit/scripts/docker-compose.yml | 75 | ||||
-rwxr-xr-x | csit/sdnc-csit.env | 32 | ||||
-rw-r--r-- | csit/tests/sdnc/__init__.robot | 2 | ||||
-rw-r--r-- | csit/tests/sdnc/csr/netconf_pnp_simulator_csr.env | 17 | ||||
-rw-r--r-- | csit/tests/sdnc/csr/sdnc_csr.env | 17 | ||||
-rw-r--r-- | csit/tests/sdnc/resources/sdnc-keywords.robot | 61 | ||||
-rw-r--r-- | csit/tests/sdnc/resources/sdnc-properties.robot | 15 | ||||
-rw-r--r-- | csit/tests/sdnc/sdnc_csit.robot | 30 |
16 files changed, 734 insertions, 0 deletions
diff --git a/csit/.gitignore b/csit/.gitignore new file mode 100644 index 00000000..fbc74b3d --- /dev/null +++ b/csit/.gitignore @@ -0,0 +1,3 @@ +env.properties +config/mount.xml +archives/ diff --git a/csit/config/mount.xml.tmpl b/csit/config/mount.xml.tmpl new file mode 100644 index 00000000..04305252 --- /dev/null +++ b/csit/config/mount.xml.tmpl @@ -0,0 +1,14 @@ +<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> + <node-id>PNFDemo</node-id> + <key-based xmlns="urn:opendaylight:netconf-node-topology"> + <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL_private_key_0</key-id> + <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username> + </key-based> + <host xmlns="urn:opendaylight:netconf-node-topology">pnfaddr</host> + <port xmlns="urn:opendaylight:netconf-node-topology">6513</port> + <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> + <protocol xmlns="urn:opendaylight:netconf-node-topology"> + <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name> + </protocol> + <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">5</max-connection-attempts> +</node> diff --git a/csit/plans/sdnc/setup.sh b/csit/plans/sdnc/setup.sh new file mode 100644 index 00000000..037bc2e2 --- /dev/null +++ b/csit/plans/sdnc/setup.sh @@ -0,0 +1,161 @@ +#!/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) 2020-2021 Samsung Electronics Co., Ltd. +# Modifications copyright (c) 2021 AT&T Intellectual Property +# + +# + +###################### Netconf Simulator Setup ###################### + +# Get integration/simulators +if [ -d ${WORKSPACE}/archives/pnf-simulator ] +then + rm -rf ${WORKSPACE}/archives/pnf-simulator +fi +mkdir ${WORKSPACE}/archives/pnf-simulator +git clone "https://gerrit.onap.org/r/integration/simulators/pnf-simulator" ${WORKSPACE}/archives/pnf-simulator + +# Fix docker-compose to add nexus repo for onap dockers +mv ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig +cat ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig | sed -e "s/image: onap/image: nexus3.onap.org:10001\/onap/" > ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml + +# Remove carriage returns (if any) from netopeer start script +mv ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh.orig +cat ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh.orig | sed -e "s/\r$//g" > ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh +chmod 755 ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh + + +# Start Netconf Simulator Container with docker-compose and configuration from docker-compose.yml +docker-compose -f "${WORKSPACE}"/archives/pnf-simulator/netconfsimulator/docker-compose.yml up -d + +# Add test user in netopeer container +sleep 60 +docker exec netconfsimulator_netopeer_1 useradd --system test + +############################## SDNC Setup ############################## + +# Copy client certs from netconf simulator to SDNC certs directory +mkdir /tmp/keys0 +cp ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/tls/client.crt /tmp/keys0 +cp ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/tls/client.key /tmp/keys0 +cp ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/tls/ca.crt /tmp/keys0/trustedCertificates.crt +cwd=$(pwd) +cd /tmp +if [ ! -d ${SDNC_CERT_PATH} ] +then + mkdir -p ${SDNC_CERT_PATH} +fi +chmod -f go+w $SDNC_CERT_PATH +cat > $SDNC_CERT_PATH/certs.properties <<-END +keys0.zip +***** +END +zip -r $SDNC_CERT_PATH/keys0.zip keys0 +rm -rf /tmp/keys0 + + +# Export default Networking bridge created on the host machine +export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') + +unset http_proxy https_proxy + + +# start SDNC containers with docker compose and configuration from docker-compose.yml +docker-compose -f ${SCRIPTS}/docker-compose.yml up -d + +# WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds + +TIME_OUT=300 +INTERVAL=10 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + +docker exec ${SDNC_CONTAINER_NAME} cat /opt/opendaylight/data/log/karaf.log | grep 'warp coils' + + if [ $? == 0 ] ; then + echo SDNC karaf started in $TIME seconds + break; + fi + + echo Sleep $INTERVAL seconds before testing if SDNC is up. Total wait time up until 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, setup failed + exit 1; +fi + +num_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | tail -1 | cut -d' ' -f1) + + if [ "$num_bundles" -ge 333 ]; then + num_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | tail -1 | cut -d' ' -f1) + + num_failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep Failure | wc -l) + failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep Failure) + echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles. + fi + +if [ "$num_failed_bundles" -ge 1 ]; then + echo "The following bundle(s) are in a failed state: " + echo " $failed_bundles" +fi + +# Check if certificate installation is done +TIME_OUT=300 +INTERVAL=10 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + + docker-compose -f "${SCRIPTS}"/docker-compose.yml logs sdnc | grep 'Everything OK in Certificate Installation' + + if [ $? == 0 ] ; then + echo SDNC karaf 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, setup failed + exit 1; +fi + +# Update default Networking bridge IP in mount.json file +cp ${REQUEST_DATA_PATH}/mount.xml.tmpl ${REQUEST_DATA_PATH}/mount.xml +sed -i "s/pnfaddr/${LOCAL_IP}/g" "${REQUEST_DATA_PATH}"/mount.xml + + +######################################################################### + +# Export SDNC, AAF-Certservice-Cient, Netconf-Pnp-Simulator Continer Names +export REQUEST_DATA_PATH="${REQUEST_DATA_PATH}" +export SDNC_CONTAINER_NAME="${SDNC_CONTAINER_NAME}" +export CLIENT_CONTAINER_NAME="${CLIENT_CONTAINER_NAME}" +export NETCONF_PNP_SIM_CONTAINER_NAME="${NETCONF_PNP_SIM_CONTAINER_NAME}" + +REPO_IP='127.0.0.1' +ROBOT_VARIABLES+=" -v REPO_IP:${REPO_IP} " +ROBOT_VARIABLES+=" -v SCRIPTS:${SCRIPTS} " + +echo "Finished executing setup for SDNC" + diff --git a/csit/plans/sdnc/teardown.sh b/csit/plans/sdnc/teardown.sh new file mode 100644 index 00000000..0c6c9944 --- /dev/null +++ b/csit/plans/sdnc/teardown.sh @@ -0,0 +1,22 @@ +#!/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. +# + +docker-compose -f "${SCRIPTS}"/docker-compose.yml down -v +docker-compose -f "${WORKSPACE}"/archives/pnf-simulator/netconfsimulator/docker-compose.yml down -v diff --git a/csit/plans/sdnc/testplan.txt b/csit/plans/sdnc/testplan.txt new file mode 100644 index 00000000..9810e58a --- /dev/null +++ b/csit/plans/sdnc/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under csit/tests/. +# Place the suites in run order. +sdnc
\ No newline at end of file diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh new file mode 100755 index 00000000..3cc143de --- /dev/null +++ b/csit/prepare-csit.sh @@ -0,0 +1,49 @@ +#!/bin/bash -x +# +# Copyright 2019-2021 © Samsung Electronics 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. +# +# This script installs common libraries required by CSIT tests +# + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi + +TESTPLANDIR=${WORKSPACE}/${TESTPLAN} + +# Assume that if ROBOT_VENV is set and virtualenv with system site packages can be activated, +# ci-management/jjb/integration/include-raw-integration-install-robotframework.sh has already +# been executed + +if [ -f ${WORKSPACE}/env.properties ]; then + source ${WORKSPACE}/env.properties +fi +if [ -f ${ROBOT_VENV}/bin/activate ]; then + source ${ROBOT_VENV}/bin/activate +else + rm -rf /tmp/ci-management + rm -f ${WORKSPACE}/env.properties + cd /tmp + git clone "https://gerrit.onap.org/r/ci-management" + source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework.sh +fi + +# install eteutils +mkdir -p ${ROBOT_VENV}/src/onap +rm -rf ${ROBOT_VENV}/src/onap/testsuite +pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre + +pip freeze + diff --git a/csit/run-csit.sh b/csit/run-csit.sh new file mode 100755 index 00000000..36fdc597 --- /dev/null +++ b/csit/run-csit.sh @@ -0,0 +1,200 @@ +#!/bin/bash -x +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Modification Copyright 2019-2021 © Samsung Electronics 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. +# +# $1 project/functionality +# $2 robot options + + +# +# functions +# + +function on_exit(){ + rc=$? + if [[ ${WORKSPACE} ]]; then + if [[ ${WORKDIR} ]]; then + rsync -av "$WORKDIR/" "$WORKSPACE/archives/$TESTPLAN" + fi + # Record list of active docker containers + docker ps --format "{{.Image}}" > "$WORKSPACE/archives/$TESTPLAN/_docker-images.log" + + # show memory consumption after all docker instances initialized + docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-2-after-robot.txt" + fi + # Run teardown script plan if it exists + cd "${TESTPLANDIR}" + TEARDOWN="${TESTPLANDIR}/teardown.sh" + if [ -f "${TEARDOWN}" ]; then + echo "Running teardown script ${TEARDOWN}" + source_safely "${TEARDOWN}" + fi + # TODO: do something with the output + exit $rc +} +# ensure that teardown and other finalizing steps are always executed +trap on_exit EXIT + +function docker_stats(){ + #General memory details + echo "> top -bn1 | head -3" + top -bn1 | head -3 + echo + + echo "> free -h" + free -h + echo + + #Memory details per Docker + echo "> docker ps" + docker ps + echo + + echo "> docker stats --no-stream" + docker stats --no-stream + echo +} + +# save current set options +function save_set() { + RUN_CSIT_SAVE_SET="$-" + RUN_CSIT_SHELLOPTS="$SHELLOPTS" +} + +# load the saved set options +function load_set() { + _setopts="$-" + + # bash shellopts + for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do + set +o ${i} + done + for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do + set -o ${i} + done + + # other options + for i in $(echo "$_setopts" | sed 's/./& /g') ; do + set +${i} + done + set -${RUN_CSIT_SAVE_SET} +} + +# set options for quick bailout when error +function harden_set() { + set -xeo pipefail + set +u # enabled it would probably fail too many often +} + +# relax set options so the sourced file will not fail +# the responsibility is shifted to the sourced file... +function relax_set() { + set +e + set +o pipefail +} + +# wrapper for sourcing a file +function source_safely() { + [ -z "$1" ] && return 1 + relax_set + . "$1" + load_set +} + +# +# main +# + + +# set and save options for quick failure +harden_set && save_set + +if [ $# -eq 0 ] +then + echo + echo "Usage: $0 plans/<project>/<functionality> [<robot-options>]" + echo + echo " <project>, <functionality>, <robot-options>: " + echo " The same values as for the '{project}-csit-{functionality}' JJB job template." + echo + exit 1 +fi + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=$(git rev-parse --show-toplevel) +fi + +if [ -f "${WORKSPACE}/${1}/testplan.txt" ]; then + export TESTPLAN="${1}" +else + echo "testplan not found: ${WORKSPACE}/${TESTPLAN}/testplan.txt" + exit 2 +fi + +export TESTOPTIONS="${2}" + +rm -rf "$WORKSPACE/archives/$TESTPLAN" +mkdir -p "$WORKSPACE/archives/$TESTPLAN" + +TESTPLANDIR="${WORKSPACE}/${TESTPLAN}" + +# Set env variables +source_safely "${WORKSPACE}/sdnc-csit.env" + +# Run installation of prerequired libraries +source_safely "${WORKSPACE}/prepare-csit.sh" + +# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh +source_safely "${ROBOT_VENV}/bin/activate" + +WORKDIR=$(mktemp -d --suffix=-robot-workdir) +cd "${WORKDIR}" + +# Add csit scripts to PATH +export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin" +export SCRIPTS="${WORKSPACE}/scripts" +export ROBOT_VARIABLES= + +# Sign in to nexus3 docker repo +docker login -u docker -p docker nexus3.onap.org:10001 + +# Run setup script plan if it exists +cd "${TESTPLANDIR}" +SETUP="${TESTPLANDIR}/setup.sh" +if [ -f "${SETUP}" ]; then + echo "Running setup script ${SETUP}" + source_safely "${SETUP}" +fi + +# show memory consumption after all docker instances initialized +docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-1-after-setup.txt" + +# Run test plan +cd "$WORKDIR" +echo "Reading the testplan:" +cat "${TESTPLANDIR}/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${WORKSPACE}/tests/|" > testplan.txt +cat testplan.txt +SUITES=$( xargs -a testplan.txt ) + +echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" +echo "Starting Robot test suites ${SUITES} ..." +relax_set +python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} +RESULT=$? +load_set +echo "RESULT: $RESULT" +# Note that the final steps are done in on_exit function after this exit! +exit $RESULT diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh new file mode 100755 index 00000000..12eb349f --- /dev/null +++ b/csit/run-project-csit.sh @@ -0,0 +1,33 @@ +#!/bin/bash -x +# +# Copyright 2020-2021 © Samsung Electronics 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. +# + +# $1 test options (passed on to run-csit.sh as such) +# + +export TESTOPTIONS=${1} +export WORKSPACE=$(git rev-parse --show-toplevel)/csit + +rm -rf ${WORKSPACE}/archives +mkdir -p ${WORKSPACE}/archives +cd ${WORKSPACE} + +# Execute all testsuites defined under plans subdirectory +for dir in plans/*/ +do + dir=${dir%*/} # remove the trailing / + ./run-csit.sh ${dir} ${TESTOPTIONS} +done diff --git a/csit/scripts/docker-compose.yml b/csit/scripts/docker-compose.yml new file mode 100755 index 00000000..13ee963b --- /dev/null +++ b/csit/scripts/docker-compose.yml @@ -0,0 +1,75 @@ +version: '3' + +services: + mariadb: + image: nexus3.onap.org:10001/mariadb:10.1.11 + ports: + - "3306:3306" + container_name: mariadb + volumes: + - /etc/localtime:/etc/localtime:ro + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + hostname: + mariadb + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + + sdnc: + image: onap/sdnc-image:latest + 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 + links: + - mariadb:dbhost + - mariadb:sdnctldb01 + - mariadb:sdnctldb02 + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - 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} + - A1_TRUSTSTORE_PASSWORD=a1adapter + depends_on: + - mariadb + dns: + - ${DNS_IP_ADDR-10.0.100.1} + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" diff --git a/csit/sdnc-csit.env b/csit/sdnc-csit.env new file mode 100755 index 00000000..d944927f --- /dev/null +++ b/csit/sdnc-csit.env @@ -0,0 +1,32 @@ +export SDNC_CONTAINER_NAME=sdnc +export SDNC_CERT_PATH=${WORKSPACE}/archives/certs +export NETCONF_PNP_SIM_CONTAINER_NAME=netconf-simulator +export TEMP_DIR_PATH=${WORKSPACE}/tests/netconf_tls_post_deploy/tmp +export REQUEST_DATA_PATH=${WORKSPACE}/config + +export GERRIT_BRANCH=${GERRIT_BRANCH:-master} +export NEXUS_USERNAME=${NEXUS_USERNAME:-docker} +export NEXUS_PASSWD=${NEXUS_PASSWD:-docker} +export NEXUS_DOCKER_REPO=${NEXUS_DOCKER_REPO:-nexus3.onap.org:10001} +export MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-secretPassword} +export MYSQL_USER=${MYSQL_USER:-testdb} +export MYSQL_PASSWORD=${MYSQL_PASSWORD:-test123} +export MYSQL_DATABASE=${MYSQL_DATABASE:-testdb} +export ODL_USER=${ODL_USER:-admin} +export ODL_PASSWORD=${ODL_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} +export HONEYCOMB_USER=${HONEYCOMB_USER:-admin} +export HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD:-admin} +export TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD:-changeit} +export KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD:-adminadmin} +export SO_USER=${SO_USER:-sdncaBpmn} +export SO_PASSWORD=${SO_PASSWORD:-password1$} +export NENG_USER=${NENG_USER:-ccsdkapps} +export NENG_PASSWORD=${NENG_PASSWORD:-ccsdkapps} +export SQL_CRYPTKEY=${SQL_CRYPTKEY:-crYptKeY} +export DMAAP_TOPIC=AUTO + + +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) +if [ "$MTU" == "" ]; then + export MTU="1450" +fi diff --git a/csit/tests/sdnc/__init__.robot b/csit/tests/sdnc/__init__.robot new file mode 100644 index 00000000..d7353060 --- /dev/null +++ b/csit/tests/sdnc/__init__.robot @@ -0,0 +1,2 @@ +1 *** Settings *** +2 Documentation SDNC - keystorecheck diff --git a/csit/tests/sdnc/csr/netconf_pnp_simulator_csr.env b/csit/tests/sdnc/csr/netconf_pnp_simulator_csr.env new file mode 100644 index 00000000..e85ab6cc --- /dev/null +++ b/csit/tests/sdnc/csr/netconf_pnp_simulator_csr.env @@ -0,0 +1,17 @@ +#Client Envs +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=P12 +KEYSTORE_PATH=/etc/onap/aaf/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/aaf/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#CSR Config Envs +COMMON_NAME=netconf.pnp.simulator.onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=netconf.com:netconfsimulator.com diff --git a/csit/tests/sdnc/csr/sdnc_csr.env b/csit/tests/sdnc/csr/sdnc_csr.env new file mode 100644 index 00000000..5d647de6 --- /dev/null +++ b/csit/tests/sdnc/csr/sdnc_csr.env @@ -0,0 +1,17 @@ +#Client CSR +REQUEST_TIMEOUT=30000 +OUTPUT_PATH=/var/certs +CA_NAME=RA +OUTPUT_TYPE=PEM +KEYSTORE_PATH=/etc/onap/aaf/certservice/certs/certServiceClient-keystore.jks +KEYSTORE_PASSWORD=secret +TRUSTSTORE_PATH=/etc/onap/aaf/certservice/certs/truststore.jks +TRUSTSTORE_PASSWORD=secret +#CSR Config Envs +COMMON_NAME=sdnc.onap.org +ORGANIZATION=Linux-Foundation +ORGANIZATION_UNIT=ONAP +LOCATION=San-Francisco +STATE=California +COUNTRY=US +SANS=example.com:sample.com
\ No newline at end of file diff --git a/csit/tests/sdnc/resources/sdnc-keywords.robot b/csit/tests/sdnc/resources/sdnc-keywords.robot new file mode 100644 index 00000000..7a3df839 --- /dev/null +++ b/csit/tests/sdnc/resources/sdnc-keywords.robot @@ -0,0 +1,61 @@ +*** Settings *** + +Resource ./sdnc-properties.robot + +Library Collections +Library RequestsLibrary +Library OperatingSystem + + +*** Keywords *** + +Create SDNC RESTCONF Session + [Documentation] Create session to OpenDaylight controller + ${auth}= Create List ${ODL_USER} ${ODL_PASSWORD} + Create Session sdnc_restconf ${SDNC_RESTCONF_URL} auth=${auth} + +Send Post Request And Validate Response + [Documentation] Send POST request to passed URL and validate received response + [Arguments] ${path} ${body} ${resp_code} + Create SDNC RESTCONF Session + &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json + ${resp}= POST On Session sdnc_restconf ${path} headers=${headers} json=${body} expected_status=${resp_code} + +Send Empty Post Request And Validate Response + [Documentation] Send POST request to passed URL and validate received response + [Arguments] ${path} ${resp_code} + Create SDNC RESTCONF Session + &{headers}= Create Dictionary Content-Type=application/json Content-Length=0 Accept=application/json + ${resp}= POST On Session sdnc_restconf ${path} headers=${headers} expected_status=${resp_code} + +Send Get Request And Validate Response Sdnc + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${resp_code} + CREATE SDNC RESTCONF Session + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= GET On Session sdnc_restconf ${path} headers=${headers} expected_status=${resp_code} + +Send Get Request And Validate TLS Connection Response + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${resp_code} + Create SDNC RESTCONF Session + ${mount}= Get File ${REQUEST_DATA_PATH}${/}mount.xml + &{headers}= Create Dictionary Content-Type=application/xml Accept=application/xml + ${resp}= PUT On Session sdnc_restconf ${path} data=${mount} headers=${headers} expected_status=201 + Sleep 30 + &{headers1}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp1}= GET On Session sdnc_restconf ${PNFSIM_MOUNT_PATH} headers=${headers1} expected_status=${resp_code} + + +Send Delete Request And Validate PNF Mount Deleted + [Documentation] Send request to passed url and validate received response + [Arguments] ${path} ${resp_code} + Create SDNC RESTCONF Session + ${mount}= Get File ${REQUEST_DATA_PATH}${/}mount.xml + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${deleteresponse}= DELETE On Session sdnc_restconf ${path} data=${mount} headers=${headers} expected_status=${resp_code} + Sleep 30 + ${del_topology}= DELETE On Session sdnc_restconf ${SDNC_NETWORK_TOPOLOGY} expected_status=${resp_code} + ${del_keystore}= DELETE On Session sdnc_restconf ${SDNC_KEYSTORE_CONFIG_PATH} + + diff --git a/csit/tests/sdnc/resources/sdnc-properties.robot b/csit/tests/sdnc/resources/sdnc-properties.robot new file mode 100644 index 00000000..bb618eb0 --- /dev/null +++ b/csit/tests/sdnc/resources/sdnc-properties.robot @@ -0,0 +1,15 @@ +*** Variables *** + +# SDNC Configuration +${ODL_USER} %{ODL_USER} +${ODL_PASSWORD} %{ODL_PASSWORD} +${REQUEST_DATA_PATH} %{REQUEST_DATA_PATH} +${SDNC_CONTAINER_NAME} %{SDNC_CONTAINER_NAME} +${SDNC_RESTCONF_URL} http://localhost:8282/restconf +${SDNC_HEALTHCHECK} /operations/SLI-API:healthcheck/ +${SDNC_KEYSTORE_CONFIG_PATH} /config/netconf-keystore:keystore +${SDNC_NETWORK_TOPOLOGY} /config/network-topology:network-topology +${SDNC_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo +${PNFSIM_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/turing-machine:turing-machine + + diff --git a/csit/tests/sdnc/sdnc_csit.robot b/csit/tests/sdnc/sdnc_csit.robot new file mode 100644 index 00000000..bd1479a6 --- /dev/null +++ b/csit/tests/sdnc/sdnc_csit.robot @@ -0,0 +1,30 @@ +*** Settings *** + +Documentation SDNC, Netconf-Pnp-Simulator E2E Test Case Scenarios + +Library RequestsLibrary +Resource ./resources/sdnc-keywords.robot + + +*** Test Cases *** +Check SDNC health + [Tags] SDNC-healthcheck + [Documentation] Sending healthcheck + Send Empty Post Request And Validate Response ${SDNC_HEALTHCHECK} 200 + +Check SDNC Keystore For PNF Simulator Certificates + [Tags] SDNC-PNFSIM-CERT-DEPLOYMENT + [Documentation] Checking Keystore after SDNC installation + Send Get Request And Validate Response Sdnc ${SDNC_KEYSTORE_CONFIG_PATH} 200 + + +Check SDNC NETCONF/TLS Connection to PNF Simulator + [Tags] SDNC-PNFSIM-TLS-CONNECTION-CHECK + [Documentation] Checking NETCONF/TLS connection to PNF Simulator + Send Get Request And Validate TLS Connection Response ${SDNC_MOUNT_PATH} 200 + +Check Dropping NETCONF/TLS Connection + [Tags] SDNC-PNFSIM-TLS-DISCONNECT-CHECK + [Documentation] Checking PNF Simulator Mount Delete from SDNC + Send Delete Request And Validate PNF Mount Deleted ${SDNC_MOUNT_PATH} 200 + |