Add docker-compose file for ECS 65/4865/3
authorecaiyanlinux <martin.c.yan@est.tech>
Mon, 19 Oct 2020 09:13:12 +0000 (11:13 +0200)
committerecaiyanlinux <martin.c.yan@est.tech>
Tue, 20 Oct 2020 11:36:35 +0000 (13:36 +0200)
Add docker-compose file for ECS along with portal-control-panel
Add scripts to populate some dummy data into ECS sercice
Minor improvements on existing scripts

Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Change-Id: Ic67200afc533b3a1860221aabaaae9f23ae1b345

docker-compose/README.md
docker-compose/data/prepareDmaapMsg.sh [moved from docker-compose/data/dmaap-msg.sh with 97% similarity]
docker-compose/data/prepareEcsData.sh [new file with mode: 0755]
docker-compose/data/preparePmsData.sh [moved from docker-compose/data/fill_data.sh with 97% similarity]
docker-compose/data/testdata/ECS/EiJob.json [new file with mode: 0644]
docker-compose/data/testdata/ECS/EiProducer.json [new file with mode: 0644]
docker-compose/ecs/docker-compose.yml [new file with mode: 0644]

index 7573398..fdcb5f5 100644 (file)
@@ -29,13 +29,22 @@ 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]
+./preparePmsData.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
 
+By default, if the containers are started up and running by docker-compose file in the same directory, just run commands:
+./preparePmsData.sh
+
+prepareEcsData.sh
+This is to generate some data into the ECS microservice
+
+prepareDmaapMsg.sh
+This is to generate some data into the Dmaap MR, so that PMS reads message from MR
+
 ## License
 
 Copyright (C) 2020 Nordix Foundation.
similarity index 97%
rename from docker-compose/data/dmaap-msg.sh
rename to docker-compose/data/prepareDmaapMsg.sh
index 0bbd135..684afbb 100755 (executable)
@@ -25,7 +25,7 @@
 # one policy in a1-sim-STD
 
 # Run command:
-# ./dmaap-msg.sh [dmaap-mr port] [a1-sim-OSC port] [a1-sim-STD port] [http/https]
+# ./prepareDmaapMsg.sh [dmaap-mr port] [a1-sim-OSC port] [a1-sim-STD port] [http/https]
 
 dmaa_mr_port=${1:-3904}
 a1_sim_OSC_port=${2:-30001}
diff --git a/docker-compose/data/prepareEcsData.sh b/docker-compose/data/prepareEcsData.sh
new file mode 100755 (executable)
index 0000000..f949f4c
--- /dev/null
@@ -0,0 +1,83 @@
+#!/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 EiProducer in ECS
+# one EiType in ECS
+# one EiJob in ECS
+
+# Run command:
+# ./prepareEcsData.sh [ECS port] [http/https]
+
+ecs_port=${1:-8083}
+httpx=${4:-"http"}
+
+echo "using ecs port: "$ecs_port
+echo "using protocol: "$httpx
+echo -e "\n"
+
+echo "ECS status:"
+curl -skw " %{http_code}" $httpx://localhost:$ecs_port/status
+echo -e "\n"
+
+# Get EiTypes
+echo "Get EiTypes:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eitypes -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Get Individual EiType
+echo "Get Individual EiType:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eitypes/type1 -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Create EiProducer
+echo "Create EiProducer:"
+curl -X PUT -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1 -H Content-Type:application/json --data-binary @testdata/ECS/EiProducer.json
+echo -e "\n"
+
+# Get EiProducers
+echo "Get EiProducers:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Get Individual EiProducer
+echo "Get Individual EiProducer:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1 -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Get Individual EiProducer Status
+echo "Get Individual EiProducer:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/ei-producer/v1/eiproducers/1/status -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Create EiJob
+echo "Create EiJob Of A Certain Type type1:"
+curl -X PUT -skw " %{http_code}" $httpx://localhost:$ecs_port/A1-EI/v1/eitypes/type1/eijobs/job1 -H Content-Type:application/json --data-binary @testdata/ECS/EiJob.json
+echo -e "\n"
+
+# Get EiJobs Of A Certain Type type1
+echo "Get EiJobs Of A Certain Type type1:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/A1-EI/v1/eitypes/type1/eijobs -H Content-Type:application/json | jq
+echo -e "\n"
+
+# Get Individual EiJob:
+echo "Get Individual EiJob:"
+curl -X GET -skw " %{http_code}" $httpx://localhost:$ecs_port/A1-EI/v1/eitypes/type1/eijobs/job1 -H Content-Type:application/json | jq
+echo -e "\n"
\ No newline at end of file
similarity index 97%
rename from docker-compose/data/fill_data.sh
rename to docker-compose/data/preparePmsData.sh
index 7b8f665..94afc6e 100755 (executable)
@@ -25,7 +25,7 @@
 # one policy in a1-sim-STD
 
 # Run command:
-# ./fill_data.sh [policy-agent port] [a1-sim-OSC port] [a1-sim-STD port] [http/https]
+# ./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}
diff --git a/docker-compose/data/testdata/ECS/EiJob.json b/docker-compose/data/testdata/ECS/EiJob.json
new file mode 100644 (file)
index 0000000..30edb2c
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "jobOwner": "1",
+    "jobParameters": {},
+    "targetUri": "http://example.com"
+  }
\ No newline at end of file
diff --git a/docker-compose/data/testdata/ECS/EiProducer.json b/docker-compose/data/testdata/ECS/EiProducer.json
new file mode 100644 (file)
index 0000000..ebb4ad4
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "ei_job_creation_callback_url": "http://example.com",
+    "ei_job_deletion_callback_url": "http://example.com",
+    "ei_producer_supervision_callback_url": "http://example.com",
+    "supported_ei_types": [{
+        "ei_job_data_schema": {},
+        "ei_type_identity": "type1"
+    }]
+}
\ No newline at end of file
diff --git a/docker-compose/ecs/docker-compose.yml b/docker-compose/ecs/docker-compose.yml
new file mode 100644 (file)
index 0000000..f38d224
--- /dev/null
@@ -0,0 +1,43 @@
+#  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=================================================
+#
+version: '3.5'
+
+networks:
+  default:
+    driver: bridge
+    name: nonrtric-docker-net
+
+services:
+  ecs:
+    image: nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service:1.0.0-SNAPSHOT
+    container_name: ecs
+    networks:
+      default:
+        aliases:
+          - enrichment-service-container
+    ports:
+      - 8083:8083
+      - 8434:8434
+
+  policy-control-panel:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.0.0
+    container_name: policy-control-panel
+    networks:
+      - default
+    ports:
+      - 8080:8080
+      - 8082:8082
+