Check VES EventList 57/2457/1
authordemx8as6 <martin.skorupski@highstreet-technologies.com>
Sun, 9 Feb 2020 12:43:48 +0000 (13:43 +0100)
committerdemx8as6 <martin.skorupski@highstreet-technologies.com>
Sun, 9 Feb 2020 13:03:20 +0000 (14:03 +0100)
Client bash added to demonstrate VES eventList.

IssueID: OAM-54
Change-Id: Ia6603a9a8841dfeff1ebbd3e986951444a333385
Signed-off-by: demx8as6 <martin.skorupski@highstreet-technologies.com>
solution/dev/ves-test-collector/client-scripts-ves-v7/README.md
solution/dev/ves-test-collector/client-scripts-ves-v7/json/templates/event-list.json [new file with mode: 0644]
solution/dev/ves-test-collector/client-scripts-ves-v7/sendEventList.sh [new file with mode: 0755]

index 011a4d8..fc0b059 100644 (file)
@@ -118,3 +118,19 @@ This script send a VES message of domain "measurementsForVfScaling" to DCAE. The
 ```
 ./send15minPm.sh FYNG
 ```
+
+### sendEventList
+
+This script send a VES message of domain "fault" AND "heartbeat" as event list to DCAE. It requires three command line parameters:
+
+1. **equipmentType**: Valid equipment types for 1806 and 1810 are [1234, FYNG, R2D2, 7DEV, nSky, 1OSF] according to document "295672 SDN-R System Requirements".
+
+2. **alarmType**: or alarm name. Any string which references a supported alarm name of the equipment type.
+
+3. **severity**: The severity of tha alarm as defined by [VES schema](./json/schema/CommonEventFormat_30.1_ONAP.json). 
+
+The following example show the usage of this script. The alarm "lossOfSignal" for equipment type "nSky" with severtiy "CRITICAL" will be send.
+
+```
+./sendEventList.sh 1234 lossOfSignal CRITICAL
+```
diff --git a/solution/dev/ves-test-collector/client-scripts-ves-v7/json/templates/event-list.json b/solution/dev/ves-test-collector/client-scripts-ves-v7/json/templates/event-list.json
new file mode 100644 (file)
index 0000000..ca5e7a2
--- /dev/null
@@ -0,0 +1,68 @@
+{
+  "eventList": [
+    {
+      "commonEventHeader": {
+        "domain": "@domain@",
+        "eventId": "@eventId@",
+        "eventName": "@domain@_@eventType@",
+        "eventType": "@eventType@",
+        "sequence": 0,
+        "priority": "Low",
+        "reportingEntityId": "",
+        "reportingEntityName": "@controllerName@",
+        "sourceId": "",
+        "sourceName": "@controllerName@",
+        "startEpochMicrosec": "@timestamp@",
+        "lastEpochMicrosec": "@timestamp@",
+        "nfNamingCode": "@type@",
+        "nfVendorName": "@vendor@",
+        "timeZoneOffset": "+00:00",
+        "version": "4.0.1",
+        "vesEventListenerVersion": "7.0.1"
+      },
+      "heartbeatFields": {
+        "heartbeatFieldsVersion": "3.0",
+        "heartbeatInterval": 20,
+        "additionalFields": {
+          "eventTime": "@eventTime@"
+        }
+      }
+    },
+    {
+      "commonEventHeader": {
+        "domain": "@domain@",
+        "eventId": "@eventId@",
+        "eventName": "@domain@_@eventType@_Alarms_@alarm@",
+        "eventType": "@eventType@_Alarms",
+        "sequence": 0,
+        "priority": "High",
+        "reportingEntityId": "",
+        "reportingEntityName": "@controllerName@",
+        "sourceId": "",
+        "sourceName": "@pnfId@",
+        "startEpochMicrosec": "@timestamp@",
+        "lastEpochMicrosec": "@timestamp@",
+        "nfNamingCode": "@type@",
+        "nfVendorName": "@vendor@",
+        "timeZoneOffset": "+00:00",
+        "version": "4.0.1",
+        "vesEventListenerVersion": "7.0.1"
+      },
+      "faultFields": {
+        "faultFieldsVersion": "4.0",
+        "alarmCondition": "@alarm@",
+        "alarmInterfaceA": "@interface@",
+        "eventSourceType": "@eventType@",
+        "specificProblem": "@alarm@",
+        "eventSeverity": "@severity@",
+        "vfStatus": "Active",
+        "alarmAdditionalInformation": {
+          "eventTime": "@eventTime@",
+          "equipType": "@type@",
+          "vendor": "@vendor@",
+          "model": "@model@"
+        }
+      }
+    }
+  ]
+}
\ No newline at end of file
diff --git a/solution/dev/ves-test-collector/client-scripts-ves-v7/sendEventList.sh b/solution/dev/ves-test-collector/client-scripts-ves-v7/sendEventList.sh
new file mode 100755 (executable)
index 0000000..5d6a568
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+################################################################################
+#
+# Copyright 2020 highstreet technologies GmbH and others
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+################################################################################
+# Script to send a VES Message EventList to DCAE
+
+. config;
+      pnfType=${1,,};
+    alarmType=$2;
+     severity=$3;
+       domain="fault";
+echo $pnfType;
+
+# exception for controller alarms
+if [ "${pnfType^^}" == "SDNR" ]
+  then
+    eventType="ONAP_SDNR_Controller";
+fi
+
+declare -A mapping=(
+    [domain]=$domain
+    [controllerName]=$(hostname --fqdn)
+    [pnfId]=${pnfIdByType[$pnfType]}
+    [eventId]="${pnfIdByType[$pnfType]}_${interfaceByType[$pnfType]}_${alarmType}"
+    [eventType]=${eventType}
+    [type]=${pnfType^^}
+    [interface]=${interfaceByType[$pnfType]}
+    [alarm]=${alarmType}
+    [severity]=${severity}
+    [timestamp]=${timestamp}
+    [eventTime]=${eventTime}
+    [vendor]=${vendorsByType[$pnfType]^^}
+    [model]=${modelByType[$pnfType]}
+)
+
+echo "################################################################################";
+echo "# send EventList wiht heartbeat and fault";
+echo;
+for key in "${!mapping[@]}"
+do
+  #label=${${"$spaces$i"}:(-14)};
+  label=$spaces$key;
+  label=${label:(-16)};
+  echo "$label: ${mapping[$key]}";
+  if [ $key = "timestamp" ]; then
+      sequence="$sequence s/\"@$key@\"/${mapping[$key]}/g; "
+  else
+      sequence="$sequence s/@$key@/${mapping[$key]}/g; "
+  fi  
+done
+echo;
+
+body="./json/examples/${pnfType^^}-${alarmType}-${severity}-event-list.json"
+sed -e "$sequence" ./json/templates/event-list.json > $body;
+
+curl -i -k -u $basicAuthVes -X POST -d @${body} --header "Content-Type: application/json" $urlVes
\ No newline at end of file