diagnostico: adicionar ver roteador
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
a3c69e7153
commit
63591000f0
1 file changed
+25
-2
+25
-2
@@ -1055,15 +1055,18 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
// Campo base/AP usado para rotear para a OLT correta
|
// Campo base/AP usado para rotear para a OLT correta
|
||||||
const baseInfo = servico.base || (servico.id_ap ? `AP ${servico.id_ap}` : null);
|
const baseInfo = servico.base || (servico.id_ap ? `AP ${servico.id_ap}` : null);
|
||||||
|
|
||||||
// Executar consultas em paralelo: Juniper + ONU
|
// Executar consultas em paralelo: Juniper + ONU + GenieACS (por TAG/login)
|
||||||
// No concentrador Juniper usa-se só o usuário (antes do @)
|
// No concentrador Juniper usa-se só o usuário (antes do @)
|
||||||
const pppoeUser = pppoeLogin ? pppoeLogin.split('@')[0] : null;
|
const pppoeUser = pppoeLogin ? pppoeLogin.split('@')[0] : null;
|
||||||
const [juniperResult, onuResult] = await Promise.all([
|
const [juniperResult, onuResult, genieResult] = await Promise.all([
|
||||||
pppoeUser
|
pppoeUser
|
||||||
? this.ssh.getJuniperSubscriberInfo('juniper', pppoeUser).catch(e => ({ success: false, error: e.message }))
|
? this.ssh.getJuniperSubscriberInfo('juniper', pppoeUser).catch(e => ({ success: false, error: e.message }))
|
||||||
: Promise.resolve({ success: false, skipped: true }),
|
: Promise.resolve({ success: false, skipped: true }),
|
||||||
serial
|
serial
|
||||||
? this._diagnosticarONU(serial, baseInfo).catch(e => ({ success: false, error: e.message }))
|
? this._diagnosticarONU(serial, baseInfo).catch(e => ({ success: false, error: e.message }))
|
||||||
|
: Promise.resolve({ success: false, skipped: true }),
|
||||||
|
pppoeLogin && this.genieacs.isReady()
|
||||||
|
? this.genieacs.buscarRoteador(pppoeLogin).catch(() => ({ success: false }))
|
||||||
: Promise.resolve({ success: false, skipped: true })
|
: Promise.resolve({ success: false, skipped: true })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -1122,6 +1125,26 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
|
|
||||||
await this.bot.sendMessage(chatId, msg, { parse_mode: 'Markdown' });
|
await this.bot.sendMessage(chatId, msg, { parse_mode: 'Markdown' });
|
||||||
|
|
||||||
|
// Bloco 4: Roteador/CPE via GenieACS (exibido apenas se encontrado pela TAG)
|
||||||
|
if (genieResult && genieResult.success) {
|
||||||
|
const esc = (v) => {
|
||||||
|
if (v === null || v === undefined || v === '') return 'N/A';
|
||||||
|
return String(v).replace(/[_*`\[]/g, '\\$&');
|
||||||
|
};
|
||||||
|
const d = genieResult.device;
|
||||||
|
const tagLabel = d.tags && d.tags.length > 0 ? d.tags.map(esc).join(', ') : null;
|
||||||
|
|
||||||
|
let msgCPE = `📡 *Roteador / CPE (GenieACS)*\n`;
|
||||||
|
msgCPE += ` 🖥️ Nome: ${esc(d.productClass)}\n`;
|
||||||
|
msgCPE += ` 🏭 Fabricante: ${esc(d.manufacturer)}\n`;
|
||||||
|
msgCPE += ` 🔧 SW: ${esc(d.softwareVersion)}\n`;
|
||||||
|
if (tagLabel) msgCPE += ` 🏷️ TAG: \`${tagLabel}\`\n`;
|
||||||
|
if (d.ssid24) msgCPE += ` 📶 SSID 2.4GHz: ${esc(d.ssid24)} (Canal ${esc(d.channel24)}, Auto: ${esc(d.autoChannel24)})\n`;
|
||||||
|
if (d.ssid5) msgCPE += ` 📶 SSID 5GHz: ${esc(d.ssid5)} (Canal ${esc(d.channel5)}, Auto: ${esc(d.autoChannel5)})\n`;
|
||||||
|
|
||||||
|
await this.bot.sendMessage(chatId, msgCPE, { parse_mode: 'Markdown' });
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Erro em runDiagnosticoServico:', error);
|
console.error('❌ Erro em runDiagnosticoServico:', error);
|
||||||
await this.bot.sendMessage(chatId, `❌ Erro no diagnóstico: ${error.message}`);
|
await this.bot.sendMessage(chatId, `❌ Erro no diagnóstico: ${error.message}`);
|
||||||
|
|||||||
Reference in new issue
Block a user