blob: 03baf97a459959a22b94f64469ac491b85136ee4 [file] [log] [blame]
Filip Krzywkaccdbec82018-12-12 08:14:57 +01001#!/usr/bin/env bash
2# ============LICENSE_START=======================================================
3# dcaegen2-collectors-veshv
4# ================================================================================
5# Copyright (C) 2018 NOKIA
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
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
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=========================================================
19
20set -euo pipefail
21
22
23usage() {
24 echo "Resets dcae-app-simulator consumed messages count"
25 echo "Usage: $0 [-h|--help] [-v|--verbose]"
26 exit 1
27}
28
29optspec=":vh-:" # catch v, h and -
30while getopts "$optspec" arg; do
31 case "${arg}" in
32 -) # handle longopts
33 case "${OPTARG}" in
34 verbose)
35 VERBOSE=True
36 ;;
37 help)
38 usage
39 ;;
40 *)
41 echo "Unknown option --${OPTARG}" >&2
42 usage
43 ;;
44 esac
45 ;;
46 v)
47 VERBOSE=True
48 ;;
49 h)
50 usage
51 ;;
52 *)
53 echo "Unknown option -${OPTARG}" >&2
54 usage
55 ;;
56 esac
57done
58shift $((OPTIND-1))
59
Filip Krzywka5180f3f2019-01-08 07:53:25 +010060DEVELOPMENT_BIN_DIRECTORY=$(realpath $(dirname "$0"))
61source ${DEVELOPMENT_BIN_DIRECTORY}/constants.sh
62
Filip Krzywkaccdbec82018-12-12 08:14:57 +010063if [ -n "${VERBOSE+x}" ]; then
Filip Krzywka5180f3f2019-01-08 07:53:25 +010064 echo "Requesting DCAE app running on port ${DCAE_APP_PORT} to reset messages count"
Filip Krzywkaccdbec82018-12-12 08:14:57 +010065fi
66
Filip Krzywka5180f3f2019-01-08 07:53:25 +010067curl --request DELETE ${DCAE_APP_ADDRESS}/messages
Filip Krzywkaccdbec82018-12-12 08:14:57 +010068echo