Guillermo Espinoza 8 anni fa
parent
commit
7b44e8a7ef
3 ha cambiato i file con 30 aggiunte e 7 eliminazioni
  1. 2 2
      composer.lock
  2. 12 0
      src/FTTHBundle/Entity/OLT.php
  3. 16 5
      src/FTTHBundle/Entity/ONU.php

+ 2 - 2
composer.lock

@@ -1281,7 +1281,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@infra.flowdat.com:222/VendorSoftwareFlowdat3/DeviceBundle.git",
-                "reference": "fee905fe5323574e900e15b3dd954d513e468cad"
+                "reference": "bf1029b73d5370885cc3790c5ed708b3263848ca"
             },
             "type": "library",
             "autoload": {
@@ -1296,7 +1296,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2017-05-29 18:29:43"
+            "time": "2017-05-30 18:33:01"
         },
         {
             "name": "ik/extra-data-bundle",

+ 12 - 0
src/FTTHBundle/Entity/OLT.php

@@ -409,4 +409,16 @@ class OLT implements DeviceInterface
         return $workflow;
     }
 
+    /**
+     * @return array
+     */
+    public function getDeviceData()
+    {
+        return array(
+            'deviceType' => get_class($this),
+            'deviceId' => $this->id,
+            'ip' => $this->ip,
+        );
+    }
+
 }

+ 16 - 5
src/FTTHBundle/Entity/ONU.php

@@ -512,7 +512,7 @@ class ONU implements DeviceInterface
         $log = $rootDir . "/../var/logs/" . $env . ".log";
         $out = array();
         exec("tail -400 {$log} | grep 'ONU_id_{$this->id}'", $out);
-        
+
         return implode("\n", $out);
     }
 
@@ -592,7 +592,7 @@ class ONU implements DeviceInterface
 
         return $this;
     }
-    
+
     /**
      * Si la ONU no tiene NAP retorna 0
      * De lo contrario recorre y retorna la primer position
@@ -615,15 +615,26 @@ class ONU implements DeviceInterface
             asort($positions);
             $position_range = range(1, end($positions));
             $position_diff = array_diff($position_range, $positions);
-            
+
             if (!empty($position_diff)) {
                 $position = array_shift($position_diff);
             } else {
                 $position = $nap->getOnus()->count() + 1;
             }
         }
-            
-        return $position;    
+
+        return $position;
+    }
+
+    /**
+     * @return array
+     */
+    public function getDeviceData()
+    {
+        return array(
+            'deviceType' => get_class($this),
+            'deviceId' => $this->id,
+        );
     }
 
 }