Commit b8c8cf7faa3ca9403b07ae68a85f8458d11ecd7b

Authored by adumas
1 parent 4f462759

SIP metric enabled by default if allSIPMetrics is enable

src/main/resources/web/js/models/voipmodel.js
... ... @@ -68,6 +68,22 @@ window.allStatsCollection = Backbone.Collection.extend({
68 68 sscm = new switchStatsCollectionModel();
69 69 sscm.id=u.dpid;
70 70 self.add(sscm);
  71 +
  72 + //if allSipMetrics == true
  73 + //we activate the sip metric on the new switch
  74 + console.log("allSipMetrics: "+allSipMetrics);
  75 + if(allSipMetrics==true){
  76 + console.log("trying to activate sip on "+u.dpid);
  77 + $.ajax({
  78 + url:hackBase + '/wm/iptv/switch/'+u.dpid+'/enable/type/6/opt/0.0.0.0/0.0.0.0/20000/1234/json',
  79 + dataType:"json",
  80 + success:function (data) {
  81 + allStats.get(u.dpid).sipMetric=true;
  82 + console.log("Metric 6 started on "+u.dpid);
  83 +
  84 + },
  85 + });
  86 + }
71 87 //console.log("\tSwitch undefined: "+sscm.id);
72 88 }
73 89 else {sscm=self.get(u.dpid);
... ... @@ -365,7 +381,7 @@ window.VoIPSwitchCollection = Backbone.Collection.extend({
365 381 },
366 382  
367 383 fetch:function () {
368   - var self = this;
  384 + /*var self = this;
369 385 //console.log("fetching switch list")
370 386 $.ajax({
371 387 url:hackBase + "/wm/core/controller/switches/json",
... ... @@ -384,6 +400,27 @@ window.VoIPSwitchCollection = Backbone.Collection.extend({
384 400 sscm = new switchStatsCollectionModel(); //We add the switch to the stats
385 401 sscm.id=sw['dpid']; //If we don't, we wouldn't be able to start metrics
386 402 allStats.add(sscm);
  403 +
  404 + //if allSipMetrics == true
  405 + //we activate the sip metric on the new switch
  406 + console.log("allSipMetrics: "+allSipMetrics);
  407 + if(allSipMetrics==true){
  408 + console.log("trying to activate sip on "+sw['dpid']);
  409 + $.ajax({
  410 + url:hackBase + '/wm/iptv/switch/'+sw['dpid']+'/enable/type/6/opt/0.0.0.0/0.0.0.0/20000/1234/json',
  411 + dataType:"json",
  412 + success:function (data) {
  413 + allStats.get(sw['dpid']).sipMetric=true;
  414 + console.log("Metric 6 started on "+sw['dpid']);
  415 +
  416 + },
  417 + });
  418 + }
  419 +
  420 +
  421 +
  422 +
  423 +
387 424 });
388 425  
389 426 // old_ids now holds switches that no longer exist; remove them
... ... @@ -397,6 +434,6 @@ window.VoIPSwitchCollection = Backbone.Collection.extend({
397 434  
398 435 });
399 436 self.trigger('add');
400   - },
  437 + */},
401 438  
402 439 });
... ...