瀏覽代碼

Merge branch 'luciano' of bitbucket.org:ikflowdat/ftth into luciano

Luciano Andrade 8 年之前
父節點
當前提交
c5c9b56c98

+ 5 - 1
app/config/url_webservice.yml.dist

@@ -1,10 +1,14 @@
 parameters:
 parameters:
-    url_base: 'http://200.50.168.111/base/app_dev.php' # url app Base
+    url_base: 'http://127.0.0.1/base/app_dev.php' # url app Base
+    url_mapas: 'http://127.0.0.1/mapas/app_dev.php' # url app Mapas
+    url_stats: 'http://127.0.0.1/stats/app_dev.php' # url app Stats
 
 
     client: '%url_base%/api/clients.json'
     client: '%url_base%/api/clients.json'
 
 
     sidebar_menu: # urls para el sidebar menu 
     sidebar_menu: # urls para el sidebar menu 
         Base: '%url_base%'
         Base: '%url_base%'
+        Mapas: '%url_mapas%'
+        Stats: '%url_stats%'
 
 
     # Url base create client
     # Url base create client
     remote_client_create_url: '%url_base%/admin/client/client/create'
     remote_client_create_url: '%url_base%/admin/client/client/create'

+ 8 - 1
app/config/url_webservice.yml.docker

@@ -1,6 +1,13 @@
 parameters:
 parameters:
     url_base: 'http://%env(HOST_BASE)%'
     url_base: 'http://%env(HOST_BASE)%'
+    url_mapas: 'http://%env(HOST_MAPAS)%' # url app Mapas
+    url_stats: 'http://%env(HOST_STATS)%' # url app Stats
+
     client: '%url_base%/api/clients.json'
     client: '%url_base%/api/clients.json'
+
     remote_client_create_url: '%url_base%/admin/client/client/create'
     remote_client_create_url: '%url_base%/admin/client/client/create'
+
     sidebar_menu:
     sidebar_menu:
-      Base: '%url_base%/'
+        Base: '%url_base%/'
+        Mapas: '%url_mapas%'
+        Stats: '%url_stats%'

+ 2 - 2
composer.lock

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

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

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

+ 21 - 6
src/FTTHBundle/Entity/ONU.php

@@ -9,6 +9,8 @@ use Gedmo\Mapping\Annotation as Gedmo;
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 use Symfony\Component\Validator\Constraints as Assert;
 use Symfony\Component\Validator\Constraints as Assert;
 use Symfony\Component\Workflow\Exception\ExceptionInterface;
 use Symfony\Component\Workflow\Exception\ExceptionInterface;
+use DeviceBundle\Validator\Constraints as ValidatorAssert;
+use DeviceBundle\Interfaces\DeviceInterface;
 
 
 /**
 /**
  * ONU
  * ONU
@@ -17,8 +19,10 @@ use Symfony\Component\Workflow\Exception\ExceptionInterface;
  * @ORM\HasLifecycleCallbacks
  * @ORM\HasLifecycleCallbacks
  * @UniqueEntity(fields={"ponSerialNumber", "tenancyId"}, message="errors.duplicate_key")
  * @UniqueEntity(fields={"ponSerialNumber", "tenancyId"}, message="errors.duplicate_key")
  * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"pon_serial_number", "tenancy_id"})})
  * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"pon_serial_number", "tenancy_id"})})
+ * 
+ * @ValidatorAssert\Device
  */
  */
-class ONU
+class ONU implements DeviceInterface
 {
 {
 
 
     use ExtraDataTrait;
     use ExtraDataTrait;
@@ -508,7 +512,7 @@ class ONU
         $log = $rootDir . "/../var/logs/" . $env . ".log";
         $log = $rootDir . "/../var/logs/" . $env . ".log";
         $out = array();
         $out = array();
         exec("tail -400 {$log} | grep 'ONU_id_{$this->id}'", $out);
         exec("tail -400 {$log} | grep 'ONU_id_{$this->id}'", $out);
-        
+
         return implode("\n", $out);
         return implode("\n", $out);
     }
     }
 
 
@@ -588,7 +592,7 @@ class ONU
 
 
         return $this;
         return $this;
     }
     }
-    
+
     /**
     /**
      * Si la ONU no tiene NAP retorna 0
      * Si la ONU no tiene NAP retorna 0
      * De lo contrario recorre y retorna la primer position
      * De lo contrario recorre y retorna la primer position
@@ -611,15 +615,26 @@ class ONU
             asort($positions);
             asort($positions);
             $position_range = range(1, end($positions));
             $position_range = range(1, end($positions));
             $position_diff = array_diff($position_range, $positions);
             $position_diff = array_diff($position_range, $positions);
-            
+
             if (!empty($position_diff)) {
             if (!empty($position_diff)) {
                 $position = array_shift($position_diff);
                 $position = array_shift($position_diff);
             } else {
             } else {
                 $position = $nap->getOnus()->count() + 1;
                 $position = $nap->getOnus()->count() + 1;
             }
             }
         }
         }
-            
-        return $position;    
+
+        return $position;
+    }
+
+    /**
+     * @return array
+     */
+    public function getDeviceData()
+    {
+        return array(
+            'deviceType' => get_class($this),
+            'deviceId' => $this->id,
+        );
     }
     }
 
 
 }
 }