fiberhome: add remove onu option
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
cccd68b3b0
commit
5201f8823c
3 files changed
+131
-62
No files matched your search
@@ -0,0 +1,69 @@
|
|||||||
|
# Informações sobre RX Power em ONUs FiberHome
|
||||||
|
|
||||||
|
## Problema Identificado
|
||||||
|
|
||||||
|
O comando TL1 `LST-OMDDM` retorna valores de potência **medidos pela OLT**, não pela ONU:
|
||||||
|
|
||||||
|
```
|
||||||
|
ONUID RxPower RxPowerR TxPower TxPowerR PTxPower PRxPower
|
||||||
|
-- -23,01 Normal 4,71 Normal -- --
|
||||||
|
```
|
||||||
|
|
||||||
|
### Campos Retornados:
|
||||||
|
|
||||||
|
- **RxPower**: -23,01 dBm - Sinal que a **OLT recebe** da ONU (uplink)
|
||||||
|
- **TxPower**: 4,71 dBm - Potência de **transmissão da OLT** (não é sinal recebido!)
|
||||||
|
- **PTxPower**: -- (vazio) - Deveria ser potência transmitida pela ONU
|
||||||
|
- **PRxPower**: -- (vazio) - Deveria ser potência recebida pela ONU
|
||||||
|
|
||||||
|
## Diferença com o UNM2000
|
||||||
|
|
||||||
|
O UNM2000 mostra **-20.22 dBm**, mas o TL1 retorna **-23,01 dBm**.
|
||||||
|
|
||||||
|
### Possíveis Causas:
|
||||||
|
|
||||||
|
1. **UNM2000 usa OMCI diretamente**: O sistema de gestão pode acessar a ONU via protocolo OMCI (ONT Management and Control Interface), obtendo valores medidos pela própria ONU
|
||||||
|
|
||||||
|
2. **Comando TL1 diferente**: O UNM2000 pode usar um comando proprietário ou extensão do TL1 não documentada no manual
|
||||||
|
|
||||||
|
3. **Cálculo/compensação**: Pode haver algum cálculo de compensação de atenuação
|
||||||
|
|
||||||
|
## Solução Implementada
|
||||||
|
|
||||||
|
O bot agora mostra o **RxPower** (-23,01 dBm) que é o único valor confiável disponível via TL1, com a indicação de que é medido pela OLT:
|
||||||
|
|
||||||
|
```
|
||||||
|
📡 RX Power: -23.01 dBm (uplink)
|
||||||
|
💡 Valores medidos pela OLT via protocolo TL1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Comandos TL1 Testados
|
||||||
|
|
||||||
|
- ✅ **LST-OMDDM**: Retorna potências medidas pela OLT
|
||||||
|
- ✅ **LST-ONUSTATE**: Apenas status (UP/DOWN)
|
||||||
|
- ✅ **LST-ONUCFG**: Apenas configuração e distância
|
||||||
|
- ✅ **LST-PONPERF**: Apenas estatísticas de pacotes
|
||||||
|
|
||||||
|
## Notas Técnicas
|
||||||
|
|
||||||
|
### Significado dos Campos LST-OMDDM:
|
||||||
|
|
||||||
|
| Campo | Significado | Medido em |
|
||||||
|
|-------|-------------|-----------|
|
||||||
|
| RxPower | Sinal recebido ONU→OLT | OLT |
|
||||||
|
| TxPower | Potência transmitida OLT→ONU | OLT |
|
||||||
|
| PTxPower | Potência transmitida ONU→OLT | ONU (vazio via TL1) |
|
||||||
|
| PRxPower | Sinal recebido OLT→ONU | ONU (vazio via TL1) |
|
||||||
|
|
||||||
|
### Interpretação:
|
||||||
|
|
||||||
|
- **RxPower da OLT** = **TX Power da ONU** (mesmo sinal, medido na chegada)
|
||||||
|
- Para obter o sinal que a ONU recebe, seria necessário acesso OMCI ou comando específico
|
||||||
|
|
||||||
|
## Recomendação
|
||||||
|
|
||||||
|
Para obter valores idênticos ao UNM2000, seria necessário:
|
||||||
|
|
||||||
|
1. Acesso direto à ONU via OMCI
|
||||||
|
2. Documentação adicional de comandos TL1 proprietários
|
||||||
|
3. Ou usar diretamente a API do UNM2000 se disponível
|
||||||
+4
-1
@@ -1752,10 +1752,13 @@ Digite /help para ver todos os comandos disponíveis!
|
|||||||
message += `🔌 *Status:* ${resultado.online ? '🟢 Online' : '🔴 Offline'}\n\n`;
|
message += `🔌 *Status:* ${resultado.online ? '🟢 Online' : '🔴 Offline'}\n\n`;
|
||||||
|
|
||||||
message += `📊 *Informações do Sinal:*\n`;
|
message += `📊 *Informações do Sinal:*\n`;
|
||||||
message += `📡 *RX Power:* ${resultado.rxPower}\n`;
|
message += `📡 *RX Power:* ${resultado.rxPower} _(uplink)_\n`;
|
||||||
message += `📤 *TX Power:* ${resultado.txPower}\n`;
|
message += `📤 *TX Power:* ${resultado.txPower}\n`;
|
||||||
message += `📏 *Distância:* ${resultado.distance}\n\n`;
|
message += `📏 *Distância:* ${resultado.distance}\n\n`;
|
||||||
|
|
||||||
|
// Nota sobre leitura de potência
|
||||||
|
message += `_💡 Valores medidos pela OLT via protocolo TL1_\n\n`;
|
||||||
|
|
||||||
// Status das portas Ethernet (resumido)
|
// Status das portas Ethernet (resumido)
|
||||||
if (resultado.portasEthernet.length > 0) {
|
if (resultado.portasEthernet.length > 0) {
|
||||||
const portasAtivas = resultado.portasEthernet.filter(p => p.status === 'active' || p.status === 'up').length;
|
const portasAtivas = resultado.portasEthernet.filter(p => p.status === 'active' || p.status === 'up').length;
|
||||||
|
|||||||
+58
-61
@@ -401,6 +401,25 @@ class FiberhomeManager {
|
|||||||
this.executarComandoTL1(comandosDetalhados[2])
|
this.executarComandoTL1(comandosDetalhados[2])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// LOG COMPLETO DO LST-OMDDM PARA DEBUG - FORÇAR CONSOLE OUTPUT
|
||||||
|
if (resultadoDDM.success && resultadoDDM.data) {
|
||||||
|
const separador = '='.repeat(80);
|
||||||
|
console.log('\n' + separador);
|
||||||
|
console.log('LST-OMDDM RESPOSTA COMPLETA');
|
||||||
|
console.log(separador);
|
||||||
|
console.log('Comando: ' + comandosDetalhados[1]);
|
||||||
|
console.log('Resposta RAW:');
|
||||||
|
console.log(resultadoDDM.data);
|
||||||
|
console.log(separador + '\n');
|
||||||
|
|
||||||
|
// Verificar se é resposta válida de DDM
|
||||||
|
if (!resultadoDDM.data.includes('RxPower') && !resultadoDDM.data.includes('Optical Power')) {
|
||||||
|
console.log('⚠️ ATENÇÃO: LST-OMDDM retornou formato inesperado!');
|
||||||
|
console.log('⚠️ Resposta parece ser lista de ONUs ao invés de dados DDM');
|
||||||
|
console.log('⚠️ Verifique se o comando está correto para esta versão do equipamento');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Adicionar dados coletados
|
// Adicionar dados coletados
|
||||||
onuEncontrada.estadoGeral = resultadoEstado.success ? resultadoEstado.data : null;
|
onuEncontrada.estadoGeral = resultadoEstado.success ? resultadoEstado.data : null;
|
||||||
onuEncontrada.detalhes = resultadoDDM.success ? resultadoDDM.data : null;
|
onuEncontrada.detalhes = resultadoDDM.success ? resultadoDDM.data : null;
|
||||||
@@ -663,76 +682,54 @@ class FiberhomeManager {
|
|||||||
|
|
||||||
// Processar LST-OMDDM (potência ótica)
|
// Processar LST-OMDDM (potência ótica)
|
||||||
if (resposta.comando && resposta.comando.includes('LST-OMDDM')) {
|
if (resposta.comando && resposta.comando.includes('LST-OMDDM')) {
|
||||||
this.logger.debug('🔍 Processando LST-OMDDM - Resposta completa:', dados);
|
// Verificar se a resposta é válida (deve conter "Optical Power" ou campos de potência)
|
||||||
|
if (!dados.includes('RxPower') && !dados.includes('Optical Power')) {
|
||||||
|
this.logger.warn('⚠️ LST-OMDDM retornou formato inesperado, pulando...');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Buscar pela tabela de potência ótica no formato do manual TL1
|
// Encontrar o índice da linha do header
|
||||||
// Formato: ONUID RxPower RxPowerR TxPower TxPowerR CurrTxBias CurrTxBiasR
|
const linhas = dados.split('\n');
|
||||||
// Temperature TemperatureR Voltage VoltageR PTxPower PRxPower
|
const headerIndex = linhas.findIndex(l => l.includes('ONUID') && l.includes('RxPower'));
|
||||||
const linhasTabela = dados.split('\n').filter(linha =>
|
|
||||||
linha.includes('\t') &&
|
if (headerIndex === -1) {
|
||||||
!linha.includes('ONUID\tRxPower') && // header
|
this.logger.warn('⚠️ Header ONUID/RxPower não encontrado');
|
||||||
!linha.includes('ONUID RxPower') && // header sem tabs
|
continue;
|
||||||
!linha.includes('---') && // separador
|
}
|
||||||
linha.match(/[+-]?\d+[,.]?\d*/) // linha com dados
|
|
||||||
|
// Pegar as linhas APÓS o header que contenham dados válidos
|
||||||
|
const linhasDados = linhas.slice(headerIndex + 1).filter(linha =>
|
||||||
|
linha.trim() &&
|
||||||
|
!linha.includes('---') &&
|
||||||
|
linha.match(/[+-]?\d+[,.]?\d+/) && // Deve ter pelo menos um número decimal
|
||||||
|
!linha.includes('FH_') && // Não é cabeçalho da resposta
|
||||||
|
!linha.includes('COMPLD') && // Não é status
|
||||||
|
!linha.includes('total_blocks') // Não é metadado
|
||||||
);
|
);
|
||||||
|
|
||||||
this.logger.debug(`📋 Linhas de dados encontradas: ${linhasTabela.length}`);
|
this.logger.debug(`📋 LST-OMDDM: ${linhasDados.length} linhas de dados encontradas`);
|
||||||
if (linhasTabela.length > 0) {
|
|
||||||
this.logger.debug('📄 Primeira linha de dados:', linhasTabela[0]);
|
|
||||||
|
|
||||||
const campos = linhasTabela[0].split('\t');
|
if (linhasDados.length > 0) {
|
||||||
this.logger.debug(`📊 Total de campos: ${campos.length}`);
|
// Split por múltiplos espaços ou tabs
|
||||||
|
const campos = linhasDados[0].split(/\s+/).filter(c => c);
|
||||||
|
this.logger.debug(`📊 LST-OMDDM ${campos.length} campos: [${campos.join('] [')}]`);
|
||||||
|
|
||||||
// Log de TODOS os campos para debug
|
// Formato: ONUID RxPower RxPowerR TxPower TxPowerR CurrTxBias CurrTxBiasR
|
||||||
campos.forEach((campo, idx) => {
|
// Temperature TemperatureR Voltage VoltageR PTxPower PRxPower
|
||||||
this.logger.debug(` Campo [${idx}]: "${campo}"`);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Extrair todos os valores possíveis
|
// RxPower = sinal que a OLT recebe da ONU (uplink) - campo 1
|
||||||
const valores = {
|
const rxPower = campos[1]?.replace(',', '.').trim();
|
||||||
onuId: campos[0]?.trim(),
|
// TxPower = potência transmitida pela OLT - campo 3
|
||||||
rxPower: campos[1]?.replace(',', '.').trim(), // OLT recebe da ONU
|
const txPower = campos[3]?.replace(',', '.').trim();
|
||||||
rxPowerR: campos[2]?.trim(),
|
|
||||||
txPower: campos[3]?.replace(',', '.').trim(), // OLT transmite
|
|
||||||
txPowerR: campos[4]?.trim(),
|
|
||||||
currTxBias: campos[5]?.replace(',', '.').trim(),
|
|
||||||
currTxBiasR: campos[6]?.trim(),
|
|
||||||
temperature: campos[7]?.replace(',', '.').trim(),
|
|
||||||
temperatureR: campos[8]?.trim(),
|
|
||||||
voltage: campos[9]?.replace(',', '.').trim(),
|
|
||||||
voltageR: campos[10]?.trim(),
|
|
||||||
ptxPower: campos[11]?.replace(',', '.').trim(), // ONU transmite
|
|
||||||
prxPower: campos[12]?.replace(',', '.').trim() // ONU recebe
|
|
||||||
};
|
|
||||||
|
|
||||||
this.logger.debug('📡 Valores de potência extraídos:', {
|
if (rxPower && rxPower !== '--' && !isNaN(parseFloat(rxPower))) {
|
||||||
'RxPower (OLT recebe)': valores.rxPower,
|
resultado.rxPower = `${rxPower} dBm`;
|
||||||
'TxPower (OLT transmite)': valores.txPower,
|
this.logger.info(`✅ RX Power: ${rxPower} dBm`);
|
||||||
'PTxPower (ONU transmite)': valores.ptxPower,
|
|
||||||
'PRxPower (ONU recebe)': valores.prxPower
|
|
||||||
});
|
|
||||||
|
|
||||||
// TESTE: Usar TxPower da OLT como RX da ONU (pode ser o correto!)
|
|
||||||
// TxPower da OLT = sinal que sai da OLT = sinal que chega na ONU
|
|
||||||
if (valores.txPower && valores.txPower !== '--' && !isNaN(parseFloat(valores.txPower))) {
|
|
||||||
resultado.rxPower = `${valores.txPower} dBm`;
|
|
||||||
this.logger.info(`✅ RX Power da ONU (TxPower da OLT): ${valores.txPower} dBm`);
|
|
||||||
} else if (valores.prxPower && valores.prxPower !== '--' && !isNaN(parseFloat(valores.prxPower))) {
|
|
||||||
resultado.rxPower = `${valores.prxPower} dBm`;
|
|
||||||
this.logger.info(`✅ RX Power da ONU (PRxPower): ${valores.prxPower} dBm`);
|
|
||||||
} else if (valores.rxPower && valores.rxPower !== '--' && !isNaN(parseFloat(valores.rxPower))) {
|
|
||||||
resultado.rxPower = `${valores.rxPower} dBm`;
|
|
||||||
this.logger.info(`⚠️ RX Power (RxPower da OLT - fallback): ${valores.rxPower} dBm`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TX Power: usar PTxPower (ONU transmite para OLT)
|
if (txPower && txPower !== '--' && !isNaN(parseFloat(txPower))) {
|
||||||
if (valores.ptxPower && valores.ptxPower !== '--' && !isNaN(parseFloat(valores.ptxPower))) {
|
resultado.txPower = `${txPower} dBm`;
|
||||||
resultado.txPower = `${valores.ptxPower} dBm`;
|
this.logger.info(`✅ TX Power: ${txPower} dBm`);
|
||||||
this.logger.info(`✅ TX Power da ONU (PTxPower): ${valores.ptxPower} dBm`);
|
|
||||||
} else if (valores.rxPower && valores.rxPower !== '--' && !isNaN(parseFloat(valores.rxPower))) {
|
|
||||||
// RxPower na OLT = TxPower na ONU (é o mesmo sinal)
|
|
||||||
resultado.txPower = `${valores.rxPower} dBm`;
|
|
||||||
this.logger.info(`✅ TX Power da ONU (RxPower da OLT): ${valores.rxPower} dBm`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user