浏览代码

Merge branch 'master' of ssh://gitlab.com/interlink-sa/flowdat3/modules/ftth into 11

gabriel 6 年之前
父节点
当前提交
d4dd28eb47

+ 11 - 0
.gitlab-ci.yml

@@ -1,6 +1,8 @@
 build_branch:
+    cache: {}
     image: docker.infra.flowdat.com/fd3/sf-php:latest
     script:
+      - pwd
       - chmod 0600 keys/*
       - eval $(ssh-agent); ssh-add keys/gogs.drone.id_rsa
       - git fetch --tags
@@ -39,6 +41,7 @@ variables:
   HOST_RADIUS: radius.test.fd3.flowdat.com
   HOST_STATS: stats.test.fd3.flowdat.com
   HOST_DUMMY: "http://www.flowdat.com/"
+  GIT_STRATEGY: clone
 
 docker:
   stage: build
@@ -71,6 +74,7 @@ docker_version_tag:
 build:
   image: docker.infra.flowdat.com/fd3/sf-php:latest
   script:
+    - pwd
     - command -v mysqladmin >/dev/null 2>&1 || { echo "I require mysqladmin but it's not installed.  Aborting." >&2; exit 1; }
     - while ! mysqladmin ping -h mysql --silent ; do :; done
     - echo "yes" | mysqladmin -h mysql create fd3_ftth
@@ -81,6 +85,13 @@ build:
     - eval $(ssh-agent); ssh-add keys/bitbucket.id_rsa
     - composer install -n --no-progress
     - composer dump-autoload --optimize
+    - cp app/Resources/workflows/workflow_list.yml.dist app/Resources/workflows/workflow_list.yml
+    - cp app/config/bundles/ik/audit-bundle/parameters.yml.dist app/config/bundles/ik/audit-bundle/parameters.yml
+    - cp app/config/bundles/ik/device-bundle/parameters.yml.dist app/config/bundles/ik/device-bundle/parameters.yml
+    - cp app/config/bundles/ik/base-admin-bundle/parameters.yml.dist app/config/bundles/ik/base-admin-bundle/parameters.yml
+    - cp app/config/url_webservice.yml.dist app/config/url_webservice.yml
+    - cp app/config/hwioauthbundle/parameters.yml.dist app/config/hwioauthbundle/parameters.yml
+    - cp app/config/parameters.yml.dist app/config/parameters.yml
     - chmod 0777 -R var/logs var/cache var/sessions
     - touch var/logs/test.log
     - tail -f var/logs/*.log &

文件差异内容过多而无法显示
+ 3 - 3
app/DoctrineMigrations/src/template.yml


+ 1 - 1
app/Resources/SonataAdminBundle/views/CRUD/list__action_delete.html.twig

@@ -12,6 +12,6 @@ file that was distributed with this source code.
 {% if admin.hasAccess('delete', object) and owner_voter.vote(token_security.token, object, ['delete']) >= 0 and admin.hasRoute('delete') %}
     <a href="{{ admin.generateObjectUrl('delete', object) }}" class="btn btn-sm btn-default delete_link" title="{{ 'action_delete'|trans({}, 'SonataAdminBundle') }}">
         <i class="fa fa-times" aria-hidden="true"></i>
-        {{ 'action_delete'|trans({}, 'SonataAdminBundle') }}
+        {# {{ 'action_delete'|trans({}, 'SonataAdminBundle') }} #}
     </a>
 {% endif %}

+ 2 - 3
app/Resources/SonataAdminBundle/views/CRUD/list__action_edit.html.twig

@@ -10,9 +10,8 @@ file that was distributed with this source code.
 #}
 
 {% if admin.hasAccess('edit', object) and owner_voter.vote(token_security.token, object, ['edit']) >= 0 and admin.hasRoute('edit') %}
-    <a href="{{ admin.generateObjectUrl('edit', object) }}" class="btn btn-sm btn-default edit_link"
-       title="{{ 'action_edit'|trans({}, 'SonataAdminBundle') }}">
+    <a href="{{ admin.generateObjectUrl('edit', object) }}" class="btn btn-sm btn-default edit_link" title="{{ 'action_edit'|trans({}, 'SonataAdminBundle') }}">
         <i class="fa fa-pencil" aria-hidden="true"></i>
-        {{ 'action_edit'|trans({}, 'SonataAdminBundle') }}
+        {# {{ 'action_edit'|trans({}, 'SonataAdminBundle') }} #}
     </a>
 {% endif %}

+ 17 - 0
app/Resources/SonataAdminBundle/views/CRUD/list__action_show.html.twig

@@ -0,0 +1,17 @@
+{#
+
+This file is part of the Sonata package.
+
+(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+
+#}
+
+{% if admin.hasAccess('show', object) and owner_voter.vote(token_security.token, object, ['show']) >= 0 and admin.hasRoute('show') %}
+    <a href="{{ admin.generateObjectUrl('show', object) }}" class="btn btn-sm btn-default view_link" title="{{ 'action_show'|trans({}, 'SonataAdminBundle') }}">
+        <i class="fa fa-eye" aria-hidden="true"></i>
+        {# {{ 'action_show'|trans({}, 'SonataAdminBundle') }} #}
+    </a>
+{% endif %}

+ 0 - 0
aux.txt


+ 31 - 31
composer.lock

@@ -1,7 +1,7 @@
 {
     "_readme": [
         "This file locks the dependencies of your project to a known state",
-        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
     "content-hash": "2936d77bbfff21651cf2c40704457bde",
@@ -1900,7 +1900,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/AuditBundle.git",
-                "reference": "34dece40daad7031e332f02314b681bb9ee1cd14"
+                "reference": "fdb6ffb9d88fb20bcdb7f46ae6098915112e5e55"
             },
             "require": {
                 "simplethings/entity-audit-bundle": "^1.0"
@@ -1916,7 +1916,7 @@
                 "audit",
                 "bundle"
             ],
-            "time": "2019-01-31T13:32:40+00:00"
+            "time": "2019-03-01T17:42:21+00:00"
         },
         {
             "name": "ik/auth-bundle",
@@ -1924,7 +1924,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/AuthBundle.git",
-                "reference": "c8e77dce32b92c08d75e12c537ead77bf976cd84"
+                "reference": "11b7d49dc85ac20e7b16d8cec296d140b1650641"
             },
             "type": "library",
             "autoload": {
@@ -1939,7 +1939,7 @@
                 "auth",
                 "bundle"
             ],
-            "time": "2019-01-31T13:33:33+00:00"
+            "time": "2019-03-01T17:42:56+00:00"
         },
         {
             "name": "ik/base-admin-bundle",
@@ -1947,7 +1947,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/BaseAdmin.git",
-                "reference": "a6fd19876e0d86411c14ded84d63dd82023bab8e"
+                "reference": "a3268eb5d3806d8d811e8df78c148544dfc46f4d"
             },
             "type": "library",
             "autoload": {
@@ -1962,7 +1962,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2019-03-07T15:47:08+00:00"
+            "time": "2019-03-15T17:10:29+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": "df53b6339c7ae09fbdc350540f15e334be42b000"
+                "reference": "2d285a2d52ff4eaaddf6e98b92cbe91842c1f1e8"
             },
             "type": "library",
             "autoload": {
@@ -1985,7 +1985,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2019-01-31T13:23:39+00:00"
+            "time": "2019-03-01T17:38: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": "5a72c912f13ba8728fda6792d867e61a889e6c06"
+                "reference": "5af05cc3812b1f8f0e30042f94f8240f553b8d4e"
             },
             "type": "library",
             "autoload": {
@@ -2008,7 +2008,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2019-01-31T13:35:09+00:00"
+            "time": "2019-03-01T17:44:12+00:00"
         },
         {
             "name": "ik/extra-data-bundle",
@@ -2016,7 +2016,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
-                "reference": "77c2c8228bb9dfd13add559909fd809508b61388"
+                "reference": "0af5c1039f8c47394b7cf2f5b1925dcda942d48b"
             },
             "type": "library",
             "autoload": {
@@ -2031,7 +2031,7 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2019-01-31T13:44:14+00:00"
+            "time": "2019-03-01T17:35:13+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": "bcf009e03ace356adfd92a7a89f814aa2e96fb6c"
+                "reference": "7ce5a56ec0d134be131b28fc84535fc4613ecad4"
             },
             "require": {
                 "ext-curl": "*",
@@ -2052,7 +2052,7 @@
                 }
             },
             "description": "The Flowdat3 Leaflet Resource",
-            "time": "2019-01-31T13:34:17+00:00"
+            "time": "2019-03-01T17:43:35+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": "94454d6f6943fb07040dadae8edddd3d13510b5f"
+                "reference": "006c6db55ae17b6153f4d110d8a939aae2c660da"
             },
             "type": "library",
             "autoload": {
@@ -2075,7 +2075,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2019-01-31T13:29:47+00:00"
+            "time": "2019-03-01T17:40:17+00:00"
         },
         {
             "name": "ik/migrations-bundle",
@@ -2083,7 +2083,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/migrations.git",
-                "reference": "f28fb9789575889674e392a84e85a98d4b7dc0bb"
+                "reference": "02ca1ac6fd2ac6954bd632d98d5ce1e0de6fc674"
             },
             "type": "library",
             "autoload": {
@@ -2098,7 +2098,7 @@
                 "bundle",
                 "migrations"
             ],
-            "time": "2019-02-01T12:35:40+00:00"
+            "time": "2019-03-01T17:36:43+00:00"
         },
         {
             "name": "ik/oauthclient-bundle",
@@ -2106,7 +2106,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/BaseOAuthClientBundle.git",
-                "reference": "a057890183bddcb6f4c431c3b7c9afe6839d8d78"
+                "reference": "fe4d1edd01493e18cd15c5108200c85853b9947e"
             },
             "require": {
                 "ext-curl": "*",
@@ -2125,7 +2125,7 @@
                 "bundle",
                 "oauth"
             ],
-            "time": "2019-01-31T13:37:25+00:00"
+            "time": "2019-03-01T17:46:20+00:00"
         },
         {
             "name": "ik/owner-voter-bundle",
@@ -2133,7 +2133,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/OwnerVoter.git",
-                "reference": "ece1ca1df9ca18789ccdcae19a381ee5d9142f6c"
+                "reference": "f99aeb3a95996b481a163dd7963e84bd35d00f6e"
             },
             "type": "library",
             "autoload": {
@@ -2148,7 +2148,7 @@
                 "bundle",
                 "owner-voter"
             ],
-            "time": "2019-01-31T13:18:32+00:00"
+            "time": "2019-03-01T17:37:38+00:00"
         },
         {
             "name": "ik/template-bundle",
@@ -2156,7 +2156,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/TemplateBundle.git",
-                "reference": "2c02107d2ec87aad3fca45adc94f6e69f3aa0119"
+                "reference": "814f06b1cac5d6d67670a1cec1c87e288526bb59"
             },
             "require": {
                 "ik/base-admin-bundle": "*"
@@ -2174,7 +2174,7 @@
                 "bundle",
                 "template"
             ],
-            "time": "2019-01-31T13:32:01+00:00"
+            "time": "2019-03-01T17:41:42+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": "cfc9fd8148a071c3e4ea4a590f03d8442a2f5752"
+                "reference": "537a2e22f794778a23c99caa6fe077650662a23e"
             },
             "require": {
                 "ext-curl": "*"
@@ -2194,7 +2194,7 @@
                 }
             },
             "description": "The Flowdat3 TR069",
-            "time": "2019-01-31T11:42:17+00:00"
+            "time": "2019-03-01T17:25:06+00:00"
         },
         {
             "name": "ik/webservice-bundle",
@@ -2202,7 +2202,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/Webservice.git",
-                "reference": "dcf83af721a56b40e4f521ebf53cc0918c7aa1f3"
+                "reference": "7b977e8167e932b826c6ed470b1abb4bb7f999d5"
             },
             "require": {
                 "ext-curl": "*",
@@ -2215,7 +2215,7 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2019-02-27T12:06:15+00:00"
+            "time": "2019-03-14T18:25:25+00:00"
         },
         {
             "name": "ik/workflow-bundle",
@@ -2223,7 +2223,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
-                "reference": "47079cbd49260d35df40e9309564112d511f2474"
+                "reference": "5b0608cc9e4288c05fe6520c0621b6fd8b2eda5d"
             },
             "require": {
                 "php-amqplib/rabbitmq-bundle": "^1.12"
@@ -2253,7 +2253,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2019-02-28T17:24:48+00:00"
+            "time": "2019-03-15T17:07:28+00:00"
         },
         {
             "name": "incenteev/composer-parameter-handler",

+ 74 - 0
src/FTTHBundle/Admin/ONUAdmin.php

@@ -712,4 +712,78 @@ class ONUAdmin extends WorkflowBaseAdmin
         }
 
     }
+
+    public function getExportFields()
+    {
+
+        $fields = array();
+        $fields[$this->trans('export.ponSerialNumberAux')] = "ponSerialNumberAux";
+        $fields[$this->trans('export.serialNumber')] = "serialNumber";
+        $fields[$this->trans('export.currentState')] = "currentState";
+        $fields[$this->trans('export.clientId')] = "clientId";
+        $fields[$this->trans('export.clientExternalId')] = "clientExternalId";
+        $fields[$this->trans('export.ip')] = "ip";
+        $fields[$this->trans('export.mac')] = "mac";
+        $fields[$this->trans('export.radiusAuth')] = "radiusAuth";
+        $fields[$this->trans('export.olt')] = "olt";
+        $fields[$this->trans('export.nap')] = "nap";
+        $fields[$this->trans('export.slot')] = "slot";
+        $fields[$this->trans('export.link')] = "link";
+        $fields[$this->trans('export.position')] = "position";
+        $fields[$this->trans('export.catv')] = "catv";
+        $fields[$this->trans('export.activationCode')] = "activationCode";
+        $fields[$this->trans('export.created')] = "created";
+        $fields[$this->trans('export.updated')] = "updated";
+        
+        return $fields;
+    }
+
+    // Replace clientId to Client Name and set Client External ID
+    public function getDataSourceIterator()
+    {
+        $datagrid = $this->getDatagrid();
+        $datagrid->buildPager();
+
+        $clients = $this->getClients($datagrid);
+
+        foreach ($datagrid->getResults() as $order) {
+            $clientId = $order->getClientId();
+            if(isset($clients[$clientId])) {
+                $order->setClientExternalId($clients[$clientId]['externalId']);
+                $order->setClientId($clients[$clientId]['name']);
+            }
+        }
+
+        $datasourceit = $this->getModelManager()->getDataSourceIterator($datagrid, $this->getExportFields());
+
+        return $datasourceit;
+    }
+
+    // Get all clientsIDs and get data from api/clients.json in base
+    private function getClients($datagrid)
+    {
+        $container = $this->getConfigurationPool()->getContainer();
+        $clientsIds = array();
+        foreach($datagrid->getResults() as $object) {
+            if($object->getClientId())
+                $clientsIds[$object->getClientId()] = $object->getClientId();
+        }
+
+        $_clients = array();
+        
+        if ($container->hasParameter('client') && $clientsIds) {
+            $clientApi = $this->getParameter('client');
+            $webservice = $this->get("webservice");
+            $filters = array("qb-ids" => implode(",",$clientsIds), 'qb-criteria' => true);
+            $clients = $webservice->getData($clientApi, $filters);
+            
+            if (is_array($clients) && !empty($clients)) {
+                foreach ($clients as $client) 
+                    $_clients[$client['id']] = array('name' => $client['name'], 'externalId' => $client['externalId']);
+                
+            }
+        }
+
+        return $_clients;
+    }
 }

+ 3 - 4
src/FTTHBundle/Command/AutodiscoveryONUCommand.php

@@ -76,6 +76,8 @@ class AutodiscoveryONUCommand extends ContainerAwareCommand
                     if(is_null($nap)) {$output->writeln("NAP with slot: {$slot} and link: {$link} in OLT id: {$oltid} doesn't exist - continue");continue;}
                     
                     $modelName = "FiberHome-{$model}";
+                    if($model == 'HG260') $modelName = "VSolution-HG323";
+                    
                     $onuModel = $em->getRepository(ONUModel::class)->findOneByName($modelName);
                     if(is_null($onuModel)) {$output->writeln("ONU MODEL ({$modelName}) doesn't exist - continue");continue;}
                     
@@ -83,10 +85,7 @@ class AutodiscoveryONUCommand extends ContainerAwareCommand
                     $onu = $em->getRepository(ONU::class)->findOneByPonSerialNumber($psn);
                     if($onu) {$output->writeln("ONU ({$psn}) exist - continue");continue;}
                     
-                    $onu = $em->getRepository(ONU::class)->findOneBy(array('olt' => $olt, 'nap' => $nap, 'position' => $index));
-                    if($onu) {$output->writeln("ONU({$onu->getPonSerialNumber()}) in OLT({$olt->getName()}) > NAP({$nap->getName()} {$slot}/{$link}) > Position ($index) exist - continue");continue;}
-
-                    $output->writeln("OK with PSN - OLT - NAP - POSITION - PROFILE, so we create the ONU");
+                    $output->writeln("OK with PSN - OLT - NAP - PROFILE, so we create the ONU");
 
                     $newOnu = new ONU();
                     $newOnu->setPonSerialNumber($psn);

+ 20 - 7
src/FTTHBundle/Entity/ONU.php

@@ -107,6 +107,9 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     private $clientId;
 
+    // Used in ONU Admin and established the value on the fly - Don't save it in DB
+    private $clientExternalId;
+
     /**
      * @ORM\Column(type="datetime")
      *
@@ -197,7 +200,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Se agrega para casos en que tenga varias vlans
      *
-     * @ORM\ManyToMany(targetEntity="\FTTHBundle\Entity\VLanID", cascade={"all"})
+     * @ORM\ManyToMany(targetEntity="\FTTHBundle\Entity\VLanID")
      * @ORM\JoinTable(name="onus_vlanids",
      *      joinColumns={@ORM\JoinColumn(name="onu_id", referencedColumnName="id", onDelete="CASCADE")},
      *      inverseJoinColumns={@ORM\JoinColumn(name="vlanid_id", referencedColumnName="id", onDelete="CASCADE")})
@@ -650,12 +653,12 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     public function getSlot()
     {
-        $olt = null;
+        $slot = null;
         if ($this->nap) {
-            $olt = $this->nap->getSlot();
+            $slot = $this->nap->getSlot();
         }
 
-        return $olt;
+        return $slot;
     }
 
     /**
@@ -663,12 +666,12 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     public function getLink()
     {
-        $olt = null;
+        $link = null;
         if ($this->nap) {
-            $olt = $this->nap->getLink();
+            $link = $this->nap->getLink();
         }
 
-        return $olt;
+        return $link;
     }
 
     /**
@@ -1182,4 +1185,14 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     {
         return $this->radiusAuth;
     }
+
+    public function getClientExternalId() 
+    {
+        return $this->clientExternalId;
+    }
+    
+    public function setClientExternalId($clientExternalId) 
+    {
+        return $this->clientExternalId = $clientExternalId;
+    }
 }

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

@@ -328,6 +328,25 @@ show:
     label_log_o_l_t_date: Fecha OLT
     label_log_o_l_t_directory: Directorio log OLT
     label_date: Fecha
+
+export:
+    serialNumber: Serial Number
+    ponSerialNumberAux: Pon Serial Number
+    currentState: Estado
+    clientId: Nombre Cliente
+    clientExternalId: External ID Cliente
+    ip:  IP
+    mac: MAC
+    radiusAuth: Validación Radius
+    olt: OLT
+    nap: NAP
+    slot: SLOT
+    link: LINK
+    position: Position
+    catv: CATV
+    activationCode: Código de Activación
+    created: Creada
+    updated: Actualizada
     
 helps:
     check_address: Verifique la dirección para el cálculo de distancias.