Skip to content

Commit af70628

Browse files
committed
Added restricted overlay topology route and API.
1 parent 02001b5 commit af70628

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Visibility-Visualization/pvcT-Visualization/MultiView-DataAPI.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,18 @@ ResourceProvider.prototype.getOpsSDNStatList = function(boxID, callback)
200200
});
201201
};
202202

203+
//Get Active Monitoring data From MongoDB for TCP throughput
204+
ResourceProvider.prototype.getAMDataTCPperDay = function(boxID, startDate, endDate, callback)
205+
{
206+
MongoClient.connect(mongourl, function(err, db)
207+
{
208+
console.log('Active Monitoring TCP data / day: ');
209+
var collection = db.collection("topolgoy-tcp-data-raw");
210+
collection.find({$and: [{srcBoxname: boxID}, {timestamp : {$gte : {"$date" : startDate}, $lte : {"$date" : endDate}}}]}).count().toArray(function(err, data){
211+
callback(null, data);
212+
db.close();
213+
});
214+
});
215+
};
203216
exports.ResourceProvider = ResourceProvider;
204217
//exports.UserProvider = UserProvider;

Visibility-Visualization/pvcT-Visualization/server.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ app.use(express.static(path.join(__dirname, '/public')))
4141
//Define Application Routes
4242
var resourceProvider = new ResourceProvider();
4343

44-
// Rout for TCP Throughput-based Topology View
44+
// Route for TCP Throughput-based Topology View
4545
app.get('/tcptopologyviewops', function(req, res){
4646
var boxList = null;
4747
//console.log('Topology Visualization Rendering.');
@@ -566,6 +566,26 @@ app.get('/tenantvlanmapops', function(req, res){
566566
}
567567
});
568568

569+
// Route for TCP Throughput-based Data API
570+
app.get('/getamdatatcpperDay/', function(req, res){
571+
//Wait for 1 minute before requesting again
572+
req.connection.setTimeout(60*1000);
573+
574+
var boxID=req.originalUrl;
575+
var filterdate=boxID;
576+
577+
boxID=filterdate.substring(20, filterdate.indexOf("&"));
578+
filterdate=boxID.substring(boxID.indexOf("&")+1, boxID.length);
579+
console.log(boxID);
580+
console.log(filterdate);
581+
582+
resourceProvider.getAMDataTCPperDay(boxID, filterdate, function(error, data){
583+
if (err)
584+
res.send(err);
585+
res.json(data);
586+
})
587+
});
588+
569589
// Route for Login View
570590
app.get('/', function(req, res){
571591
res.render('login.jade', {title: 'MultiView Web Application Login'})

0 commit comments

Comments
 (0)