3 # ============LICENSE_START===============================================
4 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
5 # Copyright (C) 2023-2025 OpenInfra Foundation Europe. All rights reserved.
6 # ========================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=================================================
22 echo "script-home: "$SD
40 echo "Usage: kafka-client-send-genfiles-file-ready.sh ves|file-ready <node-count> <num-of-events> <node-name-base> <file-extension> sftp|ftpes|https <num-servers> [hist]"
44 if [ $# -lt 7 ] && [ $# -gt 8 ]; then
48 if [ $TYPE == "sftp" ]; then
49 echo "sftp servers not yet supported"
50 elif [ $TYPE == "ftpes" ]; then
51 echo "ftpes servers not yet supported"
52 elif [ $TYPE == "https" ]; then
58 if [ $FILE_EXT != "xml.gz" ]; then
59 echo "only xml.gz format supported"
64 if [ ! -z "$HIST" ]; then
65 if [ $HIST != "hist" ]; then
71 if [ $VARIANT == "ves" ]; then
72 PUSHMSG="to ves-collector"
73 elif [ $VARIANT == "file-ready" ]; then
74 PUSHMSG="to file-ready topic"
75 elif [ $VARIANT == "file-ready-ts28532" ]; then
76 PUSHMSG="to file-ready topic"
79 # Unix time of 20230515.0700
80 # If the value is changed, make sure to set the same time to the env var GENERATED_FILE_START_TIME in kube-plt.yaml for the https-server
83 # If the value is changed, make sure to set the same value to the env var GENERATED_FILE_TIMEZONE in kube-plt.yaml for the https-server
88 if [ $VARIANT == "ves" ]; then
95 for (( i=0; i<$EVT_COUNT; i++)); do
97 if [ $CNTR -eq 0 ]; then
100 if [ $VARIANT == "ves" ]; then
101 echo '{"eventList": [' > .out.json
105 if [ "$HIST" == "" ]; then
106 echo "EVENT NO: $i for $NODE_COUNT NODES - 1 FILE PER EVENT"
108 echo "EVENT NO: $i for $NODE_COUNT NODES - $HIST_LEN FILES PER EVENT"
110 let STTIMEMS=$CURTIME*1000000
111 ST=$(date -d @$CURTIME +'%Y%m%d.%H%M')
112 let CURTIME=CURTIME+900
113 let CURTIMEMS=$CURTIME*1000000
114 ET=$(date -d @$CURTIME +'%H%M')
116 for (( j=0; j<$NODE_COUNT; j++)); do
118 if [ "$HIST" == "" ]; then
119 NO="$NODE_NAME_BASE-$j"
121 FN="A$ST$TIMEZONE-$ET${TIMEZONE}_$NO.$FILE_EXT"
122 let SRV_ID=$j%$SRV_COUNT
127 if [ $TYPE == "sftp" ]; then
128 SRV="ftp-sftp-$SRV_ID"
129 echo "FTP SERVER "$SRV
130 URL="sftp://onap:pano@$SRV:$SFTP_PORT/$FN"
131 elif [ $TYPE == "ftpes" ]; then
132 SRV="ftp-ftpes-$SRV_ID"
133 echo "FTP SERVER "$SRV
134 URL="ftpes://onap:pano@$SRV:$FTPES_PORT/$FN"
135 elif [ $TYPE == "https" ]; then
136 SRV="pm-https-server-$SRV_ID.pm-https-server.ran"
137 echo "HTTP SERVER "$SRV
138 URL="https://$SRV:$HTTPS_PORT/generatedfiles/$FN"
141 if [ $VARIANT == "ves" ] && [ $CNTR -gt 0 ]; then
142 echo "," >> .out.json
144 if [ $VARIANT == "ves" ]; then
145 EVT='{"commonEventHeader":{"domain":"notification","sequence":0,"eventName":"Noti_RnNode-Ericsson_FileReady","eventId":"FileReady_'$TCNTR'","priority":"Normal","version":"4.0.1","vesEventListenerVersion":"7.0.1","sourceName":"'$NO'","reportingEntityName":"'$NO'","lastEpochMicrosec":'$CURTIMEMS',"startEpochMicrosec":'$STTIMEMS',"timeZoneOffset":"UTC'$TIMEZONE'"},"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES","arrayOfNamedHashMap":[{"name":"'$FN'","hashMap":{"fileFormatType":"org.3GPP.32.435#measCollec","location":"'$URL'","fileFormatVersion":"V10","compression":"gzip"}}]}}'
146 elif [ $VARIANT == "file-ready-ts28532" ]; then
147 EVT='{"event":{"commonEventHeader":{"reportingEntityId":"","nfNamingCode":"001","timeZoneOffset":"UTC'$TIMEZONE'","version":"4.1","vesEventListenerVersion":"7.2.1","domain":"stndDefined","eventId":"ManagedElement=pynts-o-du-o1_stndDefined","eventName":"stndDefined_PyNTS_FileReady","eventType":"PyNTS_FileReady","sequence":0,"priority":"Low","reportingEntityName":"ManagementElement=pynts-o-du-o1","sourceId":"ManagementElement=pynts-o-du-o1","sourceName":"'$NO'","startEpochMicrosec":1737029100022212,"lastEpochMicrosec":1737029100022212,"nfVendorName":"pynts","stndDefinedNamespace":"3GPP-PerformanceAssurance"},"stndDefinedFields":{"schemaReference":"https://forge.3gpp.org/rep/sa5/MnS/blob/Rel-18/OpenAPI/TS28532_FileDataReportingMnS.yaml#components/schemas/NotifyFileReady","stndDefinedFieldsVersion":"1.0","data":{"href":"href1","notificationType":"notifyFileReady","fileInfoList":[{"fileSize":1288,"fileExpirationTime":"2025-01-16T12:08:00.017Z","fileCompression":"no","fileFormat":"xml","fileDataType":"Performance","fileLocation":"'$URL'","fileReadyTime":"2025-01-16T12:05:00.022Z"}],"additionalText":"Have fun!","notificationId":1,"eventTime":"2025-01-16T12:05:00.022Z","systemDN":"ManagedElement=pynts-o-du-o1"}}}}'
149 EVT='{"event":{"commonEventHeader":{"sequence":0,"eventName":"Noti_RnNode-Ericsson_FileReady","sourceName":"'$NO'","lastEpochMicrosec":'$CURTIMEMS',"startEpochMicrosec":'$STTIMEMS',"timeZoneOffset":"UTC'$TIMEZONE'","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"}}]}}}'
151 echo $EVT >> .out.json
153 NO="$NODE_NAME_BASE-$j"
155 let SRV_ID=$j%$SRV_COUNT
159 for(( k=95; k>=0; k-- )); do
162 CURTIME=$(($BEGINTIME+$FID*900))
163 let STTIMEMS=$CURTIME*1000000
164 ST=$(date -d @$CURTIME +'%Y%m%d.%H%M')
165 let CURTIME=CURTIME+900
166 let CURTIMEMS=$CURTIME*1000000
167 ET=$(date -d @$CURTIME +'%H%M')
168 if [ $FID -lt 0 ]; then
169 FN="NONEXISTING_$NO.$FILE_EXT"
171 FN="A$ST$TIMEZONE-$ET${TIMEZONE}_$NO.$FILE_EXT"
174 SRV="pm-https-server-$SRV_ID.pm-https-server.ran"
175 URL="https://$SRV:$HTTPS_PORT/files/$FN"
176 if [ "$EVT_FRAG" != "" ]; then
177 EVT_FRAG=$EVT_FRAG","
179 EVT_FRAG=$EVT_FRAG'{"name":"'$FN'","hashMap":{"fileFormatType":"org.3GPP.32.435#measCollec","location":"'$URL'","fileFormatVersion":"V10","compression":"gzip"}}'
182 if [ $VARIANT == "ves" ] && [ $CNTR -gt 0 ]; then
183 echo "," >> .out.json
185 if [ $VARIANT == "ves" ]; then
186 EVT='{"commonEventHeader":{"domain":"notification","sequence":0,"eventName":"Noti_RnNode-Ericsson_FileReady","eventId":"FileReady_'$TCNTR'","priority":"Normal","version":"4.0.1","vesEventListenerVersion":"7.0.1","sourceName":"'$NO'","reportingEntityName":"'$NO'","lastEpochMicrosec":'$CURTIMEMS',"startEpochMicrosec":'$STTIMEMS',"timeZoneOffset":"UTC'$TIMEZONE'"},"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES","arrayOfNamedHashMap":[{"name":"'$FN'","hashMap":{"fileFormatType":"org.3GPP.32.435#measCollec","location":"'$URL'","fileFormatVersion":"V10","compression":"gzip"}}]}}'
187 elif [ $VARIANT == "file-ready-ts28532" ]; then
188 EVT='{"event":{"commonEventHeader":{"reportingEntityId":"","nfNamingCode":"001","timeZoneOffset":"UTC'$TIMEZONE'","version":"4.1","vesEventListenerVersion":"7.2.1","domain":"stndDefined","eventId":"ManagedElement=pynts-o-du-o1_stndDefined","eventName":"stndDefined_PyNTS_FileReady","eventType":"PyNTS_FileReady","sequence":0,"priority":"Low","reportingEntityName":"ManagementElement=pynts-o-du-o1","sourceId":"ManagementElement=pynts-o-du-o1","sourceName":"'$NO'","startEpochMicrosec":1737029100022212,"lastEpochMicrosec":1737029100022212,"nfVendorName":"pynts","stndDefinedNamespace":"3GPP-PerformanceAssurance"},"stndDefinedFields":{"schemaReference":"https://forge.3gpp.org/rep/sa5/MnS/blob/Rel-18/OpenAPI/TS28532_FileDataReportingMnS.yaml#components/schemas/NotifyFileReady","stndDefinedFieldsVersion":"1.0","data":{"href":"href1","notificationType":"notifyFileReady","fileInfoList":[{"fileSize":1288,"fileExpirationTime":"2025-01-16T12:08:00.017Z","fileCompression":"no","fileFormat":"xml","fileDataType":"Performance","fileLocation":"'$URL'","fileReadyTime":"2025-01-16T12:05:00.022Z"}],"additionalText":"Have fun!","notificationId":1,"eventTime":"2025-01-16T12:05:00.022Z","systemDN":"ManagedElement=pynts-o-du-o1"}}}}'
190 EVT='{"event":{"commonEventHeader":{"sequence":0,"eventName":"Noti_RnNode-Ericsson_FileReady","sourceName":"'$NO'","lastEpochMicrosec":'$CURTIMEMS',"startEpochMicrosec":'$STTIMEMS',"timeZoneOffset":"UTC'$TIMEZONE'","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"}}]}}}'
192 echo $EVT >> .out.json
197 if [ $CNTR -ge $BATCHSIZE ]; then
198 echo "Pushing batch of $CNTR events $PUSHMSG"
199 if [ $VARIANT == "ves" ]; then
200 echo ']}' >> .out.json
201 curl -s -X POST http://ves-collector.nonrtric:8080/eventListener/v7/eventBatch --header 'Content-Type: application/json' --data-binary @.out.json
203 cat .out.json | kafka-console-producer --topic file-ready --broker-list kafka-1-kafka-bootstrap.nonrtric:9092
207 if [ $VARIANT == "ves" ]; then
208 echo '{"eventList": [' > .out.json
214 if [ $CNTR -ne 0 ]; then
215 echo "Pushing batch of $CNTR events $PUSHMSG"
216 if [ $VARIANT == "ves" ]; then
217 echo ']}' >> .out.json
218 curl -s -X POST http://ves-collector.nonrtric:8080/eventListener/v7/eventBatch --header 'Content-Type: application/json' --data-binary @.out.json
220 cat .out.json | kafka-console-producer --topic file-ready --broker-list kafka-1-kafka-bootstrap.nonrtric:9092
224 echo "Pushed $TCNTR events"