1 # ========================LICENSE_START=================================
4 # Copyright (C) 2024: OpenInfra Foundation Europe
5 # ========================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=================================================
21 PREFIX="nexus3.o-ran-sc.org:10004"
24 # Create a network for Kafka Containers
25 docker network create kafka-net
32 -e LOG_DIR="/tmp/logs" \
33 -e KAFKA_LISTENER_SECURITY_PROTOCOL_MAP="CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT" \
34 -e KAFKA_LISTENERS="PLAINTEXT://:29092,PLAINTEXT_HOST://:9092,CONTROLLER://:9093" \
35 -e KAFKA_ADVERTISED_LISTENERS="PLAINTEXT://kafka-zkless:29092,PLAINTEXT_HOST://kafka-zkless:9092" \
36 quay.io/strimzi/kafka:latest-kafka-2.8.1-amd64 \
37 /bin/sh -c 'export CLUSTER_ID=$(bin/kafka-storage.sh random-uuid) && \
38 bin/kafka-storage.sh format -t $CLUSTER_ID -c config/kraft/server.properties && \
39 bin/kafka-server-start.sh config/kraft/server.properties --override advertised.listeners=$KAFKA_ADVERTISED_LISTENERS --override listener.security.protocol.map=$KAFKA_LISTENER_SECURITY_PROTOCOL_MAP --override listeners=$KAFKA_LISTENERS'
44 --name informationcoordinatorservice \
46 -v ./application.yaml:/opt/app/information-coordinator-service/config/application.yaml \
47 nexus3.o-ran-sc.org:10001/o-ran-sc/nonrtric-plt-informationcoordinatorservice:1.6.0
52 --name kafka-producer \
54 -e KAFKA_SERVERS=kafka-zkless:9092 \
55 $PREFIX/o-ran-sc/nonrtric-sample-icsproducer:$VERSION
60 --name kafka-consumer \
62 -e KAFKA_SERVERS=kafka-zkless:9092 \
63 $PREFIX/o-ran-sc/nonrtric-sample-icsconsumer:$VERSION
65 # Wait for the Kafka container to be running
66 wait_for_container "kafka-zkless" "Kafka Server started"
67 wait_for_container "kafka-producer" "Started Application"
68 wait_for_container "kafka-consumer" "Started Application"
70 # Once Kafka container is running, start the producers and consumers
71 echo "Kafka container is up and running. Starting producer and consumer..."
74 #Using the autostart flag in the application.yaml
75 echo "Start 1 Producer on mytopic"
76 #curl -X GET http://localhost:8080/startProducer/mytopic
79 echo "Start 1 Consumer on mytopic"
80 #curl -X GET http://localhost:8081/startConsumer/mytopic
85 echo "Sending type1 to ICS"
87 'http://localhost:8083/data-producer/v1/info-types/type1' \
88 -H 'accept: application/json' \
89 -H 'Content-Type: application/json' \
91 "info_job_data_schema": {
92 "$schema":"http://json-schema.org/draft-07/schema#",
93 "title":"STD_Type1_1.0.0",
94 "description":"Type 1",
99 echo "Getting types from ICS"
100 curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1'
103 echo "Sending Producer infos to ICS"
105 'http://localhost:8083/data-producer/v1/info-producers/1' \
106 -H 'accept: application/json' \
107 -H 'Content-Type: application/json' \
109 "info_producer_supervision_callback_url": "http://kafka-producer:8080/producer/supervision",
110 "supported_info_types": [
113 "info_job_callback_url": "http://kafka-producer:8080/producer/job"
116 echo "Getting Producers Infos from ICS"
117 curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1'
120 echo "Sending Consumer Job infos to ICS"
122 'http://localhost:8083/data-consumer/v1/info-jobs/1' \
123 -H 'accept: application/json' \
124 -H 'Content-Type: application/json' \
126 "info_type_id": "type1",
131 "bootStrapServers": "http://kafka-zkless:9092",
132 "numberOfMessages": 0
135 "job_result_uri": "http://kafka-producer:8080/producer/job",
136 "status_notification_uri": "http://kafka-producer:8080/producer/supervision"
139 echo "Getting Consumer Job Infos from ICS"
140 curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1'
143 echo "Sending Consumer Subscription Job infos to ICS"
145 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \
146 -H 'accept: application/json' \
147 -H 'Content-Type: application/json' \
149 "status_result_uri": "http://kafka-consumer:8081/info-type-status",
152 echo "Getting Consumer Subscription Job infos from ICS"
153 curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json'
157 echo "ICS Producer Docker logs "
158 docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions'
160 echo "Demo Producer Docker logs "
161 docker logs kafka-producer | grep c.d.p.p.SimpleProducer
163 echo "Demo Consumer Docker logs "
164 docker logs kafka-consumer | grep c.d.c.c.SimpleConsumer
169 containers=("kafka-producer" "kafka-consumer")
171 for container in "${containers[@]}"; do
172 if docker logs "$container" | grep -q ERROR; then
173 echo "Errors found in logs of $container"
174 docker logs "$container" | grep ERROR
178 echo "No errors found in logs of $container"