X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=solution%2Fdev%2Fves-test-collector%2Fclient-scripts-ves-v7%2FsendVesHeartbeat.py;h=951920eba801e00815757ad6d9c1d8813e01c1a1;hb=refs%2Fchanges%2F01%2F5901%2F2;hp=4e1ff2d1daec340faae4702bc83dc6e969e0ffc0;hpb=562a65a378c3ce3df48947a1a335b89f59f17940;p=oam.git diff --git a/solution/dev/ves-test-collector/client-scripts-ves-v7/sendVesHeartbeat.py b/solution/dev/ves-test-collector/client-scripts-ves-v7/sendVesHeartbeat.py index 4e1ff2d..951920e 100644 --- a/solution/dev/ves-test-collector/client-scripts-ves-v7/sendVesHeartbeat.py +++ b/solution/dev/ves-test-collector/client-scripts-ves-v7/sendVesHeartbeat.py @@ -21,12 +21,11 @@ # importing the datetime, json, requests, os socket and yaml library import json import requests -from globalVesEventEmitter import getInitData +from globalVesEventEmitter import getInitData, saveExample, sendVesEvent # Globals domain = 'heartbeat' initData = getInitData(domain) - print('################################################################################') print('# send SDN-Controller ' + domain) @@ -45,14 +44,7 @@ initData['body']['event']['commonEventHeader']['nfVendorName'] = 'O-RAN-SC OAM' initData['body']['event']['heartbeatFields']['additionalFields']['eventTime'] = initData['eventTime'] # Save example body -outputFileName = initData['directory'] + '/json/examples/' + domain + '.json' -with open(outputFileName, 'w') as f: - json.dump(initData['body'], f, indent=2, sort_keys=True) +saveExample(initData) # Send VES Event -url = initData['config']['vesEndpoint']['url'] -username = initData['config']['vesEndpoint']['username'] -password = initData['config']['vesEndpoint']['password'] -verify = initData['config']['vesEndpoint']['verify'] -response = requests.post(url, json=initData['body'], auth=(username, password), verify=verify) -print(response) +sendVesEvent(initData) \ No newline at end of file