File: view\BgpDataChecksView.js
- /*
- * BGPlay.js #9660
- * A web-based service for the visualization of the Internet routing
- *
- * Copyright (c) 2012 Roma Tre University and RIPE NCC
- *
- * See the file LICENSE.txt for copying permission.
- */
-
- /**
- * This is a module specific for BGP.
- * The objective of this module is to provide a set of auto-start function for checking BGP data.
- * @class BgpDataChecksView
- * @module modules
- */
- var BgpDataChecksView=Backbone.View.extend({
-
- /**
- * The initialization method of this object.
- * @method initialize
- * @param {Map} A map of parameters
- */
- initialize:function(){
- this.environment=this.options.environment;
- this.bgplay=this.environment.bgplay;
- this.fileRoot=this.environment.fileRoot;
- this.eventAggregator=this.environment.eventAggregator;
-
- this.eventAggregator.trigger("moduleLoading", true);
-
- this.eventAggregator.trigger("autoStartFunction",
- {func:
- function(){
- var nodes, realPrefixes, prefixes, n, length, notFoundPrefixes, targets, environment;
- environment = this.environment;
- prefixes = stringToArray(environment.params.targets);
- realPrefixes = environment.bgplay.getPrefixes();
- notFoundPrefixes = [];
-
- environment.bgplay.get("targets").each(function(target){
- if (target.get("nodes").length>1){
- environment.cssAlert.alert("The prefix "+target.get("id")+" is announced by more than one AS: "+target.get("nodes").toString(),"warning",3000);
- }
- });
-
- for (n=0, length=prefixes.length; n<length; n++){
- if (!realPrefixes.contains(prefixes[n])){
- notFoundPrefixes.push(prefixes[n]);
- }
- }
-
- if (notFoundPrefixes.length == 1){
- environment.cssAlert.alert("No data was found for prefix " + notFoundPrefixes[0] + ".","info",1000);
- }else if (notFoundPrefixes.length > 1){
- environment.cssAlert.alert("No data was found for prefixes " + notFoundPrefixes.join(", ") + ".","info",1000);
- }
- }
- , context:this});
-
- this.eventAggregator.trigger("moduleLoading", false);
- }
- });
-
-