diagnostico: fix ethernet e Rx Power_p2

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-04-01 08:02:02 -03:00
1 parent c890a38587
commit 4d8fa3362c
1 file changed
+35 -44
+35 -44
View File
@@ -882,33 +882,28 @@ class FiberhomeManager {
} }
} }
// Extrair informações de potência se disponível na listagem // Extrair informações de potência se disponível na listagem (apenas como fallback)
const rxMatches = [ if (resultado.rxPower === 'N/A') {
dadosCompletos.match(/RX[=\s:]+([+-]?\d+\.?\d*)/gi), const rxMatches = [
dadosCompletos.match(/RXPOWER[=\s:]+([+-]?\d+\.?\d*)/gi) dadosCompletos.match(/RX[=\s:]+([+-]?\d+\.?\d*)/gi),
]; dadosCompletos.match(/RXPOWER[=\s:]+([+-]?\d+\.?\d*)/gi)
];
for (const matches of rxMatches) { for (const matches of rxMatches) {
if (matches && matches.length > 0) { if (matches && matches.length > 0) {
const match = matches[0].match(/([+-]?\d+\.?\d*)/); const match = matches[0].match(/([+-]?\d+\.?\d*)/);
if (match) { if (match) { resultado.rxPower = `${match[1]} dBm`; break; }
resultado.rxPower = `${match[1]} dBm`;
break;
} }
} }
} }
if (resultado.txPower === 'N/A') {
const txMatches = [ const txMatches = [
dadosCompletos.match(/TX[=\s:]+([+-]?\d+\.?\d*)/gi), dadosCompletos.match(/TX[=\s:]+([+-]?\d+\.?\d*)/gi),
dadosCompletos.match(/TXPOWER[=\s:]+([+-]?\d+\.?\d*)/gi) dadosCompletos.match(/TXPOWER[=\s:]+([+-]?\d+\.?\d*)/gi)
]; ];
for (const matches of txMatches) {
for (const matches of txMatches) { if (matches && matches.length > 0) {
if (matches && matches.length > 0) { const match = matches[0].match(/([+-]?\d+\.?\d*)/);
const match = matches[0].match(/([+-]?\d+\.?\d*)/); if (match) { resultado.txPower = `${match[1]} dBm`; break; }
if (match) {
resultado.txPower = `${match[1]} dBm`;
break;
} }
} }
} }
@@ -918,29 +913,25 @@ class FiberhomeManager {
if (dadosONU.detalhes) { if (dadosONU.detalhes) {
this.logger.debug('Processando dados detalhados da ONU:', dadosONU.detalhes); this.logger.debug('Processando dados detalhados da ONU:', dadosONU.detalhes);
// Extrair RX Power // Extrair RX Power (apenas como fallback)
const rxMatches = [ if (resultado.rxPower === 'N/A') {
dadosONU.detalhes.match(/RXPOWER[=\s:]+([+-]?\d+\.?\d*)/i), const rxMatches = [
dadosONU.detalhes.match(/RX[=\s:]+([+-]?\d+\.?\d*)/i) dadosONU.detalhes.match(/RXPOWER[=\s:]+([+-]?\d+\.?\d*)/i),
]; dadosONU.detalhes.match(/RX[=\s:]+([+-]?\d+\.?\d*)/i)
];
for (const match of rxMatches) { for (const match of rxMatches) {
if (match) { if (match) { resultado.rxPower = `${match[1]} dBm`; break; }
resultado.rxPower = `${match[1]} dBm`;
break;
} }
} }
// Extrair TX Power // Extrair TX Power (apenas como fallback)
const txMatches = [ if (resultado.txPower === 'N/A') {
dadosONU.detalhes.match(/TXPOWER[=\s:]+([+-]?\d+\.?\d*)/i), const txMatches = [
dadosONU.detalhes.match(/TX[=\s:]+([+-]?\d+\.?\d*)/i) dadosONU.detalhes.match(/TXPOWER[=\s:]+([+-]?\d+\.?\d*)/i),
]; dadosONU.detalhes.match(/TX[=\s:]+([+-]?\d+\.?\d*)/i)
];
for (const match of txMatches) { for (const match of txMatches) {
if (match) { if (match) { resultado.txPower = `${match[1]} dBm`; break; }
resultado.txPower = `${match[1]} dBm`;
break;
} }
} }