Преглед на файлове

Fixed problems with NAS on stats module to use ZTE

Jean Sumara Leopoldo преди 4 години
родител
ревизия
fd4dbacd78
променени са 2 файла, в които са добавени 11 реда и са изтрити 10 реда
  1. 1 1
      src/App/Service/Stats/StatsService.php
  2. 10 9
      src/App/Service/Zte/ZteService.php

+ 1 - 1
src/App/Service/Stats/StatsService.php

@@ -247,7 +247,7 @@ class StatsService
         $nass = $statsRepository->getNAS($server);
         $nass = $statsRepository->getNAS($server);
 
 
         foreach($nass as $index => $nas) {
         foreach($nass as $index => $nas) {
-            $nasId = $nas['id'];
+            $nasId = $nas['device_id'];
 
 
             $d_s = "d_{$nasId}_s_{$server}";
             $d_s = "d_{$nasId}_s_{$server}";
             $key_nas_onu_bandwidth = "nas_bandwidth_onu_{$d_s}";
             $key_nas_onu_bandwidth = "nas_bandwidth_onu_{$d_s}";

+ 10 - 9
src/App/Service/Zte/ZteService.php

@@ -374,6 +374,7 @@ class ZteService
         $t1 = time();
         $t1 = time();
         $totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
         $totalConsOut = $totalConsIn = $totalIn = $totalOut = 0;
         $bandwidthCached = $this->redisHelper->getData($keyOltPonBandwidth, true);
         $bandwidthCached = $this->redisHelper->getData($keyOltPonBandwidth, true);
+        $newBandwidth = $bandwidthCached;
         foreach($dataCached as $index => $pon) {
         foreach($dataCached as $index => $pon) {
 
 
             if(isset($pon['nexo'])){
             if(isset($pon['nexo'])){
@@ -385,12 +386,12 @@ class ZteService
             (isset($inOctets[$realIndex]))? $in1 = $inOctets[$realIndex] : $in1 = 0;
             (isset($inOctets[$realIndex]))? $in1 = $inOctets[$realIndex] : $in1 = 0;
             (isset($outOctets[$realIndex]))? $out1 = $outOctets[$realIndex] : $out1 = 0;
             (isset($outOctets[$realIndex]))? $out1 = $outOctets[$realIndex] : $out1 = 0;
 
 
-            if(isset($bandwidthCached[$index])) {
-                $t0 = $bandwidthCached[$index]['t'];
-                $in0 = $bandwidthCached[$index]['inOct'];
-                $out0 = $bandwidthCached[$index]['outOct'];
-                $inAcc = $bandwidthCached[$index]['inAcc'];
-                $outAcc = $bandwidthCached[$index]['outAcc'];
+            if(isset($bandwidthCached[$realIndex])) {
+                $t0 = $bandwidthCached[$realIndex]['t'];
+                $in0 = $bandwidthCached[$realIndex]['inOct'];
+                $out0 = $bandwidthCached[$realIndex]['outOct'];
+                $inAcc = $bandwidthCached[$realIndex]['inAcc'];
+                $outAcc = $bandwidthCached[$realIndex]['outAcc'];
 
 
                 $inBandwidth = $outBandwidth = 0;
                 $inBandwidth = $outBandwidth = 0;
 
 
@@ -426,13 +427,13 @@ class ZteService
                 $totalConsOut += $outAcc;
                 $totalConsOut += $outAcc;
                 $totalConsIn += $inAcc;
                 $totalConsIn += $inAcc;
 
 
-                $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => $inAcc, 'outAcc' => $outAcc, 'inBand' => $inBandwidth, 'outBand' => $outBandwidth);
+                $newBandwidth[$realIndex] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => $inAcc, 'outAcc' => $outAcc, 'inBand' => $inBandwidth, 'outBand' => $outBandwidth);
             } else {
             } else {
-                $bandwidthCached[$index] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => 0, 'outAcc' => 0, 'inBand' => 0, 'outBand' => 0);
+                $newBandwidth[$realIndex] = array('t' => $t1, 'inOct' => $in1, 'outOct' => $out1, 'inAcc' => 0, 'outAcc' => 0, 'inBand' => 0, 'outBand' => 0);
             }
             }
         }
         }
 
 
-        $this->redisHelper->setData($keyOltPonBandwidth, $bandwidthCached, true);
+        $this->redisHelper->setData($keyOltPonBandwidth, $newBandwidth, true);
 
 
         $oltBandwidth = array();
         $oltBandwidth = array();
         $oltBandwidth["{$subId}_inbandwidth_olt"] = "{$totalIn}|g";
         $oltBandwidth["{$subId}_inbandwidth_olt"] = "{$totalIn}|g";