Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ operator/node_modules
.DS_Store
/.project
/.externalToolBuilders
.DS_Store
.swp
..project
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.7.7 (23 May 2025 - by HN)
- support `mqtt` input mode
- fixed bug when using MongoDB 5.x, 6.x, 7.x
- fixed bug when viewing
- dashboard for 5G traffic at N2 interface

# v1.7.6 (02 June 2023 - by HN)
- update new set of protocol names: 656: "8021AD", 657: "mqtt", 658: "INBAND_NETWORK_TELEMETRY", 659: "INT_REPORT", 660: "DTLS", 661:
"QUIC_IETF", 700: "HTTP2"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12-alpine
FROM node:22-alpine

LABEL maintainer="Montimage <contact@montimage.com>"

Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,26 @@ This chain of tools depends on the following packages:

Follow the instruction on nodejs.org: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

### 2. Mongo DB v4.4
### 2. Mongo DB

Follow the procedure described on the following link to install the latest version of Mongodb: https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-ubuntu/
Follow the procedure described on the following link to install Mongodb: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

For example, the following commands will install MongoDB 8.0 on Ubuntu server 22.04:

```bash
# install gnupg and curl if they are not already available:
sudo apt-get install gnupg curl
# import the MongoDB public GPG key,
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor
# create the list file for Ubuntu 22.04
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
# reload the package database
sudo apt-get update
# install MongoDB Community Server
sudo apt-get install -y mongodb-org
```

## Usage

Expand Down
23 changes: 4 additions & 19 deletions www/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ const util = require('util');
const moment = require('moment');
const fs = require('fs');
const child_process = require("child_process");

//3rd lib
const MongoStore = require('connect-mongo')(session);

const os = require("os");

global.rootRequire = name => require(`${__dirname}/${name}`);
global.libRequire = name => require(`${__dirname}/libs/${name}`);
Expand All @@ -39,7 +36,7 @@ process.title = "mmt-operator";
console.log("Start MMT-Operator");
console.info(config.json);

console.log("[INFO] NodeJS version: %s, platform: %s", process.version, process.platform);
console.log("[INFO] NodeJS version: %s, OS: %s-%s", process.version, os.type(), os.release());

console.logStdout("[INFO] MMT-Operator version %s is listening on port %d ...\n", config.version, config.port_number);

Expand Down Expand Up @@ -134,27 +131,15 @@ app.use(bodyParser.json({ limit: '200mb' }));
app.use(bodyParser.urlencoded({ limit: '200mb', extended: false }));
app.use(cookieParser());


app.use(session({
cookie: { maxAge: 4 * 60 * 60 * 1000 }, //4h
secret: 'mmt2montimage', //hash code to generate cookie
resave: true,
saveUninitialized: true,
//save cookie to mongodb
store: new MongoStore({
url: dbadmin.connectString,
mongoOptions: {
//useNewUrlParser: true, // Determines whether or not to use the new url parser
autoReconnect: true, // Reconnect on error.
reconnectTries: 3000, // Server attempt to reconnect #times
reconnectInterval: 5000, // Server will wait # milliseconds between retries.
bufferMaxEntries: 0, //Sets a cap on how many operations the driver will buffer up before giving up on getting a working connectio
},
touchAfter: 60, //lazy session update, time period in seconds
collection: "_expressjs_session",
ttl: 12 * 60 * 60 // = 12 hours
})
}));


//active checking for MUSA
//TODO to remove in final product
if (config.isSLA) {
Expand Down
1 change: 0 additions & 1 deletion www/bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ function build(built_type) {
fs.writeFileSync( path.join( DEB_PATH, "DEBIAN", "control"),
"Package: mmt-operator" +
"\nVersion: " + VERSION.VERSION_NUMBER +
"\nDepends: nodejs (>= 8.9.1)" +
"\nSection: base" +
"\nPriority: standard" +
"\nArchitecture: all" +
Expand Down
20 changes: 14 additions & 6 deletions www/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
{
"database_server": {
"host": "localhost",
"port": 27017
"port": 27017,
"connect_options": {}
},
"redis_input": {
"host": "localhost",
"port": 6379
"port": 6379,
"channel": "report"
},
"kafka_input": {
"host": "192.168.0.195",
"port": 2181,
"ssl.ca.location": "data/kafka-ca.cert",
"topic": "mi-reports",
"_ssl.ca.location": "data/kafka-ca.cert",
"topic": "report",
"client_name": "mmt-operator-kafka-client"
},
"mqtt_input": {
"broker_url": "mqtt://127.0.0.1",
"topic": "report",
"connect_options": {}
},
"file_input": {
"data_folder": [
"/opt/mmt/probe/result/report/online/",
Expand Down Expand Up @@ -100,6 +107,7 @@
"security",
"behavior",
"enodeb",
"gnodeb",
"ndn",
"video",
"sla",
Expand Down Expand Up @@ -132,8 +140,8 @@
"host": "localhost",
"port": 8088
},
"data_format": "POST /test.php HTTP/1.1\r\nHost: localhost\r\nContent-Type: application/json\r\nConnection: Keep-Alive\r\nContent-Length: {REPORT-LEN}\r\n\r\n{REPORT}",
"data_processing": "if(cache.host == undefined){ const exec=require('child_process').execSync; cache.host=exec('kubectl get pods -A -l thalesOrchestrationId -o jsonpath=\"{..kubernetes\\.io/hostname}\"'), cache.label=exec('kubectl get pods -A -l thalesOrchestrationId -o jsonpath=\"{..thalesOrchestrationId}\"') }; m={alert:m, metadata:{hostname: cache.host, label: cache.label}}; console.log(JSON.stringify(m)); return m;",
"_data_format": "POST /test.php HTTP/1.1\r\nHost: localhost\r\nContent-Type: application/json\r\nConnection: Keep-Alive\r\nContent-Length: {REPORT-LEN}\r\n\r\n{REPORT}",
"_data_processing": "if(cache.host == undefined){ const exec=require('child_process').execSync; cache.host=exec('kubectl get pods -A -l thalesOrchestrationId -o jsonpath=\"{..kubernetes\\.io/hostname}\"'), cache.label=exec('kubectl get pods -A -l thalesOrchestrationId -o jsonpath=\"{..thalesOrchestrationId}\"') }; m={alert:m, metadata:{hostname: cache.host, label: cache.label}}; console.log(JSON.stringify(m)); return m;",
"keep_alive": true
},
"_data_processing": "m[1]='probe-A'; return m;"
Expand Down
4 changes: 1 addition & 3 deletions www/libs/DataDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ var MongoConnector = function () {
self.onReadyCallback.push( cb );
}

var no_1_packet_reports = 0;

MongoClient.connect( config.databaseName, function (err, db) {
if (err){
console.error("Cannot connect to Database " + connectString );
console.error("Cannot connect to Database " );
console.logStdout("Cannot connect to Database");
process.exit( 1 );
}
Expand Down
14 changes: 9 additions & 5 deletions www/libs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ if( val !== undefined ){
}
else{
//ensure that mmt-operator is running on a good nodejs version
if( isMainProcess && (process.release.lts === undefined || process.release.lts !== 'Dubnium' ))
console.warn("[WARN] MMT-Operator works well on Dubnium release of NodeJS. It may not work on this version "+ process.version +".");
if( isMainProcess && (process.release.lts === undefined || process.release.lts !== 'Jod' ))
console.warn("[WARN] MMT-Operator works well on Jod release of NodeJS. It may not work on this version "+ process.version +".");

// allow to change config.json
var configPath = path.resolve( path.join( __dirname, "..", "config.json" ));
Expand Down Expand Up @@ -100,15 +100,19 @@ else{

config.rootDirectory = path.join( __dirname, ".." );

if( [ constant.REDIS_STR,
const support_modes = [ constant.REDIS_STR,
constant.KAFKA_STR,
constant.FILE_STR,
constant.SOCKET_STR,
constant.MQTT_STR,
constant.NONE_STR
].indexOf( config.input_mode ) === -1 )
];

if( support_modes.indexOf( config.input_mode ) === -1 )
{

console.warn("[ERROR] Unknown input_mode=" + config.input_mode);
console.warn("[ERROR] Unknown input mode " + config.input_mode);
console.warn("[INFO] Supported mode: " + support_modes);
process.exit();
}

Expand Down
1 change: 1 addition & 0 deletions www/libs/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const constant = {
FILE_STR : "file",
KAFKA_STR : "kafka",
SOCKET_STR: "socket",
MQTT_STR : "mqtt",
NONE_STR : "none",

//musa sla
Expand Down
Loading
Loading