blob: 87cf2ce9459b1c46efef3b553ae7f36db33511a3 [file] [log] [blame]
demx8as6562a65a2021-03-30 10:56:02 +02001#!/usr/bin/env python
2################################################################################
3# Copyright 2021 highstreet technologies GmbH
4#
5# Licensed under the Apache License, Version 2.0 (the 'License');
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
demx8as686b92e82021-05-08 15:58:54 +02009# https://www.apache.org/licenses/LICENSE-2.0
demx8as6562a65a2021-03-30 10:56:02 +020010#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an 'AS IS' BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18################################################################################
19# Send a VES event for domain 'heartbeat'
20
21# importing the datetime, json, requests, os socket and yaml library
demx8as6731fccb2021-04-17 14:55:54 +020022from globalVesEventEmitter import getInitData, saveExample, sendVesEvent
demx8as6562a65a2021-03-30 10:56:02 +020023
24# Globals
25domain = 'heartbeat'
26initData = getInitData(domain)
demx8as6562a65a2021-03-30 10:56:02 +020027print('################################################################################')
28print('# send SDN-Controller ' + domain)
29
30initData['body']['event']['commonEventHeader']['domain'] = initData['domain']
31initData['body']['event']['commonEventHeader']['eventId'] = initData['fqdn'] + '_' + initData['eventTime']
32initData['body']['event']['commonEventHeader']['eventName'] = initData['domain'] + '_' + initData['config']['settings']['eventType']
33initData['body']['event']['commonEventHeader']['eventType'] = initData['config']['settings']['eventType']
34initData['body']['event']['commonEventHeader']['sequence'] = initData['config']['settings']['sequence']
35initData['body']['event']['commonEventHeader']['reportingEntityName'] = initData['fqdn']
36initData['body']['event']['commonEventHeader']['sourceName'] =initData['fqdn']
37initData['body']['event']['commonEventHeader']['startEpochMicrosec'] = initData['timestamp']
38initData['body']['event']['commonEventHeader']['lastEpochMicrosec'] = initData['timestamp']
39initData['body']['event']['commonEventHeader']['nfNamingCode'] = 'SDN-Controller'
40initData['body']['event']['commonEventHeader']['nfVendorName'] = 'O-RAN-SC OAM'
41
42initData['body']['event']['heartbeatFields']['additionalFields']['eventTime'] = initData['eventTime']
43
44# Save example body
demx8as6f9e11bb2021-04-02 13:37:33 +020045saveExample(initData)
demx8as6562a65a2021-03-30 10:56:02 +020046
47# Send VES Event
demx8as6731fccb2021-04-17 14:55:54 +020048sendVesEvent(initData)