Browse Source

Merge branch 'ftth#96' into 'master'

Added force removal of ONU

See merge request interlink-sa/flowdat3/modules/ftth!203
Jean Sumara Leopoldo 4 years ago
parent
commit
b83c7ac3ab

File diff suppressed because it is too large
+ 1 - 1
app/DoctrineMigrations/src/action.yml


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

@@ -97,6 +97,9 @@ class OLTAdmin extends WorkflowBaseAdmin
                         ])
                         ->add('sshPort')
                         ->add('oltTimeout','integer', array('attr' => array('min' => 10, 'max' => 50)))
+                        ->add('forceDeleteONU', null, [
+                            'help' => 'form.help_force_delete',
+                        ])
                     ->end()
                 ->end()
                 ->tab('autodiscovery')
@@ -143,6 +146,7 @@ class OLTAdmin extends WorkflowBaseAdmin
                     ->add('sshConnect')
                     ->add('sshPort')
                     ->add('oltTimeout')
+                    ->add('forceDeleteONU')
                     ->add('enable')
                 ->end()
             ->end()

+ 4 - 2
src/FTTHBundle/Command/ONURecoverCommand.php

@@ -29,7 +29,8 @@ class ONURecoverCommand extends ContainerAwareCommand
             ->setHelp('Set the status of the execution of the script against the olt')
             ->addArgument('onuid', InputArgument::REQUIRED, 'Onu ID')
             ->addArgument('file', InputArgument::REQUIRED, 'File log')
-            ->addArgument('status', InputArgument::REQUIRED, 'Status 0 (OK), 1 (ERROR) other value (PENDING)');
+            ->addArgument('status', InputArgument::REQUIRED, 'Status 0 (OK), 1 (ERROR) other value (PENDING)')
+            ->addArgument('forceRemove', InputArgument::OPTIONAL, 'Force remove when the OLT still with error');
     }
 
     protected function execute(InputInterface $input, OutputInterface $output)
@@ -39,8 +40,9 @@ class ONURecoverCommand extends ContainerAwareCommand
             $onuId = $input->getArgument('onuid');
             $file = $input->getArgument('file');
             $status = $input->getArgument('status');
+            $forceRemove = $input->getArgument('forceRemove');
 
-            if($status == 1){
+            if($status == 1 && !!!$forceRemove){
                 $filters = [];
                 //disable filters to find the onu deleted
                 foreach ($em->getFilters()->getEnabledFilters() as $filterName => $filter) {

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

@@ -209,6 +209,11 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     private $oltTimeout;
 
+    /**
+     * @ORM\Column(type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT FALSE")
+     */
+    private $forceDeleteONU = false;
+
     /**
      * @return string
      */
@@ -785,4 +790,20 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         $this->oltTimeout = $oltTimeout;
     }
 
+    /**
+     * @return bool
+     */
+    public function isForceDeleteONU()
+    {
+        return $this->forceDeleteONU;
+    }
+
+    /**
+     * @param bool $forceDeleteONU
+     */
+    public function setForceDeleteONU($forceDeleteONU)
+    {
+        $this->forceDeleteONU = $forceDeleteONU;
+    }
+
 }

+ 4 - 1
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml

@@ -181,6 +181,8 @@ form:
     label_date: Fecha
     label_radius_auth: Autenticación en Radius
     label_olt_timeout: Tiempo de espera máximo de conexión (Valor máximo 50 segundos)
+    label_force_delete_o_n_u: Forzar eliminar
+    help_force_delete: Cuando la OLT no responde y la tarea falla, eliminará la ONU
 
 list:
     label_id: Id
@@ -333,6 +335,7 @@ show:
     label_log_o_l_t_directory: Directorio log OLT
     label_date: Fecha
     label_olt_timeout: Tiempo de espera máximo de conexión (Valor máximo 50 segundos)
+    label_force_delete_o_n_u: Forzar eliminar
 
 export:
     serialNumber: Serial Number
@@ -353,7 +356,7 @@ export:
     activationCode: Código de Activación
     created: Creada
     updated: Actualizada
-    
+
 helps:
     check_address: Verifique la dirección para el cálculo de distancias.
     onu_serial_number: Serial Number de la ONU conformado por 16 caracteres, si es vacío lo calculamos desde el Identificador.