Updated installation and components
[nonrtric/plt/ranpm.git] / install / scripts / push-genfiles-to-file-ready-topic.sh
1 #!/bin/bash
2
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
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
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=================================================
18 #
19
20 SD=$(dirname -- "$0")
21 echo "${0##*/} script-home: "$SD
22 cd $SD
23 CWD=$PWD
24
25
26 NODE_COUNT=$1
27 EVT_COUNT=$2
28 NODE_NAME_BASE=$3
29 FILE_EXT=$4
30 TYPE=$5
31 SRV_COUNT=$6
32 HIST=$7
33
34 print_usage() {
35     echo "Usage: push-genfiles-to-file-ready-topic.sh <node-count> <num-of-events> <node-name-base> <file-extension> sftp|ftpes|https <num-servers> [hist]"
36     exit 1
37 }
38 if [ $# -lt 6 ] || [ $# -gt 7 ]; then
39     print_usage
40 fi
41
42 if [ $TYPE == "sftp" ]; then
43     echo "sftp servers not yet supported"
44 elif [ $TYPE == "ftpes" ]; then
45     echo "ftpes servers not yet supported"
46 elif [ $TYPE == "https" ]; then
47     :
48 else
49     print_usage
50 fi
51
52 if [ $FILE_EXT != "xml.gz" ]; then
53     echo "only xml.gz format supported"
54     print_usage
55 fi
56
57 if [ ! -z "$HIST" ]; then
58     if [ $HIST != "hist" ]; then
59         print_usage
60     fi
61 fi
62
63 if [ "$KUBECONFIG" == "" ]; then
64     echo "Env var KUBECONFIG not set, using current settings for kubectl"
65 else
66     echo "Env var KUBECONFIG set to $KUBECONFIG"
67 fi
68
69 chmod +x kafka-client-send-genfiles-file-ready.sh
70 kubectl cp kafka-client-send-genfiles-file-ready.sh nonrtric/kafka-client:/home/appuser
71
72 kubectl exec kafka-client -n nonrtric -- bash -c './kafka-client-send-genfiles-file-ready.sh file-ready '$NODE_COUNT' '$EVT_COUNT' '$NODE_NAME_BASE' '$FILE_EXT' '$TYPE' '$SRV_COUNT' '$HIST
73
74 echo done
75