Add documentation & data scripts 52/3952/4
authorecaiyanlinux <martin.c.yan@est.tech>
Sat, 30 May 2020 13:17:59 +0000 (15:17 +0200)
committerecaiyanlinux <martin.c.yan@est.tech>
Tue, 2 Jun 2020 12:15:05 +0000 (14:15 +0200)
Add Readme.md
scripts in data/ can generate some dummy date into the system

Issue-ID: NONRTRIC-238
Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Change-Id: Id562c281ba909fa60e63223d8bd44f20949bb493

docker-compose/README.md [new file with mode: 0644]
docker-compose/data/fill_data.sh [new file with mode: 0755]
docker-compose/data/testdata/OSC/policy_type.json [new file with mode: 0644]
docker-compose/data/testdata/policy.json [new file with mode: 0644]
docker-compose/data/testdata/service.json [new file with mode: 0644]
docker-compose/nosdnc/config/application_configuration.json

diff --git a/docker-compose/README.md b/docker-compose/README.md
new file mode 100644 (file)
index 0000000..7573398
--- /dev/null
@@ -0,0 +1,54 @@
+# O-RAN-SC docker-compose files
+
+The docker-compose.yml file will create an entire nonrtric system with one command:
+docker-compose up
+
+Two docker-compose files are provided in this folder:
+
+nosdnc/docker-compose.yml
+This file is to create nonrtric system without sdnc a1-controller
+
+sdnc/docker-compose.yml
+This file is to create nonrtric system with sdnc a1-controller
+
+Howto:
+cd nosdnc/
+docker-compose up
+
+or
+
+cd sdnc/
+docker-compose up
+
+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:
+cd data/
+./fill_data.sh [policy-agent-port] [a1-sim-OSC-port] [a1-sim-STD-port] [http/https]
+
+Open link:
+http://localhost:[control-panel-port]/
+
+All the generated data is shown on the web page
+
+## License
+
+Copyright (C) 2020 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.
+
+For more information about license please see the [LICENSE](LICENSE.txt) file for details.
diff --git a/docker-compose/data/fill_data.sh b/docker-compose/data/fill_data.sh
new file mode 100755 (executable)
index 0000000..7b8f665
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 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:
+# ./fill_data.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:-30003}
+httpx=${4:-"http"}
+
+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"
+
+echo "policy agent status:"
+curl -skw " %{http_code}" $httpx://localhost:$policy_agent_port/status
+echo -e "\n"
+
+echo "ric1 version:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/counter/interface
+echo -e "\n"
+
+echo "ric2 version:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_STD_port/counter/interface
+echo -e "\n"
+
+echo "create policy type 1 to ric1:"
+curl -X PUT -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/policytype?id=1 -H Content-Type:application/json --data-binary @testdata/OSC/policy_type.json
+echo -e "\n"
+
+for i in {1..12}; do
+       echo "policy types from policy agent:"
+    curlString="curl -skw %{http_code} $httpx://localhost:$policy_agent_port/policy_types"
+    res=$($curlString)
+    echo "$res"
+    expect="[\"\",\"1\"]200"
+    if [ "$res" == "$expect" ]; then
+        echo -e "\n"
+        break;
+    else
+        sleep $i
+    fi
+done
+
+echo "create service 1 to policy agent:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/service" --data-binary @testdata/service.json
+echo -e "\n"
+
+echo "create policy 2000 to ric1 with type1 and service1 via policy agent:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/policy?id=2000&ric=ric1&service=service1&type=1" --data-binary @testdata/policy.json
+echo -e "\n"
+
+echo "policy numbers from ric1:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_OSC_port/counter/num_instances
+echo -e "\n"
+
+echo "create policy 2100 to ric2 with service1 via policy agent, no type:"
+curl -k -X PUT -sw " %{http_code}" -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$policy_agent_port/policy?id=2100&ric=ric2&service=service1" --data-binary @testdata/policy.json
+echo -e "\n"
+
+echo "policy numbers from ric2:"
+curl -skw " %{http_code}" $httpx://localhost:$a1_sim_STD_port/counter/num_instances
+echo -e "\n"
+
+echo "policy id 2000 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://localhost:$policy_agent_port/policy?id=2000
+echo -e "\n"
+
+echo "policy id 2100 from policy agent:"
+curl -k -X GET -sw " %{http_code}" $httpx://localhost:$policy_agent_port/policy?id=2100
+echo -e "\n"
\ No newline at end of file
diff --git a/docker-compose/data/testdata/OSC/policy_type.json b/docker-compose/data/testdata/OSC/policy_type.json
new file mode 100644 (file)
index 0000000..537d86f
--- /dev/null
@@ -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"
+        ]
+      },
+      "qosObjective": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjective"
+    ]
+  }
+}
diff --git a/docker-compose/data/testdata/policy.json b/docker-compose/data/testdata/policy.json
new file mode 100644 (file)
index 0000000..119ba8b
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "scope": {
+    "ueId": "ue3100",
+    "qosId": "qos3100"
+  },
+  "qosObjective": {
+    "priorityLevel": 3100
+  }
+}
diff --git a/docker-compose/data/testdata/service.json b/docker-compose/data/testdata/service.json
new file mode 100644 (file)
index 0000000..1b973fc
--- /dev/null
@@ -0,0 +1 @@
+{"callbackUrl": "http://callback-receiver:8090/callbacks/1","keepAliveIntervalSeconds": "3600","serviceName": "service1"}
index 221cdbf..3a10acd 100644 (file)
@@ -13,7 +13,7 @@
          {
             "name":"ric2",
             "baseUrl":"http://a1-sim-STD:8085/",
-            "managedElementIds":[
+            "managedElementIds": [
                "kista_1",
                "kista_2"
             ]