123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace Flowdat\Stats\Command\Huawei;
- use Flowdat\Stats\App\Service\Huawei\HuaweiService;
- use Flowdat\Stats\Command\Base\BaseCommand;
- use Flowdat\Stats\SNMP\Huawei\SNMP as SNMP;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Output\OutputInterface;
- class HuaweiOltScanCommand extends BaseCommand
- {
- protected function configure()
- {
- $this
- ->setName('huawei:olt:scan')
- ->setDescription('Escanear OLT para obtener ONUs')
- ->setHelp('Se requieren parámetros para poder realizar la correcta consulta. El comando requiere Redis.')
- ->setDefinition(array(
- new InputOption('olt-device-id', null, InputOption::VALUE_OPTIONAL, "DeviceId de la OLT",1),
- new InputOption('olt-server-id', null, InputOption::VALUE_OPTIONAL, "ServerDevice de la OLT",1),
- new InputOption('olt-ip', false, InputOption::VALUE_OPTIONAL, "IP de la OLT"),
- new InputOption('olt-community', false, InputOption::VALUE_OPTIONAL, "COMMUNITY de la OLT"),
- new InputOption('olt-snmp-library', false, InputOption::VALUE_OPTIONAL, "Versión de librería SNMP"),
- new InputOption('save-historic', null, InputOption::VALUE_OPTIONAL, "Send data to StatsD", 1)
- ));
- }
- public function execute(InputInterface $input, OutputInterface $output){
- parent::execute($input, $output);
- $saveHistoric = (int)$input->getOption('save-historic');
- /*Definir o SNMP*/
- $SNMP = new SNMP($this->oltIp, $this->oltCommunity);
- $library = "use".$this->oltSnmpLibrary;
- /*Definindo as Keys*/
- $keyOltScanCard = "olt_scan_card_{$this->d_s}";
- $keyOltScanPons = "olt_scan_pons_{$this->d_s}";
- $keyPonStats = "olt_stats_pons_{$this->d_s}";
- $huaweiService = new HuaweiService($SNMP->$library(), $output, $this->flag);
- $huaweiService
- ->searchOltMemoryAndCpu($keyOltScanCard)
- ->searchPonAndSaveCache($keyOltScanPons)
- ->searchInformationsAboutOltAndSave($keyOltScanPons, $keyPonStats, $this->d_s, $saveHistoric);
- }
- }
|