blob: 1d5b7cc6d47233b752454df32785b4e11325201c [file] [log] [blame]
BjornMagnussonXAc5655db2023-03-17 14:55:16 +01001#!/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
20SD=$(dirname -- "$0")
21echo "${0##*/} script-home: "$SD
22cd $SD
23CWD=$PWD
24
25
26NODE_COUNT=$1
27EVT_COUNT=$2
28NODE_NAME_BASE=$3
29FILE_EXT=$4
30TYPE=$5
31SRV_COUNT=$6
32HIST=$7
33
34print_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}
38if [ $# -lt 6 ] || [ $# -gt 7 ]; then
39 print_usage
40fi
41
42if [ $TYPE == "sftp" ]; then
43 echo "sftp servers not yet supported"
44elif [ $TYPE == "ftpes" ]; then
45 echo "ftpes servers not yet supported"
46elif [ $TYPE == "https" ]; then
47 :
48else
49 print_usage
50fi
51
52if [ $FILE_EXT != "xml.gz" ]; then
53 echo "only xml.gz format supported"
54 print_usage
55fi
56
57if [ ! -z "$HIST" ]; then
58 if [ $HIST != "hist" ]; then
59 print_usage
60 fi
61fi
62
63if [ "$KUBECONFIG" == "" ]; then
64 echo "Env var KUBECONFIG not set, using current settings for kubectl"
65else
66 echo "Env var KUBECONFIG set to $KUBECONFIG"
67fi
68
69chmod +x kafka-client-send-genfiles-file-ready.sh
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020070kubectl cp kafka-client-send-genfiles-file-ready.sh nonrtric/kafka-client:/home/appuser
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010071
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020072kubectl 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
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010073
74echo done
75