aboutsummaryrefslogtreecommitdiffstats
path: root/csit/plans
diff options
context:
space:
mode:
authorJosephKeenan <joseph.keenan@est.tech>2021-10-01 10:40:47 +0100
committerRahul Tyagi <rahul.tyagi@est.tech>2021-10-15 13:21:27 +0000
commitd181b0e51b6385105362c9b59239ab581cace45e (patch)
tree8bf865ada0f0573094dd5280f53dcaee15adfa51 /csit/plans
parent79456d8d3dd7390bb91f1a3ad107c8720c1e7def (diff)
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 <joseph.keenan@est.tech>
Diffstat (limited to 'csit/plans')
-rwxr-xr-xcsit/plans/cps/pnfsim/docker-compose.yml28
-rwxr-xr-xcsit/plans/cps/pnfsim/netconf-config/LICENSE13
-rw-r--r--csit/plans/cps/pnfsim/netconf-config/stores.yang63
-rwxr-xr-xcsit/plans/cps/pnfsim/netconf-config/subscriber.py131
-rw-r--r--csit/plans/cps/sdnc/certs/certs.properties2
-rw-r--r--csit/plans/cps/sdnc/certs/keys0.zipbin0 -> 5057 bytes
-rw-r--r--csit/plans/cps/sdnc/docker-compose.yml64
-rw-r--r--csit/plans/cps/sdnc/sdnc_setup.sh49
-rwxr-xr-xcsit/plans/cps/setup.sh (renamed from csit/plans/default/setup.sh)71
-rwxr-xr-xcsit/plans/cps/teardown.sh (renamed from csit/plans/default/teardown.sh)13
-rw-r--r--csit/plans/cps/testplan.txt24
-rw-r--r--csit/plans/default/testplan.txt6
12 files changed, 446 insertions, 18 deletions
diff --git a/csit/plans/cps/pnfsim/docker-compose.yml b/csit/plans/cps/pnfsim/docker-compose.yml
new file mode 100755
index 0000000000..568f98f415
--- /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 0000000000..3bc5b026c6
--- /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 0000000000..b24ac0e1ac
--- /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 0000000000..5147c93458
--- /dev/null
+++ b/csit/plans/cps/pnfsim/netconf-config/subscriber.py
@@ -0,0 +1,131 @@
+#!/usr/bin/env python3
+
+__author__ = "Mislav Novakovic <mislav.novakovic@sartura.hr>"
+__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 0000000000..f8f3fa72b6
--- /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 0000000000..48b4d90a10
--- /dev/null
+++ b/csit/plans/cps/sdnc/certs/keys0.zip
Binary files differ
diff --git a/csit/plans/cps/sdnc/docker-compose.yml b/csit/plans/cps/sdnc/docker-compose.yml
new file mode 100644
index 0000000000..1b7fe1f48f
--- /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 0000000000..18d21b3889
--- /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/default/setup.sh b/csit/plans/cps/setup.sh
index e8074ddc0f..2fc0ec4877 100755
--- a/csit/plans/default/setup.sh
+++ b/csit/plans/cps/setup.sh
@@ -18,6 +18,7 @@
# 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
#
@@ -28,7 +29,11 @@ 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 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
@@ -39,7 +44,62 @@ curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compos
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
@@ -65,12 +125,5 @@ if [ "$TIME" -gt "$TIME_OUT" ]; then
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"
-
+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/default/teardown.sh b/csit/plans/cps/teardown.sh
index f9368f9dff..3ef50d4146 100755
--- a/csit/plans/default/teardown.sh
+++ b/csit/plans/cps/teardown.sh
@@ -17,9 +17,16 @@
# 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
#
-cd $WORKSPACE/archives/docker-compose
-./docker-compose down -v
+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 0000000000..8069bb72e7
--- /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/testplan.txt b/csit/plans/default/testplan.txt
deleted file mode 100644
index e4e875988a..0000000000
--- 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
-