From 1668b5a62512993b0ae0650bdbff20ad67749fa5 Mon Sep 17 00:00:00 2001 From: ecaiyanlinux Date: Wed, 24 Feb 2021 20:11:18 +0100 Subject: Add csit in project repo using scripts in the project repo for csit Signed-off-by: ecaiyanlinux Issue-ID: CCSDK-3140 Change-Id: I08c0bbb55d6cd425c246362d40187738d26f2e43 --- .../config/application_configuration.json.nosdnc | 39 +++++ .../config/application_configuration.json.sdnc | 48 +++++++ csit/scripts/healthcheck/data/preparePmsData.sh | 157 +++++++++++++++++++++ .../healthcheck/data/testdata/OSC/policy_type.json | 45 ++++++ csit/scripts/healthcheck/data/testdata/policy.json | 9 ++ .../scripts/healthcheck/data/testdata/service.json | 5 + .../healthcheck/data/testdata/v2/policy_osc.json | 16 +++ .../data/testdata/v2/policy_std_v2.json | 16 +++ .../healthcheck/data/testdata/v2/policy_type.json | 56 ++++++++ .../healthcheck/data/testdata/v2/service.json | 5 + csit/scripts/healthcheck/docker-compose.yml | 78 ++++++++++ .../config/https-props-a1controller.properties | 24 ++++ csit/scripts/healthcheck/sdnc/docker-compose.yml | 94 ++++++++++++ csit/scripts/healthcheck/test/health_check.sh | 68 +++++++++ csit/scripts/healthcheck/test/pms_a1sim.sh | 63 +++++++++ csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh | 68 +++++++++ csit/scripts/healthcheck/test/setup.sh | 32 +++++ 17 files changed, 823 insertions(+) create mode 100644 csit/scripts/healthcheck/config/application_configuration.json.nosdnc create mode 100644 csit/scripts/healthcheck/config/application_configuration.json.sdnc create mode 100755 csit/scripts/healthcheck/data/preparePmsData.sh create mode 100644 csit/scripts/healthcheck/data/testdata/OSC/policy_type.json create mode 100644 csit/scripts/healthcheck/data/testdata/policy.json create mode 100644 csit/scripts/healthcheck/data/testdata/service.json create mode 100644 csit/scripts/healthcheck/data/testdata/v2/policy_osc.json create mode 100644 csit/scripts/healthcheck/data/testdata/v2/policy_std_v2.json create mode 100644 csit/scripts/healthcheck/data/testdata/v2/policy_type.json create mode 100644 csit/scripts/healthcheck/data/testdata/v2/service.json create mode 100644 csit/scripts/healthcheck/docker-compose.yml create mode 100644 csit/scripts/healthcheck/sdnc/config/https-props-a1controller.properties create mode 100644 csit/scripts/healthcheck/sdnc/docker-compose.yml create mode 100755 csit/scripts/healthcheck/test/health_check.sh create mode 100755 csit/scripts/healthcheck/test/pms_a1sim.sh create mode 100755 csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh create mode 100755 csit/scripts/healthcheck/test/setup.sh (limited to 'csit/scripts/healthcheck') diff --git a/csit/scripts/healthcheck/config/application_configuration.json.nosdnc b/csit/scripts/healthcheck/config/application_configuration.json.nosdnc new file mode 100644 index 00000000..deb88a08 --- /dev/null +++ b/csit/scripts/healthcheck/config/application_configuration.json.nosdnc @@ -0,0 +1,39 @@ +{ + "config":{ + "//description":"Application configuration", + "ric":[ + { + "name":"ric1", + "baseUrl":"https://a1-sim-OSC:8185/", + "managedElementIds":[ + "kista_1", + "kista_2" + ] + }, + { + "name":"ric2", + "baseUrl":"https://a1-sim-STD-v2:8185/", + "managedElementIds":[ + "kista_1", + "kista_2" + ] + } + ], + "streams_publishes":{ + "dmaap_publisher":{ + "type":"message_router", + "dmaap_info":{ + "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE" + } + } + }, + "streams_subscribes":{ + "dmaap_subscriber":{ + "type":"message_router", + "dmaap_info":{ + "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" + } + } + } + } + } \ 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 new file mode 100644 index 00000000..66af21fd --- /dev/null +++ b/csit/scripts/healthcheck/config/application_configuration.json.sdnc @@ -0,0 +1,48 @@ +{ + "config":{ + "controller": [ + { + "name": "controller1", + "baseUrl": "https://sdnc:8443", + "userName": "admin", + "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" + } + ], + "ric":[ + { + "name":"ric1", + "controller": "controller1", + "baseUrl":"https://a1-sim-OSC:8185/", + "managedElementIds":[ + "kista_1", + "kista_2" + ] + }, + { + "name":"ric2", + "controller": "controller1", + "baseUrl":"https://a1-sim-STD-v2:8185/", + "managedElementIds":[ + "kista_1", + "kista_2" + ] + } + ], + "streams_publishes":{ + "dmaap_publisher":{ + "type":"message_router", + "dmaap_info":{ + "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE" + } + } + }, + "streams_subscribes":{ + "dmaap_subscriber":{ + "type":"message_router", + "dmaap_info":{ + "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" + } + } + } + } + } diff --git a/csit/scripts/healthcheck/data/preparePmsData.sh b/csit/scripts/healthcheck/data/preparePmsData.sh new file mode 100755 index 00000000..383ceeb1 --- /dev/null +++ b/csit/scripts/healthcheck/data/preparePmsData.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +# ============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================================================= +# + +# The scripts in data/ will generate some dummy data in the running system. +# It will create: +# one policy type in a1-sim-OSC +# one service in policy agent +# one policy in a1-sim-OSC +# one policy in a1-sim-STD + +# Run command: +# ./preparePmsData.sh [policy-agent port] [a1-sim-OSC port] [a1-sim-STD port] [http/https] + +policy_agent_port=${1:-8081} +a1_sim_OSC_port=${2:-30001} +a1_sim_STD_port=${3:-30005} +httpx=${4:-"http"} +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) + +echo "using policy_agent port: "$policy_agent_port +echo "using a1-sim-OSC port: "$a1_sim_OSC_port +echo "using a1-sim-STD port: "$a1_sim_STD_port +echo "using protocol: "$httpx +echo -e "\n" + +checkRes (){ + if [ "$res" != "$expect" ]; then + echo "$res is not expected! exit!" + exit 1; + fi +} + +echo "policy agent status:" +curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/status" +res=$($curlString) +echo "$res" +expect="hunky dory200" +checkRes +echo -e "\n" + +echo "ric1 version:" +curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/counter/interface" +res=$($curlString) +echo "$res" +expect="OSC_2.1.0200" +checkRes +echo -e "\n" + +echo "ric2 version:" +curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/counter/interface" +res=$($curlString) +echo "$res" +expect="STD_2.0.0200" +checkRes +echo -e "\n" + +echo "create policy type 1 to ric1:" +curlString="curl -X PUT -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/OSC/policy_type.json" +res=$($curlString) +echo "$res" +expect="Policy type 1 is OK.201" +checkRes +echo -e "\n" + +echo "create policy type 2 to ric2:" +curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @${SHELL_FOLDER}/testdata/v2/policy_type.json" +res=$($curlString) +echo "$res" +expect="Policy type 2 is OK.201" +checkRes +echo -e "\n" + +for i in {1..60}; do + echo "policy types from policy agent:" + curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policy-types" + res=$($curlString) + echo "$res" + expect="{\"policytype_ids\":[\"1\",\"2\"]}200" + if [ "$res" == "$expect" ]; then + echo -e "\n" + break; + else + sleep $i + fi +done + +echo "create service ric-registration to policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/services" --data-binary @${SHELL_FOLDER}/testdata/v2/service.json" +res=$($curlString) +echo "$res" +expect="201" +checkRes +echo -e "\n" + +echo "create policy aa8feaa88d944d919ef0e83f2172a5000 to ric1 with type 1 and service controlpanel via policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/testdata/v2/policy_osc.json" +res=$($curlString) +echo "$res" +expect="201" +checkRes +echo -e "\n" + +echo "policy numbers from ric1:" +curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_OSC_port/counter/num_instances" +res=$($curlString) +echo "$res" +expect="1200" +checkRes +echo -e "\n" + +echo "create policy aa8feaa88d944d919ef0e83f2172a5100 to ric2 with type 2 and service controlpanel via policy agent:" +curlString="curl -k -X PUT -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/a1-policy/v2/policies" --data-binary @${SHELL_FOLDER}/testdata/v2/policy_std_v2.json" +res=$($curlString) +echo "$res" +expect="201" +checkRes +echo -e "\n" + +echo "policy numbers from ric2:" +curlString="curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_port/counter/num_instances" +res=$($curlString) +echo "$res" +expect="1200" +checkRes +echo -e "\n" + +echo "policy id aa8feaa88d944d919ef0e83f2172a5000 from policy agent:" +curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5000" +res=$($curlString) +echo "$res" +expect="200" +checkRes +echo -e "\n" + +echo "policy id aa8feaa88d944d919ef0e83f2172a5100 from policy agent:" +curlString="curl -s -o /dev/null -I -w %{http_code} $httpx://localhost:$policy_agent_port/a1-policy/v2/policies/aa8feaa88d944d919ef0e83f2172a5100" +res=$($curlString) +echo "$res" +expect="200" +checkRes +echo -e "\n" diff --git a/csit/scripts/healthcheck/data/testdata/OSC/policy_type.json b/csit/scripts/healthcheck/data/testdata/OSC/policy_type.json new file mode 100644 index 00000000..aeea7733 --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/OSC/policy_type.json @@ -0,0 +1,45 @@ +{ + "name": "pt1", + "description": "pt1 policy type", + "policy_type_id": 1, + "create_schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OSC_Type1_1.0.0", + "description": "Type 1 policy type", + "type": "object", + "properties": { + "scope": { + "type": "object", + "properties": { + "ueId": { + "type": "string" + }, + "qosId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "ueId", + "qosId" + ] + }, + "qosObjectives": { + "type": "object", + "properties": { + "priorityLevel": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "priorityLevel" + ] + } + }, + "additionalProperties": false, + "required": [ + "scope", "qosObjectives" + ] + } +} diff --git a/csit/scripts/healthcheck/data/testdata/policy.json b/csit/scripts/healthcheck/data/testdata/policy.json new file mode 100644 index 00000000..ac1b538b --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/policy.json @@ -0,0 +1,9 @@ +{ + "scope": { + "ueId": "ue3100", + "qosId": "qos3100" + }, + "qosObjectives": { + "priorityLevel": 3100 + } +} diff --git a/csit/scripts/healthcheck/data/testdata/service.json b/csit/scripts/healthcheck/data/testdata/service.json new file mode 100644 index 00000000..7bb66514 --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/service.json @@ -0,0 +1,5 @@ +{ + "callbackUrl": "https://callback-receiver:8091/callbacks/1", + "keepAliveIntervalSeconds": "3600", + "serviceName": "service1" +} diff --git a/csit/scripts/healthcheck/data/testdata/v2/policy_osc.json b/csit/scripts/healthcheck/data/testdata/v2/policy_osc.json new file mode 100644 index 00000000..902f9111 --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/v2/policy_osc.json @@ -0,0 +1,16 @@ +{ + "ric_id": "ric1", + "policy_id": "aa8feaa88d944d919ef0e83f2172a5100", + "service_id": "controlpanel", + "policytype_id": "1", + "status_notification_uri": "http://callback-receiver:8090/callbacks/test", + "policy_data": { + "scope": { + "ueId": "ue5100", + "qosId": "qos5100" + }, + "qosObjectives": { + "priorityLevel": 5100 + } + } +} \ No newline at end of file diff --git a/csit/scripts/healthcheck/data/testdata/v2/policy_std_v2.json b/csit/scripts/healthcheck/data/testdata/v2/policy_std_v2.json new file mode 100644 index 00000000..dcb7e38f --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/v2/policy_std_v2.json @@ -0,0 +1,16 @@ +{ + "ric_id": "ric2", + "policy_id": "aa8feaa88d944d919ef0e83f2172a5000", + "service_id": "controlpanel", + "policytype_id": "2", + "status_notification_uri": "http://callback-receiver:8090/callbacks/test", + "policy_data": { + "scope": { + "ueId": "ue5000", + "qosId": "qos5000" + }, + "qosObjectives": { + "priorityLevel": 5000 + } + } +} \ No newline at end of file diff --git a/csit/scripts/healthcheck/data/testdata/v2/policy_type.json b/csit/scripts/healthcheck/data/testdata/v2/policy_type.json new file mode 100644 index 00000000..931498c4 --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/v2/policy_type.json @@ -0,0 +1,56 @@ +{ + "policySchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_QOS_0_2_0", + "description": "STD QOS policy type", + "type": "object", + "properties": { + "scope": { + "type": "object", + "properties": { + "ueId": { + "type": "string" + }, + "qosId": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "ueId", + "qosId" + ] + }, + "qosObjectives": { + "type": "object", + "properties": { + "priorityLevel": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "priorityLevel" + ] + } + } + }, + "statusSchema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "STD_QOS_0.2.0", + "description": "STD QOS policy type status", + "type": "object", + "properties": { + "enforceStatus": { + "type": "string" + }, + "enforceReason": { + "type": "string" + }, + "additionalProperties": false, + "required": [ + "enforceStatus" + ] + } + } + } \ No newline at end of file diff --git a/csit/scripts/healthcheck/data/testdata/v2/service.json b/csit/scripts/healthcheck/data/testdata/v2/service.json new file mode 100644 index 00000000..d984cbab --- /dev/null +++ b/csit/scripts/healthcheck/data/testdata/v2/service.json @@ -0,0 +1,5 @@ +{ + "callback_url": "http://callback-receiver:8090/callbacks/ric-registration", + "keep_alive_interval_seconds": "0", + "service_id": "ric-registration" +} \ No newline at end of file diff --git a/csit/scripts/healthcheck/docker-compose.yml b/csit/scripts/healthcheck/docker-compose.yml new file mode 100644 index 00000000..b899aa8f --- /dev/null +++ b/csit/scripts/healthcheck/docker-compose.yml @@ -0,0 +1,78 @@ +# 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================================================= +# +version: '3' + +networks: + default: + driver: bridge + +services: + policy-agent: + image: onap/ccsdk-oran-a1policymanagementservice:1.1.2-STAGING-latest + container_name: policy-agent + networks: + default: + aliases: + - policy-agent-container + ports: + - 8081:8081 + - 8433:8433 + volumes: + - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro + # For using own certs instead of the default ones (built into the container), + # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines + # - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro + # - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro + # - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro + + a1-sim-OSC: + image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 + container_name: a1-sim-OSC + networks: + - default + ports: + - 30001:8085 + - 30002:8185 + environment: + - A1_VERSION=OSC_2.1.0 + - REMOTE_HOSTS_LOGGING=1 + - ALLOW_HTTP=true + + a1-sim-STD: + image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 + container_name: a1-sim-STD + networks: + - default + ports: + - 30003:8085 + - 30004:8185 + environment: + - A1_VERSION=STD_1.1.3 + - REMOTE_HOSTS_LOGGING=1 + - ALLOW_HTTP=true + + a1-sim-STD-v2: + image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0 + container_name: a1-sim-STD-v2 + networks: + - default + ports: + - 30005:8085 + - 30006:8185 + environment: + - A1_VERSION=STD_2.0.0 + - REMOTE_HOSTS_LOGGING=1 + - ALLOW_HTTP=true diff --git a/csit/scripts/healthcheck/sdnc/config/https-props-a1controller.properties b/csit/scripts/healthcheck/sdnc/config/https-props-a1controller.properties new file mode 100644 index 00000000..7c4b1c17 --- /dev/null +++ b/csit/scripts/healthcheck/sdnc/config/https-props-a1controller.properties @@ -0,0 +1,24 @@ +# ========================LICENSE_START================================= +# O-RAN-SC +# %% +# 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=================================== + +key-store=/etc/ssl/certs/java/keystore.jks +key-password=sdnc-a1-controller +keystore-password=sdnc-a1-controller +isTrustStoreUsed=true +trust-store=/etc/ssl/certs/java/truststore.jks +truststore-password=sdnc-a1-controller diff --git a/csit/scripts/healthcheck/sdnc/docker-compose.yml b/csit/scripts/healthcheck/sdnc/docker-compose.yml new file mode 100644 index 00000000..ace2dec2 --- /dev/null +++ b/csit/scripts/healthcheck/sdnc/docker-compose.yml @@ -0,0 +1,94 @@ +# 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================================================= +# +version: '3' + +networks: + default: + driver: bridge + +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.so.testlab.onap.org + logging: + 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 + 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/scripts/healthcheck/test/health_check.sh b/csit/scripts/healthcheck/test/health_check.sh new file mode 100755 index 00000000..409e85fb --- /dev/null +++ b/csit/scripts/healthcheck/test/health_check.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +############################################################################### +# Copyright 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) 2021 Nordix Foundation +# +############################################################################### + +unset http_proxy https_proxy +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) +docker stop $(docker ps -aq) +docker system prune -f + +cd ${SHELL_FOLDER}/../config +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 +chmod +x docker-compose +./docker-compose up -d + + +checkStatus(){ + for i in {1..60}; do + res=$($1) + echo "$res" + expect=$2 + if [ "$res" == "$expect" ]; then + echo -e "$3 is alive!\n" + break; + else + sleep $i + fi + done +} +# Healthcheck docker containers + +# check SIM1 status +echo "check SIM1 status:" +checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" + +# check SIM2 status +echo "check SIM2 status:" +checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" + +# check SIM3 status +echo "check SIM3 status:" +checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" + +# check PMS status +echo "check PMS status:" +checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" + +echo "NONRTRIC health check passed." diff --git a/csit/scripts/healthcheck/test/pms_a1sim.sh b/csit/scripts/healthcheck/test/pms_a1sim.sh new file mode 100755 index 00000000..fadc056b --- /dev/null +++ b/csit/scripts/healthcheck/test/pms_a1sim.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# ============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================================================= + +unset http_proxy https_proxy +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) +docker stop $(docker ps -aq) +docker system prune -f + +cd ${SHELL_FOLDER}/../config +cp application_configuration.json.nosdnc application_configuration.json + +cd ${SHELL_FOLDER}/../ +docker-compose up -d + +checkStatus(){ + for i in {1..60}; do + res=$($1) + echo "$res" + expect=$2 + if [ "$res" == "$expect" ]; then + echo -e "$3 is alive!\n" + break; + else + sleep $i + fi + done +} +# Healthcheck docker containers + +# check SIM1 status +echo "check SIM1 status:" +checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" + +# check SIM2 status +echo "check SIM2 status:" +checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" + +# check SIM3 status +echo "check SIM3 status:" +checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" + +# check PMS status +echo "check PMS status:" +checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" + +cd ${SHELL_FOLDER}/../data +./preparePmsData.sh + diff --git a/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh new file mode 100755 index 00000000..c75d6056 --- /dev/null +++ b/csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# ============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================================================= + +unset http_proxy https_proxy +SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) +docker stop $(docker ps -aq) +docker system prune -f +source ${SHELL_FOLDER}/setup.sh + +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 + +checkStatus(){ + for i in {1..60}; do + res=$($1) + echo "$res" + expect=$2 + if [ "$res" == "$expect" ]; then + echo -e "$3 is alive!\n" + break; + else + sleep $i + fi + done +} +# Healthcheck docker containers + +# check SIM1 status +echo "check SIM1 status:" +checkStatus "curl -skw %{http_code} http://localhost:30001/" "OK200" "SIM1" + +# check SIM2 status +echo "check SIM2 status:" +checkStatus "curl -skw %{http_code} http://localhost:30003/" "OK200" "SIM2" + +# check SIM3 status +echo "check SIM3 status:" +checkStatus "curl -skw %{http_code} http://localhost:30005/" "OK200" "SIM3" + +# check PMS status +echo "check PMS status:" +checkStatus "curl -skw %{http_code} http://localhost:8081/status" "hunky dory200" "PMS" + +# check SDNC status +echo "check SDNC status:" +checkStatus "curl -s -o /dev/null -I -w %{http_code} http://localhost:8282/apidoc/explorer/" "200" "SDNC" + +cd ${SHELL_FOLDER}/../data +./preparePmsData.sh + diff --git a/csit/scripts/healthcheck/test/setup.sh b/csit/scripts/healthcheck/test/setup.sh new file mode 100755 index 00000000..c751e6d2 --- /dev/null +++ b/csit/scripts/healthcheck/test/setup.sh @@ -0,0 +1,32 @@ +# Set credentials +export MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-mySecretPassword} +export MYSQL_USER=${MYSQL_USER:-sdnc} +export MYSQL_PASSWORD=${MYSQL_PASSWORD:-test123} +export MYSQL_DATABASE=${MYSQL_DATABASE:-sdncdb} +export ODL_USER=${ODL_USER:-admin} +export ODL_PASSWORD=${ODL_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} +export ODL_ADMIN_USER=${ODL_ADMIN_USER:-${ODL_USER}} +export ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-${ODL_PASSWORD}} +export DMAAP_USER=${DMAAP_USER:-admin} +export DMAAP_PASSWORD=${DMAAP_PASSWORD:-admin} +export DMAAP_AUTHKEY=${DMAAP_AUTHKEY:-""} +export AAI_TRUSTSTORE_PASSWORD=${AAI_TRUSTSTORE_PASSWORD:-changeit} +export AAI_CLIENT_NAME=${AAI_CLIENT_NAME:-sdnc@sdnc.onap.org} +export AAI_CLIENT_PASSWORD=${AAI_CLIENT_PASSWORD:-demo123456!} +export ANSIBLE_TRUSTSTORE_PASSWORD=${ANSIBLE_TRUSTSTURE_PASSWORD:-changeit} +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 NENG_USER=${NENG_USER:-ccsdkapps} +export NENG_PASSWORD=${NENG_PASSWORD:-ccsdkapps} +export SO_USER=${SO_USER:-sdncaBpmn} +export SO_PASSWORD=${SO_PASSWORD:-password1$} +export CDS_USER=${CDS_USER:-ccsdkapps} +export CDS_PASSWORD=${CDS_PASSWORD:-ccsdkapps} +export ANSIBLE_USER=${ANSIBLE_USER:-sdnc} +export ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD:-sdnc} +export SQL_CRYPTKEY=${SQL_CRYPTKEY:-fakECryptKey} +export ASDC_USER=${ASDC_USER:-sdnc} +export ASDC_PASSWORD=${ASDC_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U} + -- cgit 1.2.3-korg