header: schema_node_id
name: schema_node_id
type: NUMERIC
+
+ - changeSet:
+ author: cps
+ label: xnf-data-preload
+ id: 5.1
+ changes:
+ - sql:
+ comment: Fixes the id sequence after data insert with predefined ids
+ dbms: postgresql
+ sql: ALTER SEQUENCE IF EXISTS fragment_id_seq RESTART WITH 200
\ No newline at end of file
--- /dev/null
+{
+ "test-tree": {
+ "branch": [
+ {
+ "name": "Left",
+ "nest": {
+ "name": "Small",
+ "birds": [
+ "Sparrow",
+ "Robin",
+ "Finch"
+ ]
+ }
+ },
+ {
+ "name": "Right",
+ "nest": {
+ "name": "Big",
+ "birds": [
+ "Owl",
+ "Raven",
+ "Crow"
+ ]
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+module test-tree {
+ yang-version 1.1;
+
+ namespace "org:onap:cps:test:test-tree";
+ prefix tree;
+ revision "2020-02-02";
+
+ container test-tree {
+ list branch {
+ key "name";
+ leaf name {
+ type string;
+ }
+ container nest {
+ leaf name {
+ type string;
+ }
+ leaf-list birds {
+ type string;
+ }
+ }
+ }
+ }
+}
# Modifications copyright (c) 2020-2021 Samsung Electronics Co., Ltd.
# Modifications Copyright (C) 2021 Pantheon.tech
#
+# 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
# 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
+./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=10
+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" )
+ 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"
exit 1;
fi
-# TODO localhost works on a local environment, check if it's ok on jenkins
+# The CPS host according to docker-compose.yml
CPS_HOST="http://localhost:8883"
# Pass variables required for Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v SCRIPTS:$SCRIPTS -v CPS_HOST:$CPS_HOST"
+ROBOT_VARIABLES="-v CPS_HOST:$CPS_HOST -v DATADIR:$WORKSPACE/data"
# 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
+./docker-compose down -v
# Test suites are relative paths under csit/tests/.
# Place the suites in run order.
actuator
+cps-admin
+cps-data
#!/bin/bash -x
#
# Copyright 2019-2021 © Samsung Electronics Co., Ltd.
+# Modifications Copyright (C) 2021 Pantheon.tech
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# This script installs common libraries required by CSIT tests
#
-
-# Branched from integration/csit to this repository 18.2.2021
+# Branched from ccsdk/distribution to this repository Feb 23, 2021
#
if [ -z "$WORKSPACE" ]; then
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
# $1 project/functionality
# $2 robot options
-# Branched from integration/csit to this repository 18.2.2021
-#
+# Branched from ccsdk/distribution to this repository Feb 23, 2021
#
# functions
#!/bin/bash -x
#
# Copyright 2020-2021 © Samsung Electronics Co., Ltd.
+# Modifications Copyright (C) 2021 Pantheon.tech
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# Modifications Copyright (C) 2021 Pantheon.tech
+# Branched from ccsdk/distribution to this repository Feb 23, 2021
#
# $1 test options (passed on to run-csit.sh as such)
+++ /dev/null
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# Copyright (C) 2021 Pantheon.tech
-# ================================================================================
-# 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=========================================================
-#
-
-# $1 is endpoint for GET request
-
-echo "Testing CPS actuator endpoint $1"
-
-response=$(curl -o /dev/null -s -w "%{http_code}\n" -H "Accept: application/json" -H "Content-Type: application/json" -X GET $1)
-
-if [ "$response" == "200" ]; then
- echo "CPS Actuator endpoint check successful."
- exit 0;
-fi
-
-echo "CPS Actuator endpoint check failed with response code ${response}."
-exit 1
+++ /dev/null
-*** Settings ***
-Documentation CPS - Actuator endpoints
*** Settings ***
-Library OperatingSystem
-Library Process
+Documentation CPS - Actuator endpoints
+
+Library Collections
+Library RequestsLibrary
+
+Suite Setup Create Session CPS_HOST ${CPS_HOST}
*** Variables ***
-${check} ${SCRIPTS}/actuator/check_endpoint.sh
*** Test Cases ***
-Liveness Probe for CPS
- [Documentation] Liveness Probe
- ${result}= Run Process bash ${check} ${CPS_HOST}/manage/health/liveness >> actuator-test.log shell=yes
- Should Be Equal As Integers ${result.rc} 0
+Test Liveness Probe Endpoint
+ ${response}= GET On Session CPS_HOST /manage/health/liveness expected_status=200
+ Should Be Equal As Strings ${response.json()['status']} UP
-Readiness Probe for CPS
- [Documentation] Readiness Probe
- ${result}= Run Process bash ${check} ${CPS_HOST}/manage/health/readiness >> actuator-test.log shell=yes
- Should Be Equal As Integers ${result.rc} 0
+Test Readiness Probe Endpoint
+ ${response}= GET On Session CPS_HOST /manage/health/readiness expected_status=200
+ Should Be Equal As Strings ${response.json()['status']} UP
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation CPS Core - Admin REST API
+
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+
+Suite Setup Create Session CPS_HOST ${CPS_HOST}
+
+*** Variables ***
+
+${basePath} /cps/api
+${dataspaceName} CSIT-Dataspace
+${schemaSetName} CSIT-SchemaSet
+${anchorName} CSIT-Anchor
+
+*** Test Cases ***
+Create Dataspace
+ ${uri}= Set Variable ${basePath}/v1/dataspaces
+ ${params}= Create Dictionary dataspace-name=${dataspaceName}
+ ${response}= POST On Session CPS_HOST ${uri} params=${params}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Create Schema Set from YANG file
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets
+ ${params}= Create Dictionary schema-set-name=${schemaSetName}
+ ${fileData}= Get Binary File ${DATADIR}${/}test-tree.yang
+ ${fileTuple}= Create List test.yang ${fileData} application/zip
+ &{files}= Create Dictionary file=${fileTuple}
+ ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Create Schema Set from ZIP file
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets
+ ${params}= Create Dictionary schema-set-name=ZipTestSchemaSet
+ ${fileData}= Get Binary File ${DATADIR}${/}yang-resources.zip
+ ${fileTuple}= Create List test.zip ${fileData} application/zip
+ &{files}= Create Dictionary file=${fileTuple}
+ ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Get Schema Set info
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets/${schemaSetName}
+ ${response}= Get On Session CPS_HOST ${uri} expected_status=200
+ ${responseJson}= Set Variable ${response.json()}
+ Should Be Equal As Strings ${responseJson['name']} ${schemaSetName}
+ Should Be Equal As Strings ${responseJson['dataspaceName']} ${dataspaceName}
+
+Create Anchor
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors
+ ${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName}
+ ${response}= POST On Session CPS_HOST ${uri} params=${params}
+ Should Be Equal As Strings ${response.status_code} 201
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation CPS Core - Data REST API
+
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+
+Suite Setup Create Session CPS_HOST ${CPS_HOST}
+
+*** Variables ***
+
+${basePath} /cps/api
+${dataspaceName} CSIT-Dataspace
+${anchorName} CSIT-Anchor
+
+*** Test Cases ***
+Create Data Node
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes
+ ${headers} Create Dictionary Content-Type=application/json
+ ${jsonData}= Get Binary File ${DATADIR}${/}test-tree.json
+ ${response}= POST On Session CPS_HOST ${uri} headers=${headers} data=${jsonData}
+ Should Be Equal As Strings ${response.status_code} 201
+
+Get Data Node by XPath
+ ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/node
+ ${params}= Create Dictionary xpath=/test-tree/branch[@name='Left']/nest
+ ${response}= Get On Session CPS_HOST ${uri} params=${params} expected_status=200
+ ${responseJson}= Set Variable ${response.json()}
+ Should Be Equal As Strings ${responseJson['name']} Small
+
+