Updated test for helm chart recipe 94/7294/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Fri, 10 Dec 2021 09:43:32 +0000 (10:43 +0100)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Fri, 10 Dec 2021 13:53:23 +0000 (14:53 +0100)
Issue-ID: NONRTRIC-618

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: I99426c99e0e33fbbeae06103428d9b452a72f3da

16 files changed:
test/auto-test/FTC_HELM_E_RELEASE.sh
test/auto-test/README.md
test/auto-test/override_ftc_helm_e_release.sh
test/common/ricsim_api_functions.sh
test/common/test_env-onap-guilin.sh
test/common/test_env-onap-honolulu.sh
test/common/test_env-onap-istanbul.sh
test/common/test_env-oran-cherry.sh
test/common/test_env-oran-d-release.sh
test/common/test_env-oran-e-release.sh
test/common/testcase_common.sh
test/http-https-proxy/Dockerfile
test/kafka-procon/main.go
test/mrstub/Dockerfile
test/mrstub/app/main.py
test/simulator-group/pvc-cleaner/pvc-cleaner.yaml

index 2a6a307..dcbe7b3 100755 (executable)
 
 TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm chats - all components - E-RELEASE"
 # This script requires the helm charts for nonrtric, a1simulator and a1controller are installed
-# There should be 2 simulator of version started
+# There should be 2 simulator of each A1 interface version started
 
 #App names to include in the test when running docker, space separated list
 DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
 
 #App names to include in the test when running kubernetes, space separated list
-KUBE_INCLUDED_IMAGES=" MR CR  PRODSTUB KUBEPROXY"
+KUBE_INCLUDED_IMAGES=" MR DMAAPMR CR  PRODSTUB KUBEPROXY KAFKAPC"
 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
 KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ICS RC SDNC DMAAPMED DMAAPADP"
 
@@ -40,13 +40,14 @@ setup_testenvironment
 
 #### TEST BEGIN ####
 
-use_mr_http       #MR only supports http?
+use_mr_https
 use_cr_https
 use_agent_rest_https
 use_sdnc_https
 use_simulator_https
 use_ics_rest_https
 use_prod_stub_https
+use_dmaapmed_https
 
 if [ $ICS_VERSION == "V1-1" ]; then
     use_rapp_catalogue_http # https not yet supported
@@ -67,10 +68,10 @@ fi
 
 clean_environment
 
-pms_kube_pvc_reset
-
 ics_kube_pvc_reset
 
+pms_kube_pvc_reset
+
 start_kube_proxy
 
 STD_NUM_RICS=2
@@ -88,7 +89,16 @@ start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
 echo " RIC MAPPING a1-sim-std2-0 : ric5"
 echo " RIC MAPPING a1-sim-std2-1 : ric6"
 
-start_mr
+start_mr    "$MR_READ_TOPIC"  "/events" "users/policy-agent" \
+            "$MR_WRITE_TOPIC" "/events" "users/mr-stub" \
+            "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \
+            "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs"
+
+start_kafkapc
+
+kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text" "text/plain"
+
+kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text"
 
 start_control_panel
 
@@ -313,6 +323,7 @@ do
     sim_equal "a1-sim-osc-"$i num_instances 2
 done
 
+cr_api_reset 0   # Reset CR to count new events
 
 echo "ADD EVENT/STATUS CHECK"
 echo "ADD MR CHECK"
@@ -346,7 +357,7 @@ if [ $ICS_VERSION == "V1-1" ]; then
 else
     ics_api_edp_put_type_2 201 type1 testdata/ics/ei-type-1.json
     ics_api_edp_get_type_2 200 type1
-    ics_api_edp_get_type_ids 200 type1
+    ics_api_edp_get_type_ids 200 STD_Fault_Messages ExampleInformationTypeKafka ExampleInformationType type1
 
     ics_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
     ics_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
@@ -367,7 +378,7 @@ fi
 if [ $ICS_VERSION == "V1-1" ]; then
     prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
 else
-    if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
+    if [[ "$ICS_FEATURE3LEVEL" == *"INFO-TYPES"* ]]; then
         prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
     else
         prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
@@ -398,13 +409,13 @@ start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE
 
 start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
 
-ics_equal json:ei-producer/v1/eiproducers 2 60
+ics_equal json:data-producer/v1/info-producers 3 120
 
-ics_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages
+ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka STD_Fault_Messages type-1
 
-ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
+ics_api_edp_get_producer_ids_2 200 NOTYPE prod-a DmaapGenericInfoProducer DMaaP_Mediator_Producer
 
-NUM_JOBS=5
+NUM_JOBS=1
 
 for ((i=1; i<=$NUM_JOBS; i++))
 do
@@ -414,23 +425,30 @@ done
 for ((i=1; i<=$NUM_JOBS; i++))
 do
     ics_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH_0/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH_0/job_status_info-ownery$i testdata/dmaap-adapter/job-template.json
+    ics_api_idc_put_job 201 jobz$i ExampleInformationTypeKafka $CR_SERVICE_MR_PATH_0/jobz-data$i info-ownerz$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerz$i testdata/dmaap-adapter/job-template-1-kafka.json
 done
 
 for ((i=1; i<=$NUM_JOBS; i++))
 do
     ics_api_a1_get_job_status 200 jobx$i ENABLED 30
+    ics_api_a1_get_job_status 200 joby$i ENABLED 30
+    ics_api_a1_get_job_status 200 jobz$i ENABLED 30
 done
 
 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
+kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------4'
+kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------6'
+
 
-cr_equal 0 received_callbacks $(($NUM_JOBS*2*2)) 60
+cr_equal 0 received_callbacks $(($NUM_JOBS*2*3)) 200
 for ((i=1; i<=$NUM_JOBS; i++))
 do
     cr_equal 0 received_callbacks?id=jobx-data$i 2
     cr_equal 0 received_callbacks?id=joby-data$i 2
+    cr_equal 0 received_callbacks?id=jobz-data$i 2
 done
 
 for ((i=1; i<=$NUM_JOBS; i++))
@@ -439,6 +457,8 @@ do
     cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
+    cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------4'
+    cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------6'
 done
 
 
index cd3c778..76858fe 100644 (file)
@@ -48,9 +48,12 @@ ORAN D-RELEASE
 
 ORAN E-RELEASE
 =========
->```./PM_EI_DEMO.sh remote-remove  docker  --env-file ../common/test_env-oran-e-release.sh```
+>```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-oran-e-release.sh```
 
->```./PM_EI_DEMO.sh remote-remove  kube  --env-file ../common/test_env-oran-e-release.sh```
+>```./PM_EI_DEMO.sh remote-remove  kube  release --env-file ../common/test_env-oran-e-release.sh```
+
+ORAN E-RELEASE with nonrtric deployed with helm charts for the "dep" repo
+>```../FTC_HELM_E_RELEASE.sh remote-remove  kube  release --env-file ../common/test_env-oran-e-release.sh --override override_ftc_helm_e_release.sh```
 
 ONAP GUILIN
 ===========
@@ -72,7 +75,6 @@ ONAP ISTANBUL
 
 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-onap-istanbul.sh```
 
-Note: When istanbul is released, add the 'release' arg to run released images.
 
 ## Test case categories
 
index c23a310..3894ace 100644 (file)
 #   limitations under the License.                                             #
 ################################################################################
 
-# Override file example
+# Override file for running the e-release helm recipe including all components
 
-KUBE_A1SIM_NAMESPACE="a1-sim"
+KUBE_A1SIM_NAMESPACE="nonrtric"
+KUBE_SDNC_NAMESPACE="nonrtric"
 
 RIC_SIM_PREFIX="a1-sim"
+RIC_SIM_COMMON_SVC_NAME="a1-sim"
+
+ICS_EXTERNAL_PORT=9082
+ICS_EXTERNAL_SECURE_PORT=9083
+
+POLICY_AGENT_EXTERNAL_PORT=9080
+POLICY_AGENT_EXTERNAL_SECURE_PORT=9081
+
+SDNC_EXTERNAL_PORT=8282
+SDNC_EXTERNAL_SECURE_PORT=8383
+
+RAPP_CAT_EXTERNAL_PORT=9085
+RAPP_CAT_EXTERNAL_SECURE_PORT=9086
index 435c208..bd52611 100644 (file)
@@ -58,7 +58,7 @@ __RICSIM_kube_scale_zero() {
 # This function is called for prestarted apps not managed by the test script.
 __RICSIM_kube_scale_zero_and_wait() {
        #__kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-"$RIC_SIM_PREFIX
-       __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app # the values of the app label is not known
+       __kube_scale_and_wait_all_resources $KUBE_A1SIM_NAMESPACE app $KUBE_A1SIM_NAMESPACE"-a1simulator"
 }
 
 # Delete all kube resouces for the app
@@ -335,7 +335,11 @@ get_kube_sim_host() {
 __find_sim_host() {
        if [ $RUNMODE == "KUBE" ]; then
                ricname=$(echo "$1" | tr '_' '-') # Kube does not accept underscore in names as docker do
-               ric_setname="${ricname%-*}"  #Extract the stateful set name
+               if [ -z "$RIC_SIM_COMMON_SVC_NAME" ]; then
+                       ric_setname="${ricname%-*}"  #Extract the stateful set name
+               else
+                       ric_setname=$RIC_SIM_COMMON_SVC_NAME # Use the common svc name in the host name of the sims
+               fi
                echo $RIC_SIM_HTTPX"://"$ricname.$ric_setname.$KUBE_A1SIM_NAMESPACE":"$RIC_SIM_PORT
        else
                if [ $DOCKER_COMPOSE_VERION == "V1" ]; then
index 3254e06..0fdb065 100755 (executable)
@@ -258,6 +258,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator contain
 RIC_SIM_CERT_MOUNT_DIR="./cert"
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 
 SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
 SDNC_DISPLAY_NAME="SDNC A1 Controller"
index b312518..efb5425 100755 (executable)
@@ -314,6 +314,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator contain
 RIC_SIM_CERT_MOUNT_DIR="./cert"
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 
 SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
 SDNC_DISPLAY_NAME="SDNC A1 Controller"
index a8d1b0a..9d13a81 100644 (file)
@@ -317,6 +317,7 @@ RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator contain
 RIC_SIM_CERT_MOUNT_DIR="./cert"
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 
 SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
 SDNC_DISPLAY_NAME="SDNC A1 Controller"
index 6abb133..fbf13f6 100755 (executable)
@@ -317,6 +317,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert"
 
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"                                    # Base path for alive check
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 
 SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
 SDNC_DISPLAY_NAME="SDNC A1 Controller"
index ed7670e..51b1189 100755 (executable)
@@ -336,6 +336,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert"
 
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"                                    # Base path for alive check
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 
 # Kept as reference for oran a1 adapter
 # SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
index 044ad24..65dd0af 100755 (executable)
@@ -367,7 +367,7 @@ RIC_SIM_CERT_MOUNT_DIR="./cert"
 
 RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
 RIC_SIM_ALIVE_URL="/"                                    # Base path for alive check
-
+RIC_SIM_COMMON_SVC_NAME=""                               # Name of svc if one common svc is used for all ric sim groups (stateful sets)
 # Kept as reference for oran a1 adapter
 # SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
 # SDNC_DISPLAY_NAME="SDNC A1 Controller"
index d8b359b..0a25391 100755 (executable)
@@ -756,6 +756,7 @@ fi
 
 echo ""
 # auto adding system apps
+__added_apps=""
 echo -e $BOLD"Auto adding system apps"$EBOLD
 if [ $RUNMODE == "KUBE" ]; then
        INCLUDED_IMAGES=$INCLUDED_IMAGES" "$TESTENV_KUBE_SYSTEM_APPS
@@ -768,26 +769,39 @@ if [ ! -z "$TMP_APPS" ]; then
        for iapp in "$TMP_APPS"; do
                file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]')
                file_pointer="../common/"$file_pointer"_api_functions.sh"
-               echo " Auto-adding system app $iapp.  Sourcing $file_pointer"
+           padded_iapp=$iapp
+               while [ ${#padded_iapp} -lt 16 ]; do
+                       padded_iapp=$padded_iapp" "
+               done
+               echo " Auto-adding system app   $padded_iapp  Sourcing $file_pointer"
                . $file_pointer
+               __added_apps=" $iapp "$__added_apps
        done
 else
        echo " None"
 fi
 
+if [ $RUNMODE == "KUBE" ]; then
+       TMP_APPS=$INCLUDED_IMAGES" "$KUBE_PRESTARTED_IMAGES
+else
+       TMP_APPS=$INCLUDED_IMAGES
+fi
+
 echo -e $BOLD"Auto adding included apps"$EBOLD
-       for iapp in $INCLUDED_IMAGES; do
-               file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]')
-               file_pointer="../common/"$file_pointer"_api_functions.sh"
-               padded_iapp=$iapp
-               while [ ${#padded_iapp} -lt 16 ]; do
-                       padded_iapp=$padded_iapp" "
-               done
-               echo " Auto-adding included app $padded_iapp  Sourcing $file_pointer"
-               . $file_pointer
-               if [ ! -f "$file_pointer" ]; then
-                       echo " Include file $file_pointer for app $iapp does not exist"
-                       exit 1
+       for iapp in $TMP_APPS; do
+               if [[ "$__added_apps" != *"$iapp"* ]]; then
+                       file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]')
+                       file_pointer="../common/"$file_pointer"_api_functions.sh"
+                       padded_iapp=$iapp
+                       while [ ${#padded_iapp} -lt 16 ]; do
+                               padded_iapp=$padded_iapp" "
+                       done
+                       echo " Auto-adding included app $padded_iapp  Sourcing $file_pointer"
+                       . $file_pointer
+                       if [ ! -f "$file_pointer" ]; then
+                               echo " Include file $file_pointer for app $iapp does not exist"
+                               exit 1
+                       fi
                fi
        done
 echo ""
@@ -2245,6 +2259,7 @@ __kube_clean_pvc() {
        export PVC_CLEANER_NAMESPACE=$2
        export PVC_CLEANER_CLAIMNAME=$3
        export PVC_CLEANER_RM_PATH=$4
+       export PVC_CLEANER_APP_NAME
        input_yaml=$SIM_GROUP"/"$PVC_CLEANER_COMPOSE_DIR"/"pvc-cleaner.yaml
        output_yaml=$PWD/tmp/$2-pvc-cleaner.yaml
 
index d7a78ad..7f0ef12 100644 (file)
@@ -13,4 +13,4 @@ COPY cert/pass .
 WORKDIR /usr/src/app
 COPY http_proxy.js .
 
-CMD [ "node", "http_proxy.js" ]
\ No newline at end of file
+CMD [ "node", "http_proxy.js" ]
index 6f8bad2..43be1b5 100644 (file)
@@ -309,6 +309,7 @@ func getTopicCounter(w http.ResponseWriter, req *http.Request) {
 
 func startToSend(w http.ResponseWriter, req *http.Request) {
        t, topicId, exist := getTopicFromRequest(w, req)
+       fmt.Printf("Start to send to topic: %v\n", topicId)
        if !exist {
                return
        }
@@ -324,7 +325,10 @@ func startToSend(w http.ResponseWriter, req *http.Request) {
                        fmt.Printf("Cannot create producer for topic: %v, error details: %v\n", topicId, err)
                        return
                }
-               defer func() { p.Close() }()
+               defer func() {
+                       fmt.Printf("Closing producer for topic: %v\n", topicId)
+                       p.Close()
+               }()
                for {
                        q := t.messages.send
                        if q == nil {
@@ -342,12 +346,12 @@ func startToSend(w http.ResponseWriter, req *http.Request) {
                                        globalCounters.sent.step()
                                        msg := fmt.Sprintf("%v", m)
                                        if len(msg) < 500 {
-                                               fmt.Printf("Message sent on topic: %v, len: %v, msg: %v", topicId, len(msg), msg)
+                                               fmt.Printf("Message sent on topic: %v, len: %v, msg: %v\n", topicId, len(msg), msg)
                                        } else {
-                                               fmt.Printf("Message sent on topic: %v, len: %v, is larger than 500...not printed", topicId, len(msg))
+                                               fmt.Printf("Message sent on topic: %v, len: %v, is larger than 500...not printed\n", topicId, len(msg))
                                        }
                                } else {
-                                       fmt.Printf("Failed to send message on topic: %v. Discarded. Error details: %v", topicId, err)
+                                       fmt.Printf("Failed to send message on topic: %v. Discarded. Error details: %v\n", topicId, err)
                                        q.Remove(0)
                                }
                        } else {
@@ -409,9 +413,9 @@ func startToReceive(w http.ResponseWriter, req *http.Request) {
                                msg, err := c.ReadMessage(maxDur)
                                if err == nil {
                                        if len(msg.Value) < 500 {
-                                               fmt.Printf("Message received on topic: %v, partion: %v, len: %v, msg: %v", topicId, msg.TopicPartition, len(msg.Value), string(msg.Value))
+                                               fmt.Printf("Message received on topic: %v, partion: %v, len: %v, msg: %v\n", topicId, msg.TopicPartition, len(msg.Value), string(msg.Value))
                                        } else {
-                                               fmt.Printf("Message received on topic: %v, partion: %v, len: %v is larger than 500...not printed", topicId, msg.TopicPartition, len(msg.Value))
+                                               fmt.Printf("Message received on topic: %v, partion: %v, len: %v is larger than 500...not printed\n", topicId, msg.TopicPartition, len(msg.Value))
                                        }
                                        err = t.messages.received.Enqueue(string(msg.Value))
                                        if err != nil {
@@ -435,7 +439,9 @@ func startToReceive(w http.ResponseWriter, req *http.Request) {
 // Post a message to a topic
 // POST /send    content type is specified in content type
 func sendToTopic(w http.ResponseWriter, req *http.Request) {
+
        t, topicId, exist := getTopicFromRequest(w, req)
+       fmt.Printf("Send to topic: %v\n", topicId)
        if !exist {
                return
        }
@@ -471,10 +477,12 @@ func sendToTopic(w http.ResponseWriter, req *http.Request) {
                b, err := ioutil.ReadAll(req.Body)
                if err == nil {
                        if len(b) < 500 {
-                               fmt.Printf("Json payload to send on topic: %v, msg: %v", topicId, string(b))
+                               fmt.Printf("Json payload to send on topic: %v, msg: %v\n", topicId, string(b))
                        } else {
-                               fmt.Printf("Json payload to send on topic: %v larger than 500 bytes, not printed...", topicId)
+                               fmt.Printf("Json payload to send on topic: %v larger than 500 bytes, not printed...\n", topicId)
                        }
+               } else {
+                       fmt.Printf("Json payload to send on topic: %v cannnot be decoded, err: %v\n", topicId, err)
                }
                err = q.Enqueue(string(b))
                if err != nil {
@@ -491,10 +499,12 @@ func sendToTopic(w http.ResponseWriter, req *http.Request) {
                b, err := ioutil.ReadAll(req.Body)
                if err == nil {
                        if len(b) < 500 {
-                               fmt.Printf("Text payload to send on topic: %v, msg: %v", topicId, string(b))
+                               fmt.Printf("Text payload to send on topic: %v, msg: %v\n", topicId, string(b))
                        } else {
-                               fmt.Printf("Text payload to send on topic: %v larger than 500 bytes, not printed...", topicId)
+                               fmt.Printf("Text payload to send on topic: %v larger than 500 bytes, not printed...\n", topicId)
                        }
+               } else {
+                       fmt.Printf("Text payload to send on topic: %v cannnot be decoded, err: %v\n", topicId, err)
                }
                err = q.Enqueue(string(b))
                if err != nil {
index 676c77c..ac075bf 100644 (file)
@@ -1,5 +1,5 @@
 #  ============LICENSE_START===============================================
-#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  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.
@@ -34,4 +34,4 @@ RUN pip install -r requirements.txt
 
 RUN chmod +x start.sh
 
-CMD [ "./start.sh" ]
\ No newline at end of file
+CMD [ "./start.sh" ]
index 4b1913f..dd80f3f 100644 (file)
@@ -164,7 +164,8 @@ def dmaap_generic_uploader():
 
     while True:
         if (len(generic_messages)):
-            for topicname in generic_messages.keys():    #topicname contains the path of the topics, eg. "/event/<topic>"
+            keys_copy = list(generic_messages.keys())
+            for topicname in keys_copy:    #topicname contains the path of the topics, eg. "/event/<topic>"
                 topic_queue=generic_messages[topicname]
                 if (len(topic_queue)>0):
                     if (topicname.endswith(".text")):
index 35cf6ea..91ed603 100644 (file)
@@ -11,8 +11,10 @@ spec:
   containers:
   - name: pvc-cleaner
     image: $PVC_CLEANER_IMAGE
+    securityContext:
+      runAsUser: 0
     command: ["/bin/sh","-c"]
-    args: ["rm -rf $PVC_CLEANER_RM_PATH/*"]
+    args: ["rm -rf $PVC_CLEANER_RM_PATH/* ; if [ $? -ne 0 ]; then echo 'Delete failure: '$PVC_CLEANER_RM_PATH; else echo 'Delete OK: '$PVC_CLEANER_RM_PATH; fi"]
     volumeMounts:
     - mountPath: $PVC_CLEANER_RM_PATH
       name: pvc-cleaner-m-vol