aboutsummaryrefslogtreecommitdiffstats
path: root/csit/scripts/healthcheck/data
diff options
context:
space:
mode:
authorecaiyanlinux <martin.c.yan@est.tech>2021-02-24 20:11:18 +0100
committerecaiyanlinux <martin.c.yan@est.tech>2021-03-02 09:17:55 +0000
commit1668b5a62512993b0ae0650bdbff20ad67749fa5 (patch)
tree40971ce9b7b146a5d6ac95571aba33573e4c59e3 /csit/scripts/healthcheck/data
parent5f2eb385c2902e270f68d52659d31097f6fa89b4 (diff)
Add csit in project repo
using scripts in the project repo for csit Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech> Issue-ID: CCSDK-3140 Change-Id: I08c0bbb55d6cd425c246362d40187738d26f2e43
Diffstat (limited to 'csit/scripts/healthcheck/data')
-rwxr-xr-xcsit/scripts/healthcheck/data/preparePmsData.sh157
-rw-r--r--csit/scripts/healthcheck/data/testdata/OSC/policy_type.json45
-rw-r--r--csit/scripts/healthcheck/data/testdata/policy.json9
-rw-r--r--csit/scripts/healthcheck/data/testdata/service.json5
-rw-r--r--csit/scripts/healthcheck/data/testdata/v2/policy_osc.json16
-rw-r--r--csit/scripts/healthcheck/data/testdata/v2/policy_std_v2.json16
-rw-r--r--csit/scripts/healthcheck/data/testdata/v2/policy_type.json56
-rw-r--r--csit/scripts/healthcheck/data/testdata/v2/service.json5
8 files changed, 309 insertions, 0 deletions
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