API Docs for:
Show:

File: view\BgpDataChecksView.js

  1. /*
  2. * BGPlay.js #9660
  3. * A web-based service for the visualization of the Internet routing
  4. *
  5. * Copyright (c) 2012 Roma Tre University and RIPE NCC
  6. *
  7. * See the file LICENSE.txt for copying permission.
  8. */
  9.  
  10. /**
  11. * This is a module specific for BGP.
  12. * The objective of this module is to provide a set of auto-start function for checking BGP data.
  13. * @class BgpDataChecksView
  14. * @module modules
  15. */
  16. var BgpDataChecksView=Backbone.View.extend({
  17.  
  18. /**
  19. * The initialization method of this object.
  20. * @method initialize
  21. * @param {Map} A map of parameters
  22. */
  23. initialize:function(){
  24. this.environment=this.options.environment;
  25. this.bgplay=this.environment.bgplay;
  26. this.fileRoot=this.environment.fileRoot;
  27. this.eventAggregator=this.environment.eventAggregator;
  28.  
  29. this.eventAggregator.trigger("moduleLoading", true);
  30.  
  31. this.eventAggregator.trigger("autoStartFunction",
  32. {func:
  33. function(){
  34. var nodes, realPrefixes, prefixes, n, length, notFoundPrefixes, targets, environment;
  35. environment = this.environment;
  36. prefixes = stringToArray(environment.params.targets);
  37. realPrefixes = environment.bgplay.getPrefixes();
  38. notFoundPrefixes = [];
  39.  
  40. environment.bgplay.get("targets").each(function(target){
  41. if (target.get("nodes").length>1){
  42. environment.cssAlert.alert("The prefix "+target.get("id")+" is announced by more than one AS: "+target.get("nodes").toString(),"warning",3000);
  43. }
  44. });
  45.  
  46. for (n=0, length=prefixes.length; n<length; n++){
  47. if (!realPrefixes.contains(prefixes[n])){
  48. notFoundPrefixes.push(prefixes[n]);
  49. }
  50. }
  51.  
  52. if (notFoundPrefixes.length == 1){
  53. environment.cssAlert.alert("No data was found for prefix " + notFoundPrefixes[0] + ".","info",1000);
  54. }else if (notFoundPrefixes.length > 1){
  55. environment.cssAlert.alert("No data was found for prefixes " + notFoundPrefixes.join(", ") + ".","info",1000);
  56. }
  57. }
  58. , context:this});
  59.  
  60. this.eventAggregator.trigger("moduleLoading", false);
  61. }
  62. });
  63.