Quellcode durchsuchen

Check hexSerialNumber on serial numbers from onus.

Jean Sumara Leopoldo vor 5 Jahren
Ursprung
Commit
6336997f32

+ 5 - 0
bin/console

@@ -2,6 +2,7 @@
 <?php
 require __DIR__ . '/../vendor/autoload.php';
 
+use Dotenv\Dotenv;
 use Flowdat\Stats\Command\Fiberhome\FiberhomeOltScanCommand;
 use Flowdat\Stats\Command\Fiberhome\FiberhomeOnuScanCommand;
 use Flowdat\Stats\Command\Huawei\HuaweiOltScanCommand;
@@ -11,6 +12,10 @@ use Flowdat\Stats\Command\Zte\ZteOltScanCommand;
 use Flowdat\Stats\Command\Zte\ZteOnuScanCommand;
 use Symfony\Component\Console\Application;
 
+require __DIR__.'/../vendor/autoload.php';
+$dotEnv = Dotenv::createImmutable(__DIR__.'/../');
+$dotEnv->load();
+
 $application = new Application();
 $application->add(new HuaweiOltScanCommand());
 $application->add(new HuaweiOnuScanCommand());

+ 2 - 1
composer.json

@@ -21,7 +21,8 @@
     "ext-snmp": "*",
     "ext-mbstring": "*",
     "ext-pdo": "*",
-    "ocramius/package-versions": "1.2.0"
+    "ocramius/package-versions": "1.2.0",
+    "vlucas/phpdotenv": "*"
   },
   "autoload": {
     "psr-4": {

+ 259 - 85
composer.lock

@@ -4,26 +4,26 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "546e91ceab67001ce1e990f9e5ef4db6",
+    "content-hash": "29cf2760c4f5fe8ec2d42a87d4179009",
     "packages": [
         {
             "name": "doctrine/annotations",
-            "version": "1.10.2",
+            "version": "1.10.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/annotations.git",
-                "reference": "b9d758e831c70751155c698c2f7df4665314a1cb"
+                "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/annotations/zipball/b9d758e831c70751155c698c2f7df4665314a1cb",
-                "reference": "b9d758e831c70751155c698c2f7df4665314a1cb",
+                "url": "https://api.github.com/repos/doctrine/annotations/zipball/5db60a4969eba0e0c197a19c077780aadbc43c5d",
+                "reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d",
                 "shasum": ""
             },
             "require": {
                 "doctrine/lexer": "1.*",
                 "ext-tokenizer": "*",
-                "php": "^7.1"
+                "php": "^7.1 || ^8.0"
             },
             "require-dev": {
                 "doctrine/cache": "1.*",
@@ -73,24 +73,24 @@
                 "docblock",
                 "parser"
             ],
-            "time": "2020-04-20T09:18:32+00:00"
+            "time": "2020-05-25T17:24:27+00:00"
         },
         {
             "name": "doctrine/cache",
-            "version": "1.10.0",
+            "version": "1.10.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/cache.git",
-                "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62"
+                "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/cache/zipball/382e7f4db9a12dc6c19431743a2b096041bcdd62",
-                "reference": "382e7f4db9a12dc6c19431743a2b096041bcdd62",
+                "url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3",
+                "reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3",
                 "shasum": ""
             },
             "require": {
-                "php": "~7.1"
+                "php": "~7.1 || ^8.0"
             },
             "conflict": {
                 "doctrine/common": ">2.2,<2.4"
@@ -155,37 +155,32 @@
                 "redis",
                 "xcache"
             ],
-            "time": "2019-11-29T15:36:20+00:00"
+            "time": "2020-05-27T16:24:54+00:00"
         },
         {
             "name": "doctrine/collections",
-            "version": "1.6.4",
+            "version": "1.6.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/collections.git",
-                "reference": "6b1e4b2b66f6d6e49983cebfe23a21b7ccc5b0d7"
+                "reference": "fc0206348e17e530d09463fef07ba8968406cd6d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/collections/zipball/6b1e4b2b66f6d6e49983cebfe23a21b7ccc5b0d7",
-                "reference": "6b1e4b2b66f6d6e49983cebfe23a21b7ccc5b0d7",
+                "url": "https://api.github.com/repos/doctrine/collections/zipball/fc0206348e17e530d09463fef07ba8968406cd6d",
+                "reference": "fc0206348e17e530d09463fef07ba8968406cd6d",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.1.3"
+                "php": "^7.1.3 || ^8.0"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^6.0",
                 "phpstan/phpstan-shim": "^0.9.2",
                 "phpunit/phpunit": "^7.0",
-                "vimeo/psalm": "^3.2.2"
+                "vimeo/psalm": "^3.8.1"
             },
             "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.6.x-dev"
-                }
-            },
             "autoload": {
                 "psr-4": {
                     "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections"
@@ -225,32 +220,25 @@
                 "iterators",
                 "php"
             ],
-            "time": "2019-11-13T13:07:11+00:00"
+            "time": "2020-05-25T19:24:35+00:00"
         },
         {
             "name": "doctrine/common",
-            "version": "2.13.0",
+            "version": "3.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/common.git",
-                "reference": "308728eae8d90412d850c155d40b1cfbede549da"
+                "reference": "a3c6479858989e242a2465972b4f7a8642baf0d4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/common/zipball/308728eae8d90412d850c155d40b1cfbede549da",
-                "reference": "308728eae8d90412d850c155d40b1cfbede549da",
+                "url": "https://api.github.com/repos/doctrine/common/zipball/a3c6479858989e242a2465972b4f7a8642baf0d4",
+                "reference": "a3c6479858989e242a2465972b4f7a8642baf0d4",
                 "shasum": ""
             },
             "require": {
-                "doctrine/annotations": "^1.0",
-                "doctrine/cache": "^1.0",
-                "doctrine/collections": "^1.0",
-                "doctrine/event-manager": "^1.0",
-                "doctrine/inflector": "^1.0",
-                "doctrine/lexer": "^1.0",
-                "doctrine/persistence": "^1.3.3",
-                "doctrine/reflection": "^1.0",
-                "php": "^7.1"
+                "doctrine/persistence": "^2.0",
+                "php": "^7.1 || ^8.0"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^1.0",
@@ -263,7 +251,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.11.x-dev"
+                    "dev-master": "3.0.x-dev"
                 }
             },
             "autoload": {
@@ -308,7 +296,7 @@
                 "doctrine",
                 "php"
             ],
-            "time": "2020-05-15T05:51:54+00:00"
+            "time": "2020-06-05T16:59:53+00:00"
         },
         {
             "name": "doctrine/dbal",
@@ -482,20 +470,20 @@
         },
         {
             "name": "doctrine/inflector",
-            "version": "1.4.1",
+            "version": "1.4.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/inflector.git",
-                "reference": "4111f6853aea6f28b2b1dcfdde83d12dd3d5e6e3"
+                "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/inflector/zipball/4111f6853aea6f28b2b1dcfdde83d12dd3d5e6e3",
-                "reference": "4111f6853aea6f28b2b1dcfdde83d12dd3d5e6e3",
+                "url": "https://api.github.com/repos/doctrine/inflector/zipball/4650c8b30c753a76bf44fb2ed00117d6f367490c",
+                "reference": "4650c8b30c753a76bf44fb2ed00117d6f367490c",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.2"
+                "php": "^7.2 || ^8.0"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^7.0",
@@ -556,24 +544,24 @@
                 "uppercase",
                 "words"
             ],
-            "time": "2020-05-09T15:09:09+00:00"
+            "time": "2020-05-29T07:19:59+00:00"
         },
         {
             "name": "doctrine/instantiator",
-            "version": "1.3.0",
+            "version": "1.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/instantiator.git",
-                "reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
+                "reference": "f350df0268e904597e3bd9c4685c53e0e333feea"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
-                "reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
+                "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea",
+                "reference": "f350df0268e904597e3bd9c4685c53e0e333feea",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.1"
+                "php": "^7.1 || ^8.0"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^6.0",
@@ -612,24 +600,24 @@
                 "constructor",
                 "instantiate"
             ],
-            "time": "2019-10-21T16:45:58+00:00"
+            "time": "2020-05-29T17:27:14+00:00"
         },
         {
             "name": "doctrine/lexer",
-            "version": "1.2.0",
+            "version": "1.2.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/lexer.git",
-                "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6"
+                "reference": "e864bbf5904cb8f5bb334f99209b48018522f042"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
-                "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6",
+                "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042",
+                "reference": "e864bbf5904cb8f5bb334f99209b48018522f042",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.2"
+                "php": "^7.2 || ^8.0"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^6.0",
@@ -674,31 +662,33 @@
                 "parser",
                 "php"
             ],
-            "time": "2019-10-30T14:39:59+00:00"
+            "time": "2020-05-25T17:44:05+00:00"
         },
         {
             "name": "doctrine/orm",
-            "version": "v2.7.2",
+            "version": "v2.7.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/orm.git",
-                "reference": "dafe298ce5d0b995ebe1746670704c0a35868a6a"
+                "reference": "d95e03ba660d50d785a9925f41927fef0ee553cf"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/orm/zipball/dafe298ce5d0b995ebe1746670704c0a35868a6a",
-                "reference": "dafe298ce5d0b995ebe1746670704c0a35868a6a",
+                "url": "https://api.github.com/repos/doctrine/orm/zipball/d95e03ba660d50d785a9925f41927fef0ee553cf",
+                "reference": "d95e03ba660d50d785a9925f41927fef0ee553cf",
                 "shasum": ""
             },
             "require": {
                 "doctrine/annotations": "^1.8",
                 "doctrine/cache": "^1.9.1",
                 "doctrine/collections": "^1.5",
-                "doctrine/common": "^2.11",
+                "doctrine/common": "^2.11 || ^3.0",
                 "doctrine/dbal": "^2.9.3",
                 "doctrine/event-manager": "^1.1",
+                "doctrine/inflector": "^1.0",
                 "doctrine/instantiator": "^1.3",
-                "doctrine/persistence": "^1.2",
+                "doctrine/lexer": "^1.0",
+                "doctrine/persistence": "^1.3.3 || ^2.0",
                 "ext-pdo": "*",
                 "ocramius/package-versions": "^1.2",
                 "php": "^7.1",
@@ -706,8 +696,10 @@
             },
             "require-dev": {
                 "doctrine/coding-standard": "^5.0",
+                "phpstan/phpstan": "^0.12.18",
                 "phpunit/phpunit": "^7.5",
-                "symfony/yaml": "^3.4|^4.0|^5.0"
+                "symfony/yaml": "^3.4|^4.0|^5.0",
+                "vimeo/psalm": "^3.11"
             },
             "suggest": {
                 "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
@@ -758,20 +750,20 @@
                 "database",
                 "orm"
             ],
-            "time": "2020-03-19T06:41:02+00:00"
+            "time": "2020-05-26T16:03:49+00:00"
         },
         {
             "name": "doctrine/persistence",
-            "version": "1.3.7",
+            "version": "2.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/persistence.git",
-                "reference": "0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0"
+                "reference": "1dee036f22cd5dc0bc12132f1d1c38415907be55"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/persistence/zipball/0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0",
-                "reference": "0af483f91bada1c9ded6c2cfd26ab7d5ab2094e0",
+                "url": "https://api.github.com/repos/doctrine/persistence/zipball/1dee036f22cd5dc0bc12132f1d1c38415907be55",
+                "reference": "1dee036f22cd5dc0bc12132f1d1c38415907be55",
                 "shasum": ""
             },
             "require": {
@@ -788,12 +780,13 @@
             "require-dev": {
                 "doctrine/coding-standard": "^6.0",
                 "phpstan/phpstan": "^0.11",
-                "phpunit/phpunit": "^7.0"
+                "phpunit/phpunit": "^7.0",
+                "vimeo/psalm": "^3.11"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.3.x-dev"
+                    "dev-master": "2.x-dev"
                 }
             },
             "autoload": {
@@ -841,7 +834,7 @@
                 "orm",
                 "persistence"
             ],
-            "time": "2020-03-21T15:13:52+00:00"
+            "time": "2020-05-12T19:32:44+00:00"
         },
         {
             "name": "doctrine/reflection",
@@ -921,6 +914,58 @@
             ],
             "time": "2020-03-27T11:06:43+00:00"
         },
+        {
+            "name": "graham-campbell/result-type",
+            "version": "v1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/GrahamCampbell/Result-Type.git",
+                "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb",
+                "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.0|^8.0",
+                "phpoption/phpoption": "^1.7.3"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "GrahamCampbell\\ResultType\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Graham Campbell",
+                    "email": "graham@alt-three.com"
+                }
+            ],
+            "description": "An Implementation Of The Result Type",
+            "keywords": [
+                "Graham Campbell",
+                "GrahamCampbell",
+                "Result Type",
+                "Result-Type",
+                "result"
+            ],
+            "time": "2020-04-13T13:17:36+00:00"
+        },
         {
             "name": "ocramius/package-versions",
             "version": "1.2.0",
@@ -1135,16 +1180,16 @@
         },
         {
             "name": "phpoption/phpoption",
-            "version": "1.7.3",
+            "version": "1.7.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/schmittjoh/php-option.git",
-                "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae"
+                "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
-                "reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
+                "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3",
+                "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3",
                 "shasum": ""
             },
             "require": {
@@ -1186,7 +1231,7 @@
                 "php",
                 "type"
             ],
-            "time": "2020-03-21T18:07:53+00:00"
+            "time": "2020-06-07T10:40:07+00:00"
         },
         {
             "name": "phpseclib/phpseclib",
@@ -1448,21 +1493,22 @@
         },
         {
             "name": "symfony/debug",
-            "version": "v4.4.8",
+            "version": "v4.4.9",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/debug.git",
-                "reference": "346636d2cae417992ecfd761979b2ab98b339a45"
+                "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/debug/zipball/346636d2cae417992ecfd761979b2ab98b339a45",
-                "reference": "346636d2cae417992ecfd761979b2ab98b339a45",
+                "url": "https://api.github.com/repos/symfony/debug/zipball/28f92d08bb6d1fddf8158e02c194ad43870007e6",
+                "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6",
                 "shasum": ""
             },
             "require": {
-                "php": "^7.1.3",
-                "psr/log": "~1.0"
+                "php": ">=7.1.3",
+                "psr/log": "~1.0",
+                "symfony/polyfill-php80": "^1.15"
             },
             "conflict": {
                 "symfony/http-kernel": "<3.4"
@@ -1500,7 +1546,7 @@
             ],
             "description": "Symfony Debug Component",
             "homepage": "https://symfony.com",
-            "time": "2020-03-27T16:54:36+00:00"
+            "time": "2020-05-24T08:33:35+00:00"
         },
         {
             "name": "symfony/lock",
@@ -1740,6 +1786,68 @@
             ],
             "time": "2020-05-12T16:47:27+00:00"
         },
+        {
+            "name": "symfony/polyfill-php80",
+            "version": "v1.17.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill-php80.git",
+                "reference": "5e30b2799bc1ad68f7feb62b60a73743589438dd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/5e30b2799bc1ad68f7feb62b60a73743589438dd",
+                "reference": "5e30b2799bc1ad68f7feb62b60a73743589438dd",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.0.8"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.17-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Polyfill\\Php80\\": ""
+                },
+                "files": [
+                    "bootstrap.php"
+                ],
+                "classmap": [
+                    "Resources/stubs"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ion Bazan",
+                    "email": "ion.bazan@gmail.com"
+                },
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "p@tchwork.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compatibility",
+                "polyfill",
+                "portable",
+                "shim"
+            ],
+            "time": "2020-05-12T16:47:27+00:00"
+        },
         {
             "name": "symfony/process",
             "version": "v3.4.0",
@@ -1838,6 +1946,72 @@
             "description": "Symfony Yaml Component",
             "homepage": "https://symfony.com",
             "time": "2018-11-11T11:18:13+00:00"
+        },
+        {
+            "name": "vlucas/phpdotenv",
+            "version": "v5.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/vlucas/phpdotenv.git",
+                "reference": "fbb6a5f65512f21d0db9e21bd49e67f70a9bbd5e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/fbb6a5f65512f21d0db9e21bd49e67f70a9bbd5e",
+                "reference": "fbb6a5f65512f21d0db9e21bd49e67f70a9bbd5e",
+                "shasum": ""
+            },
+            "require": {
+                "ext-pcre": "*",
+                "graham-campbell/result-type": "^1.0.1",
+                "php": "^7.1.3 || ^8.0",
+                "phpoption/phpoption": "^1.7.4",
+                "symfony/polyfill-ctype": "^1.17",
+                "symfony/polyfill-mbstring": "^1.17",
+                "symfony/polyfill-php80": "^1.17"
+            },
+            "require-dev": {
+                "bamarni/composer-bin-plugin": "^1.4.1",
+                "ext-filter": "*",
+                "phpunit/phpunit": "^7.5.20 || ^8.5.2 || ^9.0"
+            },
+            "suggest": {
+                "ext-filter": "Required to use the boolean validator."
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "5.0-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Dotenv\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Graham Campbell",
+                    "email": "graham@alt-three.com",
+                    "homepage": "https://gjcampbell.co.uk/"
+                },
+                {
+                    "name": "Vance Lucas",
+                    "email": "vance@vancelucas.com",
+                    "homepage": "https://vancelucas.com/"
+                }
+            ],
+            "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
+            "keywords": [
+                "dotenv",
+                "env",
+                "environment"
+            ],
+            "time": "2020-06-07T19:04:14+00:00"
         }
     ],
     "packages-dev": [],

+ 4 - 4
src/App/Helper/RedisHelper.php

@@ -62,8 +62,8 @@ class RedisHelper
 
     public static function lock($flag)
     {
-        $redisConnection = "tcp://redis:6379";
-        $redis = new Redis(array($redisConnection));
+        $modeConnect = $_ENV['DEV_MODE'] ? array("tcp://172.16.0.7:6379") : array("tcp://redis:6379");
+        $redis = new Redis(array($modeConnect));
         $redis->connect();
 
         $store = new RedisStore($redis);
@@ -89,8 +89,8 @@ class RedisHelper
 
     public static function removeLock($flag)
     {
-        $redisConnection = "tcp://redis:6379";
-        $redis = new Redis(array($redisConnection));
+        $modeConnect = $_ENV['DEV_MODE'] ? array("tcp://172.16.0.7:6379") : array("tcp://redis:6379");
+        $redis = new Redis(array($modeConnect));
         $redis->connect();
 
         $store = new RedisStore($redis);

+ 72 - 42
src/App/Service/Huawei/HuaweiService.php

@@ -82,53 +82,42 @@ class HuaweiService
     public function searchNumberSerialAndSaveCache($keyOltScan, $keyOltScanPon){
         $startCmd = microtime(true);
 
-        $serialNumbersCached = $this->redisHelper->getData($keyOltScan);
-
-        if(empty($serialNumbersCached)){
-            $ponsCached = $this->redisHelper->getData($keyOltScanPon, true);
-            $serialNumberCache = [];
-            $countOnus = 0;
-            $current_charset = "ISO-8859-15//IGNORE";
-
-            $serialNumbers = $this->snmpService->getSNMP($this->snmpLibrary,"onuSerialNumber", "onuScan", $this->output);
-            foreach ($serialNumbers as $index => $hexSerialNumber) {
-                if (strlen($hexSerialNumber) != 16) continue;
-                $vendoId = OnuHelper::hex2str(substr($hexSerialNumber, 0, 8));
-                $rest = substr($hexSerialNumber, 8);
-
-                $sn = strtolower($vendoId . $rest);
-
-                $portOnu = explode(".", $index);
-                if (count($portOnu) != 2) continue;
-                $portIndex = $portOnu[0];
-                $onuId = $portOnu[1];
-                $countOnus++;
-
-                if (isset($ponsCached[$portIndex])) {
-                    $p = $ponsCached[$portIndex];
-
-                    $data = $p;
-                    $data['onuId'] = $onuId;
-                    $data['serialNumber'] = iconv("UTF-8", $current_charset, $sn);
-                    $data['hexaSerialNumber'] = iconv("UTF-8", $current_charset, $hexSerialNumber);
-                    $data['ponport'] = "{$p['ponPort']}/{$onuId}";
-                    $serialNumberCache[$index] = $data;
-                }
+        $ponsCached = $this->redisHelper->getData($keyOltScanPon, true);
+        $serialNumberCache = [];
+        $countOnus = 0;
+        $current_charset = "ISO-8859-15//IGNORE";
+
+        $serialNumbers = $this->snmpService->getSNMP($this->snmpLibrary,"onuSerialNumber", "onuScan", $this->output);
+        foreach ($serialNumbers as $index => $hexSerialNumber) {
+            if (strlen($hexSerialNumber) != 16) continue;
+            $vendoId = OnuHelper::hex2str(substr($hexSerialNumber, 0, 8));
+            $rest = substr($hexSerialNumber, 8);
+
+            $sn = strtolower($vendoId . $rest);
+
+            $portOnu = explode(".", $index);
+            if (count($portOnu) != 2) continue;
+            $portIndex = $portOnu[0];
+            $onuId = $portOnu[1];
+            $countOnus++;
+
+            if (isset($ponsCached[$portIndex])) {
+                $p = $ponsCached[$portIndex];
+
+                $data = $p;
+                $data['onuId'] = $onuId;
+                $data['serialNumber'] = iconv("UTF-8", $current_charset, $sn);
+                $data['hexaSerialNumber'] = iconv("UTF-8", $current_charset, $hexSerialNumber);
+                $data['ponport'] = "{$p['ponPort']}/{$onuId}";
+                $serialNumberCache[$index] = $data;
             }
-
-            $this->redisHelper->setData($keyOltScan, $serialNumberCache, true);
-
-            $endCmd = microtime(true);
-            $time = $endCmd - $startCmd;
-            $this->output->writeln("Tiempo: $time segundos / Cantidad ONUs: {$countOnus}");
-
-            return $this;
         }
 
+        $this->redisHelper->setData($keyOltScan, $serialNumberCache, true);
+
         $endCmd = microtime(true);
         $time = $endCmd - $startCmd;
-        $countOnusCached = count($serialNumbersCached);
-        $this->output->writeln("Tiempo: $time segundos / Cantidad ONUs: {$countOnusCached}");
+        $this->output->writeln("Tiempo: $time segundos / Cantidad ONUs: {$countOnus}");
 
         return $this;
     }
@@ -194,6 +183,45 @@ class HuaweiService
         $endCmd = microtime(true);
         $time = $endCmd - $startCmd;
         $this->output->writeln("Tiempo: $time segundos");
+
+        return $this;
+    }
+
+    public function searchOnuStatusAndSave($keyOltScan, $subId){
+        $serialNumberCache = $this->redisHelper->getData($keyOltScan, true);
+        $txPower = $this->snmpService->getSNMP($this->snmpLibrary, "onuPonTxOpticalPower", "onuTxPower", $this->output);
+        $sendData = [];
+        $stats = [];
+
+        foreach($serialNumberCache as $index => $onu){
+            $sn = strtolower($onu['serialNumber']);
+
+            if (isset($txPower[$index]) && !empty($txPower[$index])) {
+                $metricName = "onu_status_";
+                $metric = "{$metricName}{$sn}";
+
+                ($txPower[$index] == 2147483647)
+                    ? $v = 0
+                    : $v = 1;
+
+                $sendData[$metric] = "{$v}|g";
+                $stats[$metricName][$sn] = $v;
+            }
+        }
+
+        foreach ($stats as $metric => $data) {
+            $key_onu_stats = "{$metric}{$subId}";
+
+            $this->redisHelper->setData($key_onu_stats, $data, true);
+        }
+
+        if ($sendData) {
+            $t_start_script = microtime(true);
+            (new StatsDService())->send($sendData);
+            $t_end_script = microtime(true);
+            $time = $t_end_script - $t_start_script;
+            print_r("Tiempo de envío al StatsD: {$time} ms / Cantidad: " . count($sendData) . PHP_EOL);
+        }
     }
 
     public function searchOltMemoryAndCpu($keyOltScanCard){
@@ -291,6 +319,8 @@ class HuaweiService
             $time = $endCmd - $startCmd;
             $this->output->writeln("Tiempo: $time segundos");
         }
+
+        return $this;
     }
 
     private function saveConsumption($data)

+ 2 - 1
src/App/Service/Redis/RedisService.php

@@ -19,7 +19,8 @@ class RedisService implements CollectorInterface
      */
     public function __construct()
     {
-        $this->redis = new Redis(array("tcp://redis:6379"));
+        $modeConnect = $_ENV['DEV_MODE'] ? array("tcp://172.16.0.7:6379") : array("tcp://redis:6379");
+        $this->redis = new Redis($modeConnect);
     }
 
     /**

+ 2 - 1
src/App/Service/StatsD/StatsDService.php

@@ -9,9 +9,10 @@ use Exception;
 class StatsDService
 {
     public function __construct(){
+        $hostConnection = $_ENV['DEV_MODE'] ? '172.16.0.25' : 'statsd';
         $this->config = array();
         $this->config["enabled"] = true;
-        $this->config["host"] = 'statsd';
+        $this->config["host"] = $hostConnection;
         $this->config["port"] = 8125;
     }
 

+ 4 - 1
src/Command/Huawei/HuaweiOltScanCommand.php

@@ -42,12 +42,15 @@ class HuaweiOltScanCommand extends BaseCommand
         $keyOltScanCard = "olt_scan_card_{$this->d_s}";
         $keyOltScanPons = "olt_scan_pons_{$this->d_s}";
         $keyPonStats = "olt_stats_pons_{$this->d_s}";
+        $keyOltScan = "olt_scan_{$this->d_s}";
         $huaweiService = new HuaweiService($SNMP->$library(), $output, $this->flag);
 
         $huaweiService
             ->searchOltMemoryAndCpu($keyOltScanCard)
             ->searchPonAndSaveCache($keyOltScanPons)
-            ->searchInformationsAboutOltAndSave($keyOltScanPons, $keyPonStats, $this->d_s, $saveHistoric);
+            ->searchInformationsAboutOltAndSave($keyOltScanPons, $keyPonStats, $this->d_s, $saveHistoric)
+            ->searchNumberSerialAndSaveCache($keyOltScan, $keyOltScanPons)
+            ->searchOnuStatusAndSave($keyOltScan, $this->d_s);
 
         $statsService = new StatsService();
         $statsService->updateStatsPon($this->oltDeviceId, $this->oltServerId);

+ 4 - 3
src/Domain/Doctrine.php

@@ -19,12 +19,13 @@ class Doctrine
     {
         $config = Setup::createAnnotationMetadataConfiguration([__DIR__."/src"], getenv('DEV_MODE'));
 
+        $hostConnect = $_ENV['DEV_MODE'] ? '172.16.0.4' : 'mysql';
         $connectionOptions = array(
             'driver'   => 'pdo_mysql',
-            'host'     => 'mysql',
+            'host'     => $hostConnect,
             'dbname'   => 'fd3_stats',
-            'user'     => getenv('MYSQL_USER'),
-            'password' => getenv('MYSQL_PASSWORD')
+            'user'     => $_ENV['DEV_MODE'] ? $_ENV['USER_MYSQL'] : getenv('MYSQL_USER'),
+            'password' => $_ENV['DEV_MODE'] ? $_ENV['PASSWORD_MYSQL'] : getenv('MYSQL_PASSWORD')
         );
 
         try {