3 # ============LICENSE_START===============================================
4 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
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 echo "script-home: "$SD
32 echo "Usage: kafka-client-send-file-ready.sh <node-count> <num-of-events> <node-name-base> <file-extension> <num-servers>"
48 for (( i=0; i<$EVT_COUNT; i++)); do
50 if [ $CNTR -eq 0 ]; then
55 echo "EVENT NO: $i for $NODE_COUNT NODES - 1 FILE PER EVENT"
57 ST=$(date -d @$CURTIME +'%Y%m%d.%H%M')
58 let CURTIME=CURTIME+900
59 ET=$(date -d @$CURTIME +'%H%M')
61 for (( j=0; j<$NODE_COUNT; j++)); do
63 NO="$NODE_NAME_BASE-$j"
65 #FN="A20000626.2315+0200-2330+0200_$NO-$i.$FILE_EXT"
66 FN="A$ST+0200-$ET+0200_$NO-$i.$FILE_EXT"
67 let SRV_ID=$j%$SRV_COUNT
71 SRV="pm-https-server-$SRV_ID"
72 echo "HTTP SERVER "$SRV
73 URL="https://$SRV:$HTTPS_PORT/files/$FN"
74 EVT='{"event":{"commonEventHeader":{"sequence":0,"eventName":"Noti_RnNode-Ericsson_FileReady","sourceName":"'$NO'","lastEpochMicrosec":151983,"startEpochMicrosec":15198378,"timeZoneOffset":"UTC+05:00","changeIdentifier":"PM_MEAS_FILES"},"notificationFields":{"notificationFieldsVersion":"notificationFieldsVersion","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES","arrayOfNamedHashMap":[{"name":"'$FN'","hashMap":{"fileFormatType":"org.3GPP.32.435#measCollec","location":"'$URL'","fileFormatVersion":"V10","compression":"gzip"}}]}}}'
75 echo $EVT >> .out.json
79 if [ $CNTR -ge $BATCHSIZE ]; then
80 echo "Pushing batch of $CNTR events"
81 cat .out.json | /opt/kafka/bin/kafka-console-producer.sh --topic file-ready --broker-list kafka-1:9092
89 if [ $CNTR -ne 0 ]; then
90 echo "Pushing batch of $CNTR events"
91 cat .out.json | /opt/kafka/bin/kafka-console-producer.sh --topic file-ready --broker-list kafka-1:9092
94 echo "Pushed $TCNTR events"