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); } }