Integration dmaap-mr & dmaap-mediator
Change-Id: I16e5a9e2a1cdb753da5523e3b0ea807447d2fab4
Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Issue-ID: NONRTRIC-580
diff --git a/docker-compose/data/prepareDmaapMsg.sh b/docker-compose/data/prepareDmaapMsg.sh
index 73b07bc..4de374a 100755
--- a/docker-compose/data/prepareDmaapMsg.sh
+++ b/docker-compose/data/prepareDmaapMsg.sh
@@ -32,6 +32,7 @@
a1_sim_STD_port=${3:-30003}
a1_sim_STD_v1_port=${4:-30005}
httpx=${5:-"http"}
+SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
echo "using dmaap-mr port: "$dmaa_mr_port
echo "using a1-sim-OSC port: "$a1_sim_OSC_port
@@ -65,11 +66,11 @@
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
+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
echo -e "\n"
echo "create policy type 2 to ric3:"
-curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_v1_port/policytype?id=2 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @testdata/v2/policy_type.json
+curl -skw %{http_code} $httpx://localhost:$a1_sim_STD_v1_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
echo -e "\n"
for i in {1..12}; do
@@ -88,7 +89,7 @@
## Using PMS v1 interface
echo "create service 1 to policy agent via dmaap_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-service-create.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-service-create.json
echo -e "\n"
echo "get result from mr of previous request:"
@@ -96,7 +97,7 @@
echo -e "\n"
echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-policy-create.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-policy-create.json
echo -e "\n"
echo "get result from mr of previous request:"
@@ -104,7 +105,7 @@
echo -e "\n"
echo "get policy from policy agent via dmaap_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v1/dmaap-msg-policy-get.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v1/dmaap-msg-policy-get.json
echo -e "\n"
echo "get result from mr of previous request:"
@@ -113,7 +114,7 @@
## Using PMS v2 interface
echo "create service 2 to policy agent via dmaap_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-service-create.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-service-create.json
echo -e "\n"
echo "get result from mr of previous request:"
@@ -121,7 +122,7 @@
echo -e "\n"
echo "create policies to ric1 & ric2 & ric3 with type1 and service1 via dmaa_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-policy-create.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-policy-create.json
echo -e "\n"
echo "get result from mr of previous request:"
@@ -129,7 +130,7 @@
echo -e "\n"
echo "get policy from policy agent via dmaap_mr:"
-curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @testdata/dmaap/v2/dmaap-msg-policy-get.json
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/A1-POLICY-AGENT-READ/" --data-binary @${SHELL_FOLDER}/testdata/dmaap/v2/dmaap-msg-policy-get.json
echo -e "\n"
echo "get result from mr of previous request:"
diff --git a/docker-compose/data/prepareEcsData.sh b/docker-compose/data/prepareEcsData.sh
index 11b0dc8..21cc35b 100755
--- a/docker-compose/data/prepareEcsData.sh
+++ b/docker-compose/data/prepareEcsData.sh
@@ -28,6 +28,7 @@
ecs_port=${1:-8083}
httpx=${4:-"http"}
+SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
echo "using ecs port: "$ecs_port
echo "using protocol: "$httpx
@@ -39,7 +40,7 @@
# Create EiType
echo "Create EiType:"
-curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @testdata/ECS/EiType.json
+curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-types/type1 -H accept:application/json -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiType.json
echo -e "\n"
# Get EiTypes
@@ -54,7 +55,7 @@
# Create EiProducer
echo "Create EiProducer:"
-curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @testdata/ECS/EiProducer.json
+curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/data-producer/v1/info-producers/1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiProducer.json
echo -e "\n"
# Get EiProducers
@@ -74,7 +75,7 @@
# Create EiJob
echo "Create EiJob Of A Certain Type type1:"
-curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @testdata/ECS/EiJob.json
+curl -X PUT -skw %{http_code} $httpx://localhost:$ecs_port/A1-EI/v1/eijobs/job1 -H Content-Type:application/json --data-binary @${SHELL_FOLDER}/testdata/ECS/EiJob.json
echo -e "\n"
# Get EiJobs
diff --git a/docker-compose/data/sendMsgToMediator.sh b/docker-compose/data/sendMsgToMediator.sh
new file mode 100755
index 0000000..a2f3db3
--- /dev/null
+++ b/docker-compose/data/sendMsgToMediator.sh
@@ -0,0 +1,50 @@
+#!/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 send a dmaap msg of job to mediator:
+
+# Run command:
+# ./sendMsgToMediator.sh [dmaap-mr port] [http/https]
+
+SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
+bash ${SHELL_FOLDER}/prepareEcsData.sh
+
+dmaa_mr_port=${1:-3904}
+httpx=${2:-"http"}
+
+echo "using dmaap-mr port: "$dmaa_mr_port
+echo "using protocol: "$httpx
+echo -e "\n"
+
+echo "dmaap-mr topics:"
+curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll
+echo -e "\n"
+
+echo "dmaap-mr create topic unauthenticated.VES_NOTIFICATION_OUTPUT:"
+curl -skw %{http_code} -X POST "$httpx://localhost:$dmaa_mr_port/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"unauthenticated.VES_NOTIFICATION_OUTPUT\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCount\": 1, \"transactionEnabled\": \"false\"}"
+echo -e "\n"
+
+echo "dmaap-mr topics:"
+curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll
+echo -e "\n"
+
+echo "send job msg to dmaap-mr:"
+curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" --data-binary @${SHELL_FOLDER}/testdata/dmaap-mediator-java/job.json
+echo -e "\n"
\ No newline at end of file
diff --git a/docker-compose/data/testdata/ECS/EiJob.json b/docker-compose/data/testdata/ECS/EiJob.json
index 003c70f..3788f21 100644
--- a/docker-compose/data/testdata/ECS/EiJob.json
+++ b/docker-compose/data/testdata/ECS/EiJob.json
@@ -1,8 +1,8 @@
{
"eiTypeId": "type1",
- "jobResultUri": "https://ricsim_g3_1:8185/datadelivery",
+ "jobResultUri": "http://consumer:80/",
"jobOwner": "ricsim_g3_1",
- "jobStatusNotificationUri": "http://producer:80/",
+ "jobStatusNotificationUri": "http://consumer:80/",
"jobDefinition": {
"jobparam1": "value1_job1",
"jobparam2": "value2_job1",
diff --git a/docker-compose/data/testdata/ECS/EiProducer.json b/docker-compose/data/testdata/ECS/EiProducer.json
index 85d3e6d..34632b0 100644
--- a/docker-compose/data/testdata/ECS/EiProducer.json
+++ b/docker-compose/data/testdata/ECS/EiProducer.json
@@ -1,5 +1,5 @@
{
"supported_info_types": ["type1"],
- "info_job_callback_url": "https://producer-stub:8093/callbacks/job/prod-a",
- "info_producer_supervision_callback_url": "https://producer-stub:8093/callbacks/supervision/prod-a"
+ "info_job_callback_url": "http://consumer:80/",
+ "info_producer_supervision_callback_url": "http://consumer:80/"
}
\ No newline at end of file
diff --git a/docker-compose/data/testdata/dmaap-mediator-java/flow.puml b/docker-compose/data/testdata/dmaap-mediator-java/flow.puml
new file mode 100644
index 0000000..5295fa6
--- /dev/null
+++ b/docker-compose/data/testdata/dmaap-mediator-java/flow.puml
@@ -0,0 +1,5 @@
+@startuml
+dmaap_mr <- dmaap_mediator: dmaap_mediator reads msg from dmaap_mr
+dmaap_mediator -> ecs: dmaap_mediator gets jobs from ecs
+dmaap_mediator -> consumer: callbackUrl, send msg to consumer
+@enduml
\ No newline at end of file
diff --git a/docker-compose/data/testdata/dmaap-mediator-java/job.json b/docker-compose/data/testdata/dmaap-mediator-java/job.json
new file mode 100644
index 0000000..51a68c5
--- /dev/null
+++ b/docker-compose/data/testdata/dmaap-mediator-java/job.json
@@ -0,0 +1,3 @@
+{
+ "testdata":"testdata"
+}
\ No newline at end of file
diff --git a/docker-compose/dmaap-mediator-java/config/application.yaml b/docker-compose/dmaap-mediator-java/config/application.yaml
new file mode 100755
index 0000000..57fd8ce
--- /dev/null
+++ b/docker-compose/dmaap-mediator-java/config/application.yaml
@@ -0,0 +1,56 @@
+spring:
+ profiles:
+ active: prod
+ main:
+ allow-bean-definition-overriding: true
+ aop:
+ auto: false
+management:
+ endpoints:
+ web:
+ exposure:
+ # Enabling of springboot actuator features. See springboot documentation.
+ include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+ # Configuration of logging
+ level:
+ ROOT: ERROR
+ org.springframework: ERROR
+ org.springframework.data: ERROR
+ org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+ org.oran.dmaapadapter: TRACE
+ file:
+ name: /var/log/dmaap-adaptor-service/application.log
+server:
+ # Configuration of the HTTP/REST server. The parameters are defined and handeled by the springboot framework.
+ # See springboot documentation.
+ port : 8435
+ http-port: 8084
+ ssl:
+ key-store-type: JKS
+ key-store-password: policy_agent
+ key-store: /opt/app/dmaap-adaptor-service/etc/cert/keystore.jks
+ key-password: policy_agent
+ key-alias: policy_agent
+app:
+ webclient:
+ # Configuration of the trust store used for the HTTP client (outgoing requests)
+ # The file location and the password for the truststore is only relevant if trust-store-used == true
+ # Note that the same keystore as for the server is used.
+ trust-store-used: false
+ trust-store-password: policy_agent
+ trust-store: /opt/app/dmaap-adaptor-service/etc/cert/truststore.jks
+ # Configuration of usage of HTTP Proxy for the southbound accesses.
+ # The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s
+ http.proxy-host:
+ http.proxy-port: 0
+ vardata-directory: /var/dmaap-adaptor-service
+ ecs-base-url: http://ecs:8083
+ # Location of the component configuration file. The file will only be used if the Consul database is not used;
+ # configuration from the Consul will override the file.
+ configuration-filepath: /opt/app/dmaap-adaptor-service/data/application_configuration.json
+ dmaap-base-url: http://dmaap-mr:3904
+ # The url used to adress this component. This is used as a callback url sent to other components.
+ dmaap-adapter-base-url: https://dmaap-mediator-java:8435
+
diff --git a/docker-compose/dmaap-mediator-java/config/application_configuration.json b/docker-compose/dmaap-mediator-java/config/application_configuration.json
new file mode 100644
index 0000000..f15d628
--- /dev/null
+++ b/docker-compose/dmaap-mediator-java/config/application_configuration.json
@@ -0,0 +1,8 @@
+{
+ "types": [
+ {
+ "id": "type1",
+ "dmaapTopicUrl": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12"
+ }
+ ]
+}
diff --git a/docker-compose/dmaap-mediator-java/docker-compose.yaml b/docker-compose/dmaap-mediator-java/docker-compose.yaml
index a2f1f5e..1d53de4 100644
--- a/docker-compose/dmaap-mediator-java/docker-compose.yaml
+++ b/docker-compose/dmaap-mediator-java/docker-compose.yaml
@@ -28,4 +28,7 @@
- default
ports:
- 8084:8084
- - 8435:8435
\ No newline at end of file
+ - 8435:8435
+ volumes:
+ - ./dmaap-mediator-java/config/application.yaml:/opt/app/dmaap-adaptor-service/config/application.yaml:ro
+ - ./dmaap-mediator-java/config/application_configuration.json:/opt/app/dmaap-adaptor-service/data/application_configuration.json:ro
\ No newline at end of file
diff --git a/docker-compose/ecs/docker-compose.yaml b/docker-compose/ecs/docker-compose.yaml
index 354b3bc..376f734 100644
--- a/docker-compose/ecs/docker-compose.yaml
+++ b/docker-compose/ecs/docker-compose.yaml
@@ -22,7 +22,7 @@
services:
ecs:
- image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-enrichment-coordinator-service:1.2.0
+ image: nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service:1.2.0-SNAPSHOT
container_name: ecs
networks:
default:
@@ -31,9 +31,9 @@
ports:
- 8083:8083
- 8434:8434
- producer:
+ consumer:
image: eexit/mirror-http-server
- container_name: producer
+ container_name: consumer
networks:
- default
ports: