summaryrefslogtreecommitdiffstats
path: root/tools/development/message-router/mrserver.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/development/message-router/mrserver.js')
-rw-r--r--tools/development/message-router/mrserver.js49
1 files changed, 42 insertions, 7 deletions
diff --git a/tools/development/message-router/mrserver.js b/tools/development/message-router/mrserver.js
index ace7f9b..c5414de 100644
--- a/tools/development/message-router/mrserver.js
+++ b/tools/development/message-router/mrserver.js
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nokia.
+ * Copyright (C) 2021-2022 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,39 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+
+function handleVesNotificationRequest(res) {
+ let MEAS_COLLEC = "org.3GPP.32.435#measCollec"
+ let MEAS_DATA = "org.3GPP.28.532#measData"
+ let filetType = MEAS_COLLEC
+ let fileUrl = "sftp://admin:admin@sftp-server:22/upload/A20181002.0000-1000-0015-1000_5G.xml.gz"
+ let filePublishName = "A_28532_measData_test_onap.xml"
+ res.writeHead(200, {'Content-Type': 'application/json'});
+ let result = "[\"{\\\"event\\\":{\\\"commonEventHeader\\\":{\\\"startEpochMicrosec\\\":8745745764578,\\\"eventId\\\":\\\"FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1\\\",\\\"timeZoneOffset\\\":\\\"UTC+05.30\\\",\\\"internalHeaderFields\\\":{\\\"collectorTimeStamp\\\":\\\"Thu, 05 12 2022 06:20:00 UTC\\\"},\\\"priority\\\":\\\"Normal\\\",\\\"version\\\":\\\"4.0.1\\\",\\\"reportingEntityName\\\":\\\"NOK6061ZW3\\\",\\\"sequence\\\":0,\\\"domain\\\":\\\"notification\\\",\\\"lastEpochMicrosec\\\":8745745764578,\\\"eventName\\\":\\\"Notification_gnb-Nokia_FileReady\\\",\\\"vesEventListenerVersion\\\":\\\"7.0.1\\\",\\\"sourceName\\\":\\\"NOK6061ZW3\\\"},\\\"notificationFields\\\":{\\\"notificationFieldsVersion\\\":\\\"2.0\\\",\\\"changeType\\\":\\\"FileReady\\\",\\\"changeIdentifier\\\":\\\"PM_MEAS_FILES\\\",\\\"arrayOfNamedHashMap\\\":[{\\\"name\\\":\\\""
+ + filePublishName
+ + "\\\",\\\"hashMap\\\":{\\\"location\\\":\\\""
+ + fileUrl
+ + "\\\",\\\"fileFormatType\\\":\\\""
+ + filetType
+ + "\\\",\\\"fileFormatVersion\\\":\\\"V1\\\",\\\"compression\\\":\\\"gzip\\\"}}]}}}\"]";
+
+ res.end(result);
+}
+
+function handleAllTypeRequest(res, req) {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ console.log('Received message');
+ req.on('data', chunk => {
+ console.log(`-----MESSAGE_CONTENT_BEGIN-----\n ${chunk}`);
+ console.log('-----MESSAGE_CONTENT_END-----');
+ });
+}
+
+function isVesNotificationRequest(req) {
+ var vesNotificationTopic = "unauthenticated.VES_NOTIFICATION_OUTPUT"
+ return req.url.includes(vesNotificationTopic);
+}
+
var httpServer = function () {
var http = require('http'),
@@ -30,12 +63,14 @@ var httpServer = function () {
},
processHttpRequest = function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- console.log('Received message');
- req.on('data', chunk => {
- console.log(`-----MESSAGE_CONTENT_BEGIN-----\n ${chunk}`);
- console.log('-----MESSAGE_CONTENT_END-----');
- });
+
+ if (isVesNotificationRequest(req)) {
+ console.log("Received VES_NOTIFICATION request ")
+ handleVesNotificationRequest(res);
+ return;
+ }
+
+ handleAllTypeRequest(res, req);
setTimeout(() => {
res.end('Published' + ' Successfully.\n');
}, 100)