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=================================================
23 # Parse command line arguments
24 while [[ $# -gt 0 ]]; do
35 echo "Unknown option: $1"
40 # Source the utils script
48 if ! $skip_build; then
49 # Make build the demo docker image
57 # Start the Docker containers in detached mode
60 # Wait for the Kafka container to be running
61 wait_for_container "kafka-zkless" "Kafka Server started"
64 if ! $no_console; then
65 echo "Start RedPanda Console"
66 docker-compose -f docker-composeRedPanda.yaml up -d
69 echo "Start NONRTRIC control panel"
70 docker-compose -f ./docker-compose/docker-compose.yaml -f ./docker-compose/control-panel/docker-compose.yaml -f ./docker-compose/nonrtric-gateway/docker-compose.yaml up -d
74 # Once Kafka container is running, start the producers and consumers
75 echo "Kafka container is up and running. Starting producer and consumer..."
78 echo "Start 1 Producer on mytopic"
79 curl -X GET http://localhost:8080/startProducer/mytopic
82 echo "Start 1 Consumer on mytopic"
83 curl -X GET http://localhost:8081/startConsumer/mytopic
88 echo "Sending type1 to ICS"
90 'http://localhost:8083/data-producer/v1/info-types/type1' \
91 -H 'accept: application/json' \
92 -H 'Content-Type: application/json' \
94 "info_job_data_schema": {
95 "$schema":"http://json-schema.org/draft-07/schema#",
96 "title":"STD_Type1_1.0.0",
97 "description":"Type 1",
102 echo "Getting types from ICS"
103 curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1'
106 echo "Sending Producer infos to ICS"
108 'http://localhost:8083/data-producer/v1/info-producers/1' \
109 -H 'accept: application/json' \
110 -H 'Content-Type: application/json' \
112 "info_producer_supervision_callback_url": "http://kafka-producer:8080/producer/supervision",
113 "supported_info_types": [
116 "info_job_callback_url": "http://kafka-producer:8080/producer/job"
119 echo "Getting Producers Infos from ICS"
120 curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1'
123 echo "Sending Consumer Job infos to ICS"
125 'http://localhost:8083/data-consumer/v1/info-jobs/1' \
126 -H 'accept: application/json' \
127 -H 'Content-Type: application/json' \
129 "info_type_id": "type1",
134 "bootStrapServers": "http://kafka-zkless:9092",
135 "numberOfMessages": 0
138 "job_result_uri": "http://kafka-producer:8080/producer/job",
139 "status_notification_uri": "http://kafka-producer:8080/producer/supervision"
142 echo "Getting Consumer Job Infos from ICS"
143 curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1'
146 echo "Sending Consumer Subscription Job infos to ICS"
148 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \
149 -H 'accept: application/json' \
150 -H 'Content-Type: application/json' \
152 "status_result_uri": "http://kafka-consumer:8081/info-type-status",
155 echo "Getting Consumer Subscription Job infos from ICS"
156 curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json'
160 echo "ICS Producer Docker logs "
161 docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions'
163 echo "Demo Producer Docker logs "
164 docker logs kafka-producer | grep c.d.p.p.SimpleProducer
166 echo "Demo Consumer Docker logs "
167 docker logs kafka-consumer | grep c.d.c.c.SimpleConsumer
170 if ! $no_console; then
171 echo "Red Panda Console: http://localhost:8888"
172 echo "Control Panel Console: http://localhost:8181"
177 containers=("kafka-producer" "kafka-consumer")
179 for container in "${containers[@]}"; do
180 if docker logs "$container" | grep -q ERROR; then
181 echo "Errors found in logs of $container"
185 echo "No errors found in logs of $container"