gabriel 8 년 전
부모
커밋
d31de2a23d

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 /app/config/parameters.yml
+/app/config/bundles/ik/device-bundle/parameters.yml
 /app/config/url_webservice.yml
 /app/config/hwioauthbundle/parameters.yml
 /build/

+ 1 - 1
Dockerfile

@@ -4,7 +4,7 @@ EXPOSE 8000
 #RUN echo "Acquire::http::Proxy \"http://172.17.0.5:3142\";" | tee /etc/apt/apt.conf.d/00aptproxy
 
 RUN apt-get update 
-RUN apt-get install -yq git wget vim tmux php-cli php-mysql php-curl graphviz php-amqplib php7.0-xml php7.0-zip
+RUN apt-get install -yq python git wget vim tmux php-cli php-mysql php-curl graphviz php-amqplib php7.0-xml php7.0-zip
 
 RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
 RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

+ 1 - 1
app/config/bundles/ik/device-bundle/parameters.yml.dist

@@ -2,4 +2,4 @@ parameters:
     device_check_url: 'http://127.0.0.1/base/app_dev.php/api/devices/check.json'
     device_post_url: 'http://127.0.0.1/base/app_dev.php/api/devices.json'
     device_delete_post_url: 'http://127.0.0.1/base/app_dev.php/api/device.json'
-    device_put_url: 'http://127.0.0.1/base/app_dev.php/api/device.json'
+    device_put_url: 'http://127.0.0.1/base/app_dev.php/api/devices/'

+ 1 - 1
app/config/bundles/ik/device-bundle/parameters.yml.docker

@@ -3,4 +3,4 @@ parameters:
     device_check_url: 		'http://%env(HOST_BASE)%/api/devices/check.json'
     device_post_url: 		'http://%env(HOST_BASE)%/api/devices.json'
     device_delete_post_url: 	'http://%env(HOST_BASE)%/api/device.json'
-    device_put_url:             'http://%env(HOST_BASE)%/api/device.json'
+    device_put_url:             'http://%env(HOST_BASE)%/api/devices/'

+ 8 - 0
composer.lock

@@ -1397,7 +1397,11 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseAdmin.git",
+<<<<<<< HEAD
                 "reference": "c000750a1b6ac7239379b36535f7612f0bbdb367"
+=======
+                "reference": "b6ad2dfffe165ea3965973074fc78735770f2f9d"
+>>>>>>> 4a9e3a60ec00888d68df80118142644cced15250
             },
             "type": "library",
             "autoload": {
@@ -1412,7 +1416,11 @@
                 "bootstrap",
                 "sonata"
             ],
+<<<<<<< HEAD
             "time": "2017-08-02 18:09:07"
+=======
+            "time": "2017-08-01 17:52:58"
+>>>>>>> 4a9e3a60ec00888d68df80118142644cced15250
         },
         {
             "name": "ik/device-bundle",

+ 40 - 23
src/FTTHBundle/Admin/OLTAdmin.php

@@ -21,7 +21,8 @@ class OLTAdmin extends WorkflowBaseAdmin
             ->add('ip')
             ->add('snmpCommunity')
             ->add('sshUser')
-            ->add('sshPass');
+            ->add('sshPass')
+        ;
     }
 
     /**
@@ -37,7 +38,7 @@ class OLTAdmin extends WorkflowBaseAdmin
             ->add('sshUser')
             ->add('sshPass')
 //            ->add('workflow')
-            ->add('currentState', 'string', array('template' => 'WorkflowBundle:Workflow:base_list_field_current_state.html.twig'))
+            ->add('currentState','string', array('template' => 'WorkflowBundle:Workflow:base_list_field_current_state.html.twig'))
             ->add('_action', 'with-workflow-action', array(
                 'actions' => array(
                     'show' => array(),
@@ -45,7 +46,8 @@ class OLTAdmin extends WorkflowBaseAdmin
                     'delete' => array(),
                     'state' => array('template' => 'WorkflowBundle:Workflow:show_transitions.html.twig')
                 )
-            ));
+            ))
+        ;
     }
 
     /**
@@ -54,12 +56,29 @@ class OLTAdmin extends WorkflowBaseAdmin
     protected function configureFormFields(FormMapper $formMapper)
     {
         $formMapper
+                ->tab('default')
+                    ->with('')
             ->add('name')
             ->add('model')
+                    ->end()
+                ->end()
+                ->tab('configuration')
+                    ->with('OLT')
             ->add('ip')
             ->add('snmpCommunity')
             ->add('sshUser')
-            ->add('sshPass')//            ->add('workflow')
+                        ->add('sshPass')
+                    ->end()
+                ->end()
+                ->tab('stats')
+                    ->with('olt_execute_time')
+                        ->add('executeSnmp')
+                        ->add('timeScan', 'integer', array('attr' => array('min' => 0)))
+                        ->add('timeOnuStats', 'integer', array('attr' => array('min' => 0)))
+                        ->add('timePonStats', 'integer', array('attr' => array('min' => 0)))
+                        ->add('timeOltOctets', 'integer', array('attr' => array('min' => 0)))
+                    ->end()
+                ->end()
         ;
     }
 
@@ -70,26 +89,25 @@ class OLTAdmin extends WorkflowBaseAdmin
     {
         $showMapper
             ->tab('default')
-            ->with('')
-            ->add('name')
-            ->add('model')
-            ->add('ip')
-            ->add('snmpCommunity')
-            ->add('sshUser')
-            ->add('sshPass')
-            ->end()
-            ->end()
+                ->with('')
+                    ->add('name')
+                    ->add('model')
+                    ->add('ip')
+                    ->add('snmpCommunity')
+                    ->add('sshUser')
+                    ->add('sshPass')
+                ->end()
+            ->end()   
             ->tab('Log')
-            ->with('Log')
-            ->add('deviceLog', 'string', array(
-                'template' => 'DeviceBundle::show_device_log.html.twig',
-                'translation_domain' => 'DeviceBundle',
-            ))
-            ->end()
-            ->end();
+                ->with('Log')
+                    ->add('deviceLog','string', array(
+                        'template' => 'DeviceBundle::show_device_log.html.twig',
+                        'translation_domain' => 'DeviceBundle',
+                        ))
+                ->end()
+            ->end()   
+        ;
     }
-
-
     /**
      * @param mixed $object
      */
@@ -98,5 +116,4 @@ class OLTAdmin extends WorkflowBaseAdmin
         parent::prePersist($object);
         $this->addTenancyIdFromServicie($object);
     }
-
 }

+ 18 - 6
src/FTTHBundle/Admin/OLTModelAdmin.php

@@ -17,7 +17,10 @@ class OLTModelAdmin extends BaseAdmin
     {
         $datagridMapper
             ->add('name')
-            ->add('props');
+            ->add('mark')
+            ->add('library')
+            ->add('props')
+        ;
     }
 
     /**
@@ -27,6 +30,8 @@ class OLTModelAdmin extends BaseAdmin
     {
         $listMapper
             ->add('name')
+            ->add('mark')
+            ->add('library')
             ->add('props')
             ->add('extraData')
             ->add('_action', null, array(
@@ -35,7 +40,8 @@ class OLTModelAdmin extends BaseAdmin
                     'edit' => array(),
                     'delete' => array(),
                 )
-            ));
+            ))
+        ;
     }
 
     /**
@@ -43,10 +49,15 @@ class OLTModelAdmin extends BaseAdmin
      */
     protected function configureFormFields(FormMapper $formMapper)
     {
+        $marks = ['FiberHome' => 'FiberHome', 'FiberLink' => 'FiberLink'];
+        $libraries = ['OIDSFiberHomeV1' => 'OIDSFiberHomeV1'];
         $formMapper
             ->add('name')
+            ->add('mark', 'choice', array('required'=>true, 'choices' => $marks))
+            ->add('library', 'choice', array('required'=>true, 'choices' => $libraries))
             ->add('props')
-            ->add('extraData');
+            ->add('extraData')
+        ;
     }
 
     /**
@@ -56,10 +67,12 @@ class OLTModelAdmin extends BaseAdmin
     {
         $showMapper
             ->add('name')
+            ->add('mark')
+            ->add('library')
             ->add('props')
-            ->add('extraData');
+            ->add('extraData')
+        ;
     }
-
     /**
      * @param mixed $object
      */
@@ -68,5 +81,4 @@ class OLTModelAdmin extends BaseAdmin
         parent::prePersist($object);
         $this->addTenancyIdFromServicie($object);
     }
-
 }

+ 143 - 3
src/FTTHBundle/Entity/OLT.php

@@ -102,7 +102,31 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface
      */
     protected $workflow;
 
+    /**
+     * @ORM\Column(type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT TRUE")
+     */
+    protected $executeSnmp = true;
+
+    /**
+     * @ORM\Column(type="integer", options={"unsigned":true, "default":10})
+     */
+    protected $timeScan = 10;
 
+    /**
+     * @ORM\Column(type="integer", options={"unsigned":true, "default":5})
+     */
+    protected $timeOltOctets = 5;
+    
+    /**
+     * @ORM\Column(type="integer", options={"unsigned":true, "default":5})
+     */
+    protected $timePonStats = 5;
+    
+    /**
+     * @ORM\Column(type="integer", options={"unsigned":true, "default":5})
+     */
+    protected $timeOnuStats = 5;
+    
     /**
      * @return string
      */
@@ -400,10 +424,22 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface
         $deviceExtraData = array('snmpCommunity' => $this->snmpCommunity, 'sshUser' => $this->sshUser, 'sshPass' => $this->sshPass,
                                  'libraryVersion' => $this->libraryVersion, 'name' => $this->name);
 
-        ($this->model)? $model = $this->getModel()->getId() : $model = null;
-
-        $deviceExtraData['modelId'] = $model;
+        if($this->model) {
+            $model = $this->getModel();
+            $deviceExtraData['modelId'] = $model->getId();
+            $deviceExtraData['mark'] = $model->getMark();
+            $deviceExtraData['library'] = $model->getLibrary();
+        } else {
+            $deviceExtraData['modelId'] = null;
+            $deviceExtraData['mark'] = null;
+            $deviceExtraData['library'] = null;
+        }
         
+        $deviceExtraData['executeSnmp'] = $this->executeSnmp;
+        $deviceExtraData['timeScan'] = $this->timeScan;
+        $deviceExtraData['timeOnuStats'] = $this->timeOnuStats;
+        $deviceExtraData['timePonStats'] = $this->timePonStats;
+        $deviceExtraData['timeOltOctets'] = $this->timeOltOctets;
 
         $deviceData['extraData'] = json_encode($deviceExtraData);
 
@@ -417,4 +453,108 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface
         );*/
     }
 
+    /**
+     * Set executeSnmp
+     *
+     * @param boolean $e
+     * @return OLT
+     */
+    public function setExecuteSnmp($e)
+    {
+        $this->executeSnmp = $e;
+        return $this;
+    }
+
+    /**
+     * Get executeSnmp
+     *
+     * @return boolean 
+     */
+    public function getExecuteSnmp()
+    {
+        return $this->executeSnmp;
+    }
+
+    /**
+     * Set timeScan
+     *
+     * @param integer $timeScan
+     */
+    public function setTimeScan($timeScan)
+    {
+        $this->timeScan = $timeScan;
+    }
+
+    /**
+     * Get timeScan
+     *
+     * @return integer 
+     */
+    public function getTimeScan()
+    {
+        return $this->timeScan;
+    }
+    
+    /**
+     * Set timeOltOctets
+     *
+     * @param integer $timeOltOctets
+     */
+    public function setTimeOltOctets($timeOltOctets)
+    {
+        $this->timeOltOctets = $timeOltOctets;
+    }
+
+    /**
+     * Get timeOltOctets
+     *
+     * @return integer 
+     */
+    public function getTimeOltOctets()
+    {
+        return $this->timeOltOctets;
+    }
+    
+    /**
+     * Set timeOnuStats
+     *
+     * @param integer $timeOnuStats
+     */
+    public function setTimeOnuStats($timeOnuStats)
+    {
+        $this->timeOnuStats = $timeOnuStats;
+    }
+
+    /**
+     * Get timeOnuStats
+     *
+     * @return integer 
+     */
+    public function getTimeOnuStats()
+    {
+        return $this->timeOnuStats;
+    }
+    
+    /**
+     * Set timePonStats
+     *
+     * @param integer $timePonStats
+     */
+    public function setTimePonStats($timePonStats)
+    {
+        $this->timePonStats = $timePonStats;
+    }
+
+    /**
+     * Get timePonStats
+     *
+     * @return integer 
+     */
+    public function getTimePonStats()
+    {
+        return $this->timePonStats;
+    }
+    
+    
+
 }

+ 54 - 0
src/FTTHBundle/Entity/OLTModel.php

@@ -44,6 +44,20 @@ class OLTModel implements TenancyIdTraitInterface
      */
     protected $props;
 
+    /**
+     * @var string $mark
+     *
+     * @ORM\Column(type="string", length=255, nullable=true)
+     */
+    protected $mark;
+    
+    /**
+     * @var string $library
+     *
+     * @ORM\Column(type="string", length=255, nullable=true)
+     */
+    protected $library;
+
 
     /**
      * @return string
@@ -131,4 +145,44 @@ class OLTModel implements TenancyIdTraitInterface
         
         return $this;
     }
+    
+    /**
+     * @param string $mark
+     *
+     * @return OLTModel
+     */
+    public function setMark($mark)
+    {
+        $this->mark = $mark;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getMark()
+    {
+        return $this->mark;
+    }
+    
+    /**
+     * @param string $library
+     *
+     * @return OLTModel
+     */
+    public function setLibrary($library)
+    {
+        $this->library = $library;
+
+        return $this;
+    }
+
+    /**
+     * @return string
+     */
+    public function getLibrary()
+    {
+        return $this->library;
+    }
 }

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

@@ -1,4 +1,6 @@
 default: General
+configuration: Configuración
+stats: Estadísticas
 FTTH: FTTH
 ONU: ONU
 OLT: OLT
@@ -6,6 +8,7 @@ OLTModel: Modelo OLT
 ONUModel: Modelo ONU
 NAP: NAP
 Profile: Perfil
+olt_execute_time: Tiempo(min) entre consultas a OLT
 
 filter:
     label_id: Id
@@ -37,6 +40,7 @@ filter:
     label_model_workflow: Workflow
     label_props: Propiedades
     label_nap: NAP
+    label_library: Librería
 breadcrumb:
     link_o_n_u_list: Listado ONU
     link_o_n_u_create: Crear ONU
@@ -89,6 +93,11 @@ form:
     label_parent: Padre
     label_nap: NAP
     label_extra_data: Extra Data
+    label_library: Librería
+    label_time_scan: Escanear ONUs y PON PORTs
+    label_time_pon_stats: Estadísticas de PON PORTs
+    label_time_onu_stats: Estadísticas de ONUs
+    label_time_olt_octets: Tráfico de OLT
 
 list:
     label_id: Id
@@ -123,6 +132,7 @@ list:
     label_nap: NAP
     label_onus: ONUs
     label_extra_data: Extra Data
+    label_library: Librería
 
 show:
     label_id: Id
@@ -157,6 +167,7 @@ show:
     label_nap: NAP
     label_onus: ONUs
     label_extra_data: Extra Data
+    label_library: Librería
 
 Incorrect State: Estado erróneo
 Undefined State: Estado no definido

+ 1 - 1
src/FTTHBundle/Resources/views/ONU/show_log.html.twig

@@ -1,5 +1,5 @@
 {% extends 'SonataAdminBundle:CRUD:base_show_field.html.twig' %}
 
 {% block field %}
-    <pre style="font-size: 10px;">{{object.getLog()}}</pre>
+    <pre class="log">{{object.getLog()}}</pre>
 {% endblock %}