2 ################################################################################
4 # Copyright 2022 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 # https://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
28 # exception for controller alarms
29 if [ "${pnfType^^}" == "SDNR" ]
31 eventType="ONAP_SDNR_Controller";
34 if [ "${raised,,}" != "cleared" ]
41 [controllerName]=$(hostname --fqdn)
42 [pnfId]=${pnfIdByType[$pnfType]}
43 [eventId]="${pnfIdByType[$pnfType]}_${interfaceByType[$pnfType]}_${alarmType}"
44 [eventType]=${eventType}
46 [interface]=${interfaceByType[$pnfType]}
48 [severity]=${severity}
49 [timestamp]=${timestamp}
50 [eventTime]=${eventTime}
51 [vendor]=${vendorsByType[$pnfType]^^}
52 [model]=${modelByType[$pnfType]}
55 echo "################################################################################";
56 echo "# send NotifyNewAlarm or NotifyClearedAlarm";
58 echo " alarmEventType: $raised"
59 for key in "${!mapping[@]}"
61 #label=${${"$spaces$i"}:(-14)};
64 echo "$label: ${mapping[$key]}";
65 if [ $key = "timestamp" ]; then
66 sequence="$sequence s/\"@$key@\"/${mapping[$key]}/g; "
68 sequence="$sequence s/@$key@/${mapping[$key]}/g; "
73 body="./json/examples/${pnfType^^}-${alarmType}-${severity}-${raised,,}-${domain}.json"
74 template="./json/templates/$domain-r16-notify-${raised,,}-alarm.json"
75 sed -e "$sequence" $template > $body;
77 curl -i -k -u $basicAuthVes -X POST -d @${body} --header "Content-Type: application/json" $urlVes