Explorar el Código

Merge branch '1' into 'master'

1

See merge request interlink-sa/flowdat3/modules/ftth!120
Gabriel Gosparo hace 6 años
padre
commit
f718145cb3

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 6 - 6
app/DoctrineMigrations/src/action.yml


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
app/DoctrineMigrations/src/template.yml


+ 1 - 1
composer.json

@@ -205,7 +205,7 @@
         "doctrine-migrations-down": "php bin/console doctrine:migrations:migrate --no-interaction first -vvv",
         "doctrine-migrations": "php bin/console doctrine:migrations:migrate --no-interaction -vvv",
         "doctrine-update": "php bin/console doctrine:schema:update --force",
-        "auto-increment": "php bin/console baseadmin:autoincrement",
+        "auto-increment": "php bin/console baseadmin:autoincrement --tables=\"action,oltmodel,onumodel,profile,templates,vlan_id,workflow\"",
         "workflow-default": "php bin/console workflow:default --class=FTTHBundle\\\\Entity\\\\ONU --all",
         "post-install-cmd": [
             "@workflows-commands",

+ 30 - 30
composer.lock

@@ -1145,7 +1145,7 @@
             "version": "v2.5.2",
             "source": {
                 "type": "git",
-                "url": "https://github.com/doctrine/doctrine2.git",
+                "url": "https://github.com/doctrine/orm.git",
                 "reference": "464b5fdbfbbeb4a65465ac173c4c5d90960f41ff"
             },
             "dist": {
@@ -1900,7 +1900,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuditBundle.git",
-                "reference": "40eba41d6b036daf98dc98c0bfe44e79f1253378"
+                "reference": "34dece40daad7031e332f02314b681bb9ee1cd14"
             },
             "require": {
                 "simplethings/entity-audit-bundle": "^1.0"
@@ -1916,7 +1916,7 @@
                 "audit",
                 "bundle"
             ],
-            "time": "2018-11-16T17:52:06+00:00"
+            "time": "2019-01-31T13:32:40+00:00"
         },
         {
             "name": "ik/auth-bundle",
@@ -1924,7 +1924,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuthBundle.git",
-                "reference": "f5d0128e028ec87a37de9e7e45e2c3f9ff1f5927"
+                "reference": "c8e77dce32b92c08d75e12c537ead77bf976cd84"
             },
             "type": "library",
             "autoload": {
@@ -1939,7 +1939,7 @@
                 "auth",
                 "bundle"
             ],
-            "time": "2018-10-01T14:16:36+00:00"
+            "time": "2019-01-31T13:33:33+00:00"
         },
         {
             "name": "ik/base-admin-bundle",
@@ -1947,7 +1947,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseAdmin.git",
-                "reference": "767b0aad4bd83c5677f69a8bb860793942c90f10"
+                "reference": "afc4e099fd2f4087769b0071478063937a8a2d26"
             },
             "type": "library",
             "autoload": {
@@ -1962,7 +1962,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2019-01-09T17:58:40+00:00"
+            "time": "2019-02-06T12:51:24+00:00"
         },
         {
             "name": "ik/check-sintax-bundle",
@@ -1970,7 +1970,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/CheckSintaxBundle.git",
-                "reference": "8988991d0b7404e99f860a895af81acc5ef660c2"
+                "reference": "df53b6339c7ae09fbdc350540f15e334be42b000"
             },
             "type": "library",
             "autoload": {
@@ -1985,7 +1985,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2018-12-26T14:28:43+00:00"
+            "time": "2019-01-31T13:23:39+00:00"
         },
         {
             "name": "ik/device-bundle",
@@ -1993,7 +1993,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/DeviceBundle.git",
-                "reference": "2ab9cef5cd82805c9d9c752130213eac485412d1"
+                "reference": "5a72c912f13ba8728fda6792d867e61a889e6c06"
             },
             "type": "library",
             "autoload": {
@@ -2008,7 +2008,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2018-11-16T18:28:19+00:00"
+            "time": "2019-01-31T13:35:09+00:00"
         },
         {
             "name": "ik/extra-data-bundle",
@@ -2016,7 +2016,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
-                "reference": "c85d52d5e306faaa44f9d45353365d00f10adf2d"
+                "reference": "77c2c8228bb9dfd13add559909fd809508b61388"
             },
             "type": "library",
             "autoload": {
@@ -2031,7 +2031,7 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2018-12-14T11:31:02+00:00"
+            "time": "2019-01-31T13:44:14+00:00"
         },
         {
             "name": "ik/leaflet-bundle",
@@ -2039,7 +2039,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/LeafletBundle.git",
-                "reference": "5fa33e67613667d93dbaa9e878b38420fe3518a5"
+                "reference": "bcf009e03ace356adfd92a7a89f814aa2e96fb6c"
             },
             "require": {
                 "ext-curl": "*",
@@ -2052,7 +2052,7 @@
                 }
             },
             "description": "The Flowdat3 Leaflet Resource",
-            "time": "2018-12-05T12:04:14+00:00"
+            "time": "2019-01-31T13:34:17+00:00"
         },
         {
             "name": "ik/map-bundle",
@@ -2060,7 +2060,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/MapBundle.git",
-                "reference": "b5fcd5fd0aaa0c310a70ef394d66db9af04c4341"
+                "reference": "94454d6f6943fb07040dadae8edddd3d13510b5f"
             },
             "type": "library",
             "autoload": {
@@ -2075,7 +2075,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2018-11-16T18:15:07+00:00"
+            "time": "2019-01-31T13:29:47+00:00"
         },
         {
             "name": "ik/migrations-bundle",
@@ -2106,7 +2106,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseOAuthClientBundle.git",
-                "reference": "1c60fd91f1bb0fe5125da70908670629d4d341e6"
+                "reference": "a057890183bddcb6f4c431c3b7c9afe6839d8d78"
             },
             "require": {
                 "ext-curl": "*",
@@ -2125,7 +2125,7 @@
                 "bundle",
                 "oauth"
             ],
-            "time": "2018-12-04T13:12:24+00:00"
+            "time": "2019-01-31T13:37:25+00:00"
         },
         {
             "name": "ik/owner-voter-bundle",
@@ -2133,7 +2133,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/OwnerVoter.git",
-                "reference": "9171fd2335cc3d164a97a27f0531e436ef924701"
+                "reference": "ece1ca1df9ca18789ccdcae19a381ee5d9142f6c"
             },
             "type": "library",
             "autoload": {
@@ -2148,7 +2148,7 @@
                 "bundle",
                 "owner-voter"
             ],
-            "time": "2018-02-19T13:34:58+00:00"
+            "time": "2019-01-31T13:18:32+00:00"
         },
         {
             "name": "ik/template-bundle",
@@ -2156,7 +2156,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/TemplateBundle.git",
-                "reference": "97a0f5c1d73edf039cbf046ba7b2ee8e7ef14575"
+                "reference": "2c02107d2ec87aad3fca45adc94f6e69f3aa0119"
             },
             "require": {
                 "ik/base-admin-bundle": "*"
@@ -2174,7 +2174,7 @@
                 "bundle",
                 "template"
             ],
-            "time": "2019-01-04T12:24:24+00:00"
+            "time": "2019-01-31T13:32:01+00:00"
         },
         {
             "name": "ik/tr069-bundle",
@@ -2182,7 +2182,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/TR069Bundle.git",
-                "reference": "1fcb1a4a4b59eb9940d6ba5e2531337ee48cc559"
+                "reference": "cfc9fd8148a071c3e4ea4a590f03d8442a2f5752"
             },
             "require": {
                 "ext-curl": "*"
@@ -2194,7 +2194,7 @@
                 }
             },
             "description": "The Flowdat3 TR069",
-            "time": "2018-03-22T13:10:11+00:00"
+            "time": "2019-01-31T11:42:17+00:00"
         },
         {
             "name": "ik/webservice-bundle",
@@ -2202,7 +2202,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/Webservice.git",
-                "reference": "abe9d7f342d65f89c1e69ddfa2639ddae00eb013"
+                "reference": "68f356b67da08b94cdb7613ad58c5525c88ff950"
             },
             "require": {
                 "ext-curl": "*",
@@ -2215,7 +2215,7 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2019-01-09T18:31:03+00:00"
+            "time": "2019-01-31T13:36:09+00:00"
         },
         {
             "name": "ik/workflow-bundle",
@@ -2223,7 +2223,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
-                "reference": "0359ad6481e2ae8bcff960fabcf17a829093d4c5"
+                "reference": "29bc76615564c555cc3c98cf4c0e27d70b7bfa08"
             },
             "require": {
                 "php-amqplib/rabbitmq-bundle": "^1.12"
@@ -2253,7 +2253,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2019-01-09T18:48:20+00:00"
+            "time": "2019-02-06T17:56:50+00:00"
         },
         {
             "name": "incenteev/composer-parameter-handler",
@@ -6763,7 +6763,7 @@
         "voryx/restgeneratorbundle": 20
     },
     "prefer-stable": false,
-    "prefer-lowest": true,
+    "prefer-lowest": false,
     "platform": {
         "php": ">=5.5.9"
     },

+ 15 - 19
src/FTTHBundle/Admin/ONUAdmin.php

@@ -56,7 +56,10 @@ class ONUAdmin extends WorkflowBaseAdmin
             ->add('profile')
             ->add('nap')
             ->add('model')
-            ->add('olt');
+            ->add('olt')
+            ->add('logOLT.status')
+            ->add('logOLT.date')
+        ;
     }
 
     /**
@@ -93,13 +96,17 @@ class ONUAdmin extends WorkflowBaseAdmin
             ))
             ->add('catv')
             ->add('created')
+            ->add('logOLT.status', 'string', array(
+                'template' => 'FTTHBundle:Type:list_status_field_type.html.twig'))
+            ->add('logOLT.date')
             ->add('_action', 'with-workflow-action', array(
                 'actions' => array(
                     'show' => array(),
                     'edit' => array(),
                     'delete' => array(),
                     'state' => array('template' => 'WorkflowBundle:Workflow:show_transitions.html.twig')
-                )));
+                )))
+        ;
     }
 
     /**
@@ -484,6 +491,12 @@ class ONUAdmin extends WorkflowBaseAdmin
             ->end()
             ->tab('Log')
                 ->with('Log')
+                    ->add('logOLT.status', 'string', array(
+                        'label' => 'Status',
+                        'template' => 'FTTHBundle:Type:show_status_field_type.html.twig'
+                    ))
+                    ->add('logOLT.date')
+                    ->add('logOLT.directory')
                     ->add('log', 'string', array('template' => 'FTTHBundle:ONU:show_log.html.twig'))
                     ->add('deviceLog', 'string', array(
                         'template' => 'DeviceBundle::show_device_log.html.twig',
@@ -597,23 +610,6 @@ class ONUAdmin extends WorkflowBaseAdmin
         return $onuShowUrl;
     }
 
-    /**
-     * @param string $action
-     * @param Object $object
-     *
-     * @return array
-     */
-    public function configureActionButtons($action, $object = null)
-    {
-        $actions = parent::configureActionButtons($action, $object);
-
-        if($action == "list") {
-            $actions['import_onu'] = array('template' => 'FTTHBundle:ONU:import_button.html.twig');
-        }
-
-        return $actions;
-    }
-
     public function configure()
     {
         $this->setTemplate('create', 'FTTHBundle:ONU:form.html.twig');

+ 56 - 0
src/FTTHBundle/Command/ONUStatusOLTCommand.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace FTTHBundle\Command;
+
+use FTTHBundle\Entity\ONU;
+use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class ONUStatusOLTCommand
+ * Update the status of olt comunication
+ * @package FTTHBundle\Command
+ */
+class ONUStatusOLTCommand extends ContainerAwareCommand
+{
+    protected function configure()
+    {
+        $this
+            ->setName('ik:onu:statusolt')
+            ->setDescription('Set the status of the execution of the script against the olt')
+            ->setHelp('Set the status of the execution of the script against the olt')
+            ->addArgument('onuid', InputArgument::REQUIRED, 'Pon serial number')
+            ->addArgument('file', InputArgument::REQUIRED, 'File log')
+            ->addArgument('status', InputArgument::REQUIRED, 'Status 0 (OK), 1 (ERROR) other value (PENDING)');
+    }
+
+    protected function execute(InputInterface $input, OutputInterface $output)
+    {
+        try {
+            $em = $this->getContainer()->get('doctrine')->getManager();
+            $onuid = $input->getArgument('onuid');
+            $file = $input->getArgument('file');
+            $status = $input->getArgument('status');
+            $onu = $em->getRepository(ONU::class)->findById($onuid);
+            if ($onu && count($onu) > 0) {
+                $onu = $onu[0];
+                if ($status == 1) {
+                    $status = "ERROR";
+                } elseif ($status == 0) {
+                    $status = "OK";
+                } else {
+                    $status = "PENDING";
+                }
+                $onu->getLogOLT()->setStatus($status);
+                $onu->getLogOLT()->setDirectory($file);
+                $onu->getLogOLT()->setDate(new \DateTime());
+                $em->flush();
+            }
+        } catch (\Throwable $e) {
+            echo("\nERROR CODE: " . $e->getCode() . "\nERROR MESSAGE: " . $e->getMessage() . "\n");
+            echo("\nTRACE: \n" . $e->getTraceAsString() . "\n\n");
+        }
+    }
+}

+ 26 - 0
src/FTTHBundle/Entity/ONU.php

@@ -14,6 +14,8 @@ use MapBundle\Entity\Traits\LocationTrait;
 use WorkflowBundle\Entity\Interfaces\WorkflowInterface;
 use WorkflowBundle\Entity\Traits\WorkflowTrait;
 use Doctrine\ORM\Mapping as ORM;
+use Doctrine\ORM\Mapping\JoinColumn;
+use Doctrine\ORM\Mapping\OneToOne;
 use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity as SoftDeleteable;
 use Gedmo\Mapping\Annotation as Gedmo;
 use JMS\Serializer\Annotation as JMS;
@@ -266,6 +268,11 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     protected $activationCode;
 
+    /**
+     * @OneToOne(targetEntity="ONULogOLT", cascade={"persist"})
+     * @JoinColumn(name="id", referencedColumnName="id")
+     */
+    protected $logOLT;
 
     /**
      * Constructor
@@ -1041,12 +1048,31 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         }, $this->servicePorts->toArray()));
     }
 
+    /**
+     * @return mixed
+     */
+    public function getLogOLT()
+    {
+        return $this->logOLT;
+    }
+
+    /**
+     * @param mixed $logOLT
+     * @return $this
+     */
+    public function setLogOLT($logOLT)
+    {
+        $this->logOLT = $logOLT;
+        return $this;
+    }
+
     /**
      * @ORM\PrePersist()
      */
     public function prePersist()
     {
         $this->correctSerialNumber();
+        $this->setLogOLT(new  ONULogOLT());
     }
 
     /**

+ 131 - 0
src/FTTHBundle/Entity/ONULogOLT.php

@@ -0,0 +1,131 @@
+<?php
+
+namespace FTTHBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+use Doctrine\ORM\Mapping\OneToOne;
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
+
+/**
+ * ONULogOLT
+ *
+ * @ORM\Entity
+ */
+class ONULogOLT
+{
+    /**
+     * @ORM\Column(name="id", type="integer", nullable=false)
+     * @ORM\Id
+     * @ORM\GeneratedValue(strategy="AUTO")
+     */
+    protected $id;
+
+    /**
+     * @ORM\Column(type="string", options={"default": ""})
+     */
+    protected $status;
+
+    /**
+     * @ORM\Column(type="string", options={"default": ""})
+     */
+    protected $directory;
+
+    /**
+     * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
+     */
+    protected $date;
+
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        $this->setStatus("");
+        $this->setDirectory("");
+        $this->setDate(new \DateTime());
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * @param mixed $id
+     * @return ONULogOLT
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getStatus()
+    {
+        return $this->status;
+    }
+
+    /**
+     * @param mixed $status
+     * @return ONULogOLT
+     */
+    public function setStatus($status)
+    {
+        $this->status = $status;
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getDirectory()
+    {
+        return $this->directory;
+    }
+
+    /**
+     * @param mixed $directory
+     * @return ONULogOLT
+     */
+    public function setDirectory($directory)
+    {
+        $this->directory = $directory;
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getDate()
+    {
+        return $this->date;
+    }
+
+    /**
+     * @param mixed $date
+     * @return ONULogOLT
+     */
+    public function setDate($date)
+    {
+        $this->date = $date;
+        return $this;
+    }
+
+    /**
+     * @return $this
+     */
+    public function setPending()
+    {
+        $this->setStatus("PENDING");
+        $this->setDirectory("");
+        $this->setDate(new \DateTime());
+        return $this;
+    }
+}

+ 7 - 2
src/FTTHBundle/Resources/translations/FTTHBundle.es.yml

@@ -54,6 +54,8 @@ filter:
     label_value: Valor
     label_comments: Comentarios
     label_template: Template
+    label_log_o_l_t_status: Conf. Status
+    label_log_o_l_t_date: Fecha OLT
 
 breadcrumb:
     link_t_cont_profile_list: Listado Perfiles tcon
@@ -234,7 +236,8 @@ list:
     label_enable_pass: Enable Password
     label_ssh_port: SSH Port
     label_ssh_connect: Conexión por SSH
-
+    label_log_o_l_t_status: Conf. Status
+    label_log_o_l_t_date: Fecha OLT
 show:
     label_id: Id
     label_ip: Ip
@@ -308,7 +311,9 @@ show:
     label_traffic_profile_in: Perfil de Tráfico In
     label_traffic_profile_out: Perfil de Tráfico Out
     label_tcontprofile: Perfil tcont
-
+    label_log_o_l_t_status: Conf. Status
+    label_log_o_l_t_date: Fecha OLT
+    label_log_o_l_t_directory: Directorio log OLT
 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.

+ 15 - 0
src/FTTHBundle/Resources/views/Type/list_status_field_type.html.twig

@@ -0,0 +1,15 @@
+{% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %}
+
+{% block field %}
+    {% if object is defined and object.getLogOLT() is defined and object.getLogOLT().getStatus() is defined %}
+        {% if object.getLogOLT().getStatus() == 'OK' %}
+            <span class="label alert-success">
+        {% elseif object.getLogOLT().getStatus() == 'ERROR' %}
+            <span class="label alert-error">
+        {% else %}
+            <span class="label alert-warning">
+        {% endif %}
+        {{ object.getLogOLT().getStatus() }}
+        </span>
+    {% endif %}
+{% endblock %}

+ 15 - 0
src/FTTHBundle/Resources/views/Type/show_status_field_type.html.twig

@@ -0,0 +1,15 @@
+{% extends 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
+
+{% block field %}
+    {% if object is defined and object.getLogOLT() is defined and object.getLogOLT().getStatus() is defined %}
+        {% if object.getLogOLT().getStatus() == 'OK' %}
+            <span class="label alert-success">
+        {% elseif object.getLogOLT().getStatus() == 'ERROR' %}
+            <span class="label alert-error">
+        {% else %}
+            <span class="label alert-warning">
+        {% endif %}
+        {{ object.getLogOLT().getStatus() }}
+        </span>
+    {% endif %}
+{% endblock %}