2 ################################################################################
4 # Copyright 2019 highstreet technologies GmbH and others
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.
18 ################################################################################
19 # Script to send an VES Message Event to DCAE
25 domain=thresholdCrossingAlert;
26 collectionTimestamp=$(date -u -R -d @$timeInS );:
27 time15min=$(( $timeInS - $(($timeInS % 900))));
28 eventStartTimestamp=$(date -u -R -d @$time15min );
30 declare -A severities=(
35 severity=${severities[${3,,}]};
39 [controllerName]=$(hostname --fqdn)
40 [pnfId]=${pnfIdByType[$pnfType]}
41 [eventId]="${pnfIdByType[$pnfType]}_${interfaceByType[$pnfType]}_${alarmType}"
42 [eventType]=${eventType}
44 [interface]=${interfaceByType[$pnfType]}
47 [severity]=${severity}
48 [timestamp]=${timestamp}
49 [eventTime]=${eventTime}
50 [collectionTimestamp]=${collectionTimestamp}
51 [eventStartTimestamp]=${eventStartTimestamp}
52 [vendor]=${vendorsByType[$pnfType]^^}
53 [model]=${modelByType[$pnfType]}
56 echo "################################################################################";
57 echo "# send threshold crossed alert";
59 for key in "${!mapping[@]}"
63 echo "$label: ${mapping[$key]}";
64 if [ $key = "timestamp" ]; then
65 sequence="$sequence s/\"@$key@\"/${mapping[$key]}/g; "
67 sequence="$sequence s/@$key@/${mapping[$key]}/g; "
72 body=./json/examples/${pnfType^^}-${alarmType}-${action}-${domain}.json;
73 sed -e "$sequence" ./json/templates/$domain.json > $body;
75 curl -i -k -u $basicAuthVes -X POST -d @${body} --header "Content-Type: application/json" $urlVes