Re-Enable verify test for sample rapp 11/13611/5
authorlapentafd <francesco.lapenta@est.tech>
Mon, 14 Oct 2024 08:19:20 +0000 (09:19 +0100)
committerlapentafd <francesco.lapenta@est.tech>
Mon, 14 Oct 2024 11:02:04 +0000 (12:02 +0100)
Issue-ID: NONRTRIC-1009
Change-Id: I681647e17e24e4cbf468690359d6426b092ac035
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
sample-services/ics-producer-consumer/start.sh
sample-services/ics-simple-producer-consumer/tests/.env
sample-services/ics-simple-producer-consumer/tests/docker-compose.yaml
sample-services/ics-simple-producer-consumer/tests/start_ics_producer_consumer_test.sh [changed mode: 0644->0755]

index 7ddc908..0a4ce85 100755 (executable)
@@ -195,4 +195,12 @@ for container in "${containers[@]}"; do
   fi
 done
 echo "SUCCESS"
+docker stop kafka-zkless
+docker stop informationcoordinatorservice
+docker stop kafka-producer
+docker stop kafka-consumer
+docker rm kafka-zkless
+docker rm informationcoordinatorservice
+docker rm kafka-producer
+docker rm kafka-consumer
 exit 0
index ba642fb..fae88a8 100644 (file)
@@ -1,2 +1,3 @@
 REGISTRY=nexus3.o-ran-sc.org:10001/\r
-STAGING=nexus3.o-ran-sc.org:10004/
\ No newline at end of file
+STAGING=nexus3.o-ran-sc.org:10004/\r
+LOCAL=
\ No newline at end of file
index 89a3870..1ae9537 100644 (file)
@@ -6,7 +6,7 @@ services:
       - "8083:8083"
 
   kafka-producer:
-    image: ${REGISTRY}o-ran-sc/nonrtric-sample-simple-icsproducer:0.0.1
+    image: ${STAGING}o-ran-sc/nonrtric-sample-simple-icsproducer:0.0.1
     container_name: kafka-producer
     environment:
       - SPRING_KAFKA_SERVER=broker:9092
@@ -16,7 +16,7 @@ services:
       - broker
 
   kafka-consumer:
-    image: ${REGISTRY}o-ran-sc/nonrtric-sample-simple-icsconsumer:0.0.1
+    image: ${STAGING}o-ran-sc/nonrtric-sample-simple-icsconsumer:0.0.1
     container_name: kafka-consumer
     environment:
       - SPRING_KAFKA_SERVER=broker:9092
old mode 100644 (file)
new mode 100755 (executable)
index d19c11b..253303d
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #  ============LICENSE_END=================================================
+
 #!/bin/bash
-echo "commented"
-# source ./utils/utils.sh
-
-# docker compose up -d
-
-# # Wait for the Kafka container to be running
-# wait_for_container "broker" "Kafka Server started"
-# wait_for_container "kafka-producer" "Started KafkaProducerApplication"
-# wait_for_container "kafka-consumer" "Started KafkaConsumerApplication"
-
-# # Once Kafka container is running, start the producers and consumers
-# echo "Kafka container is up and running. Starting producer and consumer..."
-# space
-
-# curl -v -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "TRACE"}' http://localhost:8083/actuator/loggers/org.oransc.ics
-
-# echo "Sending type1 to ICS"
-# curl -X 'PUT' \
-#   'http://localhost:8083/data-producer/v1/info-types/type1' \
-#   -H 'accept: application/json' \
-#   -H 'Content-Type: application/json' \
-#   -d '{
-#   "info_job_data_schema": {
-#     "$schema":"http://json-schema.org/draft-07/schema#",
-#     "title":"STD_Type1_1.0.0",
-#     "description":"Type 1",
-#     "topic": "mytopic",
-#     "bootStrapServers": "broker:9092"
-#     }
-# }'
-
-# echo "Getting types from ICS"
-# curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1'
-# space
-
-# echo "Sending Producer infos to ICS"
-# curl -X 'PUT' \
-#   'http://localhost:8083/data-producer/v1/info-producers/1' \
-#   -H 'accept: application/json' \
-#   -H 'Content-Type: application/json' \
-#   -d '{
-#   "info_producer_supervision_callback_url": "http://kafka-producer:8080/health-check",
-#   "supported_info_types": [
-#     "type1"
-#   ],
-#   "info_job_callback_url": "http://kafka-producer:8080/info-job"
-# }'
-
-# echo "Getting Producers Infos from ICS"
-# curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1'
-# space
-
-# echo "Sending Consumer Subscription Job infos to ICS"
-# curl -X 'PUT' \
-#   'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \
-#   -H 'accept: application/json' \
-#   -H 'Content-Type: application/json' \
-#   -d '{
-#   "status_result_uri": "http://kafka-consumer:9090/info-type-status",
-#   "owner": "demo"
-# }'
-# echo "Getting Consumer Subscription Job infos from ICS"
-# curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json'
-# space
-
-# #start Consumer
-# echo "Sending type1 to ICS to use the callback, This will start a CONSUMER"
-# curl -X 'PUT' \
-#   'http://localhost:8083/data-producer/v1/info-types/type1' \
-#   -H 'accept: application/json' \
-#   -H 'Content-Type: application/json' \
-#   -d '{
-#   "info_job_data_schema": {
-#     "$schema":"http://json-schema.org/draft-07/schema#",
-#     "title":"STD_Type1_1.0.0",
-#     "description":"Type 1",
-#     "topic": "mytopic",
-#     "bootStrapServers": "broker:9092"
-#     }
-# }'
-
-# sleep 3
-
-# #ICS starts a producer (healthcheck to status)
-# echo "Sending Consumer Job infos to ICS, This will start a PRODUCER"
-# curl -X 'PUT' \
-#   'http://localhost:8083/data-consumer/v1/info-jobs/1' \
-#   -H 'accept: application/json' \
-#   -H 'Content-Type: application/json' \
-#   -d '{
-#   "info_type_id": "type1",
-#   "job_owner": "demo",
-#   "job_definition": {
-#     "deliveryInfo": {
-#       "topic": "mytopic",
-#       "bootStrapServers": "broker:9092",
-#       "numberOfMessages": 100
-#     }
-#   },
-#   "job_result_uri": "http://kafka-producer:8080/info-job",
-#   "status_notification_uri": "http://kafka-consumer:9090/info-type-status"
-# }'
-
-# echo "Getting Consumer Job Infos from ICS"
-# curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1'
-# space
-
-# for i in {1..10}; do
-#   echo
-#   curl -X GET "http://localhost:8080/publish/$i"
-#   sleep 1
-# done
-
-# space
-# echo "Deleting Producer Job infos to ICS"
-# curl -X 'DELETE' \
-#   'http://localhost:8083/data-producer/v1/info-producers/1'
-
-# echo "Deleting Consumer Job infos to ICS"
-# curl -X 'DELETE' \
-#   'http://localhost:8083/data-consumer/v1/info-jobs/1'
-
-# echo "Deleting type1 to ICS to use the callback and stop consuming"
-# curl -X 'DELETE' \
-#   'http://localhost:8083/data-producer/v1/info-types/type1'
-
-
-# echo "ICS Producer Docker logs "
-# docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions'
-# space
-# echo "Demo Producer Docker logs "
-# docker logs kafka-producer | grep c.d.k.controller.KafkaController
-# space
-# echo "Demo Consumer Docker logs "
-# docker logs kafka-consumer | grep c.d.kafkaconsumer.service.KafkaConsumer
-# space
-
-# echo "Done."
-
-# containers=("kafka-producer" "kafka-consumer")
-
-# for container in "${containers[@]}"; do
-#   if docker logs "$container" | grep -q ERROR; then
-#     echo "Errors found in logs of $container"
-#     docker logs "$container" | grep ERROR
-#     echo "FAIL"
-#     exit 1
-#   else
-#     echo "No errors found in logs of $container"
-#   fi
-# done
-# echo "SUCCESS"
-# docker compose down
-# exit 0
+source ./utils/utils.sh
+
+docker build -t nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-sample-simple-icsproducer:0.0.1 ../kafka-producer/
+docker build -t nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-sample-simple-icsconsumer:0.0.1 ../kafka-consumer/
+
+docker compose up -d
+
+# Wait for the Kafka container to be running
+wait_for_container "broker" "Kafka Server started"
+wait_for_container "kafka-producer" "Started KafkaProducerApplication"
+wait_for_container "kafka-consumer" "Started KafkaConsumerApplication"
+
+# Once Kafka container is running, start the producers and consumers
+echo "Kafka container is up and running. Starting producer and consumer..."
+space
+
+curl -v -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "TRACE"}' http://localhost:8083/actuator/loggers/org.oransc.ics
+
+echo "Sending type1 to ICS"
+curl -X 'PUT' \
+  'http://localhost:8083/data-producer/v1/info-types/type1' \
+  -H 'accept: application/json' \
+  -H 'Content-Type: application/json' \
+  -d '{
+  "info_job_data_schema": {
+    "$schema":"http://json-schema.org/draft-07/schema#",
+    "title":"STD_Type1_1.0.0",
+    "description":"Type 1",
+    "topic": "mytopic",
+    "bootStrapServers": "broker:9092"
+    }
+}'
+
+echo "Getting types from ICS"
+curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1'
+space
+
+echo "Sending Producer infos to ICS"
+curl -X 'PUT' \
+  'http://localhost:8083/data-producer/v1/info-producers/1' \
+  -H 'accept: application/json' \
+  -H 'Content-Type: application/json' \
+  -d '{
+  "info_producer_supervision_callback_url": "http://kafka-producer:8080/health-check",
+  "supported_info_types": [
+    "type1"
+  ],
+  "info_job_callback_url": "http://kafka-producer:8080/info-job"
+}'
+
+echo "Getting Producers Infos from ICS"
+curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1'
+space
+
+echo "Sending Consumer Subscription Job infos to ICS"
+curl -X 'PUT' \
+  'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \
+  -H 'accept: application/json' \
+  -H 'Content-Type: application/json' \
+  -d '{
+  "status_result_uri": "http://kafka-consumer:9090/info-type-status",
+  "owner": "demo"
+}'
+echo "Getting Consumer Subscription Job infos from ICS"
+curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json'
+space
+
+#start Consumer
+echo "Sending type1 to ICS to use the callback, This will start a CONSUMER"
+curl -X 'PUT' \
+  'http://localhost:8083/data-producer/v1/info-types/type1' \
+  -H 'accept: application/json' \
+  -H 'Content-Type: application/json' \
+  -d '{
+  "info_job_data_schema": {
+    "$schema":"http://json-schema.org/draft-07/schema#",
+    "title":"STD_Type1_1.0.0",
+    "description":"Type 1",
+    "topic": "mytopic",
+    "bootStrapServers": "broker:9092"
+    }
+}'
+
+sleep 3
+
+#ICS starts a producer (healthcheck to status)
+echo "Sending Consumer Job infos to ICS, This will start a PRODUCER"
+curl -X 'PUT' \
+  'http://localhost:8083/data-consumer/v1/info-jobs/1' \
+  -H 'accept: application/json' \
+  -H 'Content-Type: application/json' \
+  -d '{
+  "info_type_id": "type1",
+  "job_owner": "demo",
+  "job_definition": {
+    "deliveryInfo": {
+      "topic": "mytopic",
+      "bootStrapServers": "broker:9092",
+      "numberOfMessages": 100
+    }
+  },
+  "job_result_uri": "http://kafka-producer:8080/info-job",
+  "status_notification_uri": "http://kafka-consumer:9090/info-type-status"
+}'
+
+echo "Getting Consumer Job Infos from ICS"
+curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1'
+space
+
+for i in {1..10}; do
+  echo
+  curl -X GET "http://localhost:8080/publish/$i"
+  sleep 1
+done
+
+space
+echo "Deleting Producer Job infos to ICS"
+curl -X 'DELETE' \
+  'http://localhost:8083/data-producer/v1/info-producers/1'
+
+echo "Deleting Consumer Job infos to ICS"
+curl -X 'DELETE' \
+  'http://localhost:8083/data-consumer/v1/info-jobs/1'
+
+echo "Deleting type1 to ICS to use the callback and stop consuming"
+curl -X 'DELETE' \
+  'http://localhost:8083/data-producer/v1/info-types/type1'
+
+echo "ICS Producer Docker logs "
+docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions'
+space
+echo "Demo Producer Docker logs "
+docker logs kafka-producer | grep c.d.k.controller.KafkaController
+space
+echo "Demo Consumer Docker logs "
+docker logs kafka-consumer | grep c.d.kafkaconsumer.service.KafkaConsumer
+space
+
+echo "Done."
+
+containers=("kafka-producer" "kafka-consumer")
+
+for container in "${containers[@]}"; do
+  if docker logs "$container" | grep -q ERROR; then
+    echo "Errors found in logs of $container"
+    docker logs "$container" | grep ERROR
+    echo "FAIL"
+    exit 1
+  else
+    echo "No errors found in logs of $container"
+  fi
+done
+echo "SUCCESS"
+docker compose down
+exit 0