Explorar el Código

Added options 'Autodiscovery' in OLT form.

Maximiliano Schvindt hace 6 años
padre
commit
b6b3680ade

+ 14 - 0
src/FTTHBundle/Admin/OLTAdmin.php

@@ -14,6 +14,13 @@ use WorkflowBundle\Admin\WorkflowBaseAdmin;
 
 class OLTAdmin extends WorkflowBaseAdmin
 {
+
+    public function configure()
+    {
+        $this->setTemplate('create', 'FTTHBundle:OLT:form.html.twig');
+        $this->setTemplate('edit', 'FTTHBundle:OLT:form.html.twig');
+    }
+
     /**
      * @param DatagridMapper $datagridMapper
      */
@@ -93,6 +100,13 @@ class OLTAdmin extends WorkflowBaseAdmin
                         //->add('enable')
                     ->end()
                 ->end()
+                ->tab('autodiscovery')
+                    ->with('olt_discovery_configuration')
+                        ->add('timeDiscovery', 'integer', array('attr' => array('min' => 0), 'help' => 'Set 0 to disable autodiscovery or set a x number to scan each x minutes the ONUs connected but without configuration'))
+                        ->add('clientId')
+                        ->add('discoveryProfile', null, array('help' => 'Profile to set the ONUs by autodiscovery'))
+                    ->end()
+                ->end()
                 ->tab('stats')
                     ->with('olt_execute_time')
                         ->add('executeSnmp')

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

@@ -185,6 +185,27 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     protected $backups;
 
+    /**
+     * @ORM\Column(type="integer", options={"unsigned":true, "default":0})
+     */
+    protected $timeDiscovery = 0;
+
+    /**
+     * @ORM\ManyToOne(targetEntity="Profile", fetch="EXTRA_LAZY")
+     * @ORM\JoinColumn(name="discovery_profile_id", referencedColumnName="id", onDelete="SET NULL")
+     *
+     * @JMS\MaxDepth(1)
+     */
+    protected $discoveryProfile;
+    
+    /**
+     * @var int
+     *
+     * @ORM\Column(type="integer", nullable=true)
+     *
+     */
+    private $clientId;
+
     /**
      * @return string
      */
@@ -735,5 +756,59 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         return null;
     }
 
+    /**
+     * @return int
+     */
+    public function getTimeDiscovery()
+    {
+        return $this->timeDiscovery;
+    }
+
+    /**
+     * @param int $timeDiscovery
+     */
+    public function setTimeDiscovery($timeDiscovery)
+    {
+        $this->timeDiscovery = $timeDiscovery;
+    }
+
+    /**
+     * Get clientId
+     * @return int
+     */
+    public function getClientId()
+    {
+        return $this->clientId;
+    }
+
+    /**
+     * @param integer $clientId
+     * @return OLT
+     */
+    public function setClientId($clientId)
+    {
+        $this->clientId = $clientId;
+
+        return $this;
+    }
+
+    /**
+     * @return Profile
+     */
+    public function getDiscoveryProfile()
+    {
+        return $this->discoveryProfile;
+    }
+
+    /**
+     * @param Profile $discoveryProfile
+     * @return $this
+     */
+    public function setDiscoveryProfile($discoveryProfile)
+    {
+        $this->discoveryProfile = $discoveryProfile;
+
+        return $this;
+    }
 
 }

+ 6 - 0
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml

@@ -10,6 +10,8 @@ NAP: NAP
 Profile: Perfil
 olt_execute_time: Tiempo(min) entre consultas a OLT
 ONUTemplate: Plantilla ONU
+olt_discovery_configuration: Configuración Autodiscovery
+autodiscovery: Autodiscovery
 
 filter:
     label_id: Id
@@ -170,6 +172,8 @@ form:
     label_enable_pass: Enable Password
     label_ssh_port: SSH Port
     label_ssh_connect: Conexión por SSH
+    label_time_discovery: Tiempo de escaneo
+    label_discovery_profile: Perfíl
 list:
     label_id: Id
     label_ip: Ip
@@ -371,3 +375,5 @@ error_onu_position: La posición dentro del puerto seleccionada ya se encuentra
 
 Stats: Estadísticas
 Show stats: Mostrar detalle
+Set 0 to disable autodiscovery or set a x number to scan each x minutes the ONUs connected but without configuration: Seleccione 0 para deshabilitar la función 'Autodiscovery' o seleccione un valor x para escanear cada x minutos las ONUs conectadas pero sin configurar. 
+Profile to set the ONUs by autodiscovery: Perfíl con el cual se configurarán las ONUs mediante Autodiscovery.

+ 19 - 0
src/FTTHBundle/Resources/views/OLT/form.html.twig

@@ -0,0 +1,19 @@
+{% extends 'SonataAdminBundle:CRUD:base_edit.html.twig' %}
+
+
+{% block formactions %}
+    {{ parent() }}
+
+    <script type="text/javascript">
+        
+        $(function () {
+
+            let clientWidget = "#sonata-ba-field-container-{{ admin.uniqid }}_clientId";
+            let profileWidget = "#sonata-ba-field-container-{{ admin.uniqid }}_discoveryProfile";
+            $(clientWidget).insertAfter(profileWidget);
+            
+        });
+
+    </script>
+
+{% endblock %}