88 lines
3.6 KiB
JavaScript
88 lines
3.6 KiB
JavaScript
/**
|
|
* Teste para validar a correção do RX Power das ONUs FiberHome
|
|
*
|
|
* Problema: Bot mostrava -23.02 dBm, mas UNM2000 mostrava -20.22 dBm
|
|
* Causa: O bot estava usando RxPower (sinal na OLT) ao invés de PRxPower (sinal na ONU)
|
|
* Solução: Extrair PRxPower (coluna 12) do comando LST-OMDDM
|
|
*/
|
|
|
|
// Simular resposta do comando LST-OMDDM conforme o manual
|
|
const respostaSimulada = `
|
|
FH_10.78.20.120 2024-02-10 14:30:00
|
|
M CTAG COMPLD
|
|
total_blocks=1
|
|
block_number=1
|
|
block_records=1
|
|
|
|
List of Optical Power Info
|
|
----------------------------------------------------------
|
|
ONUID RxPower RxPowerR TxPower TxPowerR CurrTxBias CurrTxBiasR Temperature TemperatureR Voltage VoltageR PTxPower PRxPower
|
|
5 -23.02 Normal 1.76 Normal 15.80 Normal 62.37 Normal 3.40 Normal 1.85 -20.22
|
|
-----------------------------------------------------------
|
|
`;
|
|
|
|
console.log('🧪 Teste de Extração do RX Power Correto\n');
|
|
console.log('=' .repeat(60));
|
|
|
|
// Processar resposta
|
|
const linhasTabela = respostaSimulada.split('\n').filter(linha =>
|
|
linha.includes('\t') &&
|
|
!linha.includes('ONUID\tRxPower') && // header
|
|
linha.match(/[+-]?\d+[,.]?\d*/) // linha com dados
|
|
);
|
|
|
|
if (linhasTabela.length > 0) {
|
|
const campos = linhasTabela[0].split('\t');
|
|
|
|
console.log(`\n📊 Total de campos extraídos: ${campos.length}`);
|
|
console.log('\nCampos encontrados:');
|
|
campos.forEach((campo, idx) => {
|
|
console.log(` [${idx}]: "${campo}"`);
|
|
});
|
|
|
|
// Extrair valores conforme manual TL1
|
|
const onuId = campos[0]?.trim();
|
|
const rxPowerOlt = campos[1]?.replace(',', '.').trim(); // Sinal ONU → OLT (recebido pela OLT)
|
|
const rxPowerStatus = campos[2]?.trim();
|
|
const txPowerOlt = campos[3]?.replace(',', '.').trim(); // Sinal OLT → ONU (transmitido pela OLT)
|
|
const ptxPower = campos[11]?.replace(',', '.').trim(); // Sinal ONU → OLT (transmitido pela ONU)
|
|
const prxPower = campos[12]?.replace(',', '.').trim(); // Sinal OLT → ONU (recebido pela ONU) ⭐
|
|
|
|
console.log('\n' + '='.repeat(60));
|
|
console.log('📡 VALORES EXTRAÍDOS:');
|
|
console.log('='.repeat(60));
|
|
console.log(`ONU ID: ${onuId}`);
|
|
console.log(`\n🔴 ANTIGO (INCORRETO):`);
|
|
console.log(` RxPower (OLT recebe): ${rxPowerOlt} dBm - Status: ${rxPowerStatus}`);
|
|
console.log(` TxPower (OLT envia): ${txPowerOlt} dBm`);
|
|
|
|
console.log(`\n🟢 NOVO (CORRETO):`);
|
|
console.log(` PRxPower (ONU recebe): ${prxPower} dBm ⭐ <- Mostrado no UNM2000`);
|
|
console.log(` PTxPower (ONU envia): ${ptxPower} dBm`);
|
|
|
|
console.log('\n' + '='.repeat(60));
|
|
console.log('✅ RESULTADO ESPERADO:');
|
|
console.log('='.repeat(60));
|
|
console.log(`Bot deve mostrar: 📡 RX Power: ${prxPower} dBm`);
|
|
console.log(`UNM2000 mostra: 📡 RX Power: -20.22 dBm`);
|
|
console.log(`\n${prxPower === '-20.22' ? '✅ VALORES COMPATÍVEIS!' : '❌ VALORES DIFERENTES'}`);
|
|
|
|
} else {
|
|
console.log('❌ Nenhuma linha de dados encontrada');
|
|
}
|
|
|
|
console.log('\n' + '='.repeat(60));
|
|
console.log('📖 REFERÊNCIA DO MANUAL:');
|
|
console.log('='.repeat(60));
|
|
console.log('Comando: LST-OMDDM');
|
|
console.log('Formato de saída:');
|
|
console.log(' ONUID RxPower RxPowerR TxPower TxPowerR CurrTxBias CurrTxBiasR');
|
|
console.log(' Temperature TemperatureR Voltage VoltageR PTxPower PRxPower');
|
|
console.log('');
|
|
console.log('Campos importantes:');
|
|
console.log(' - RxPower: Potência recebida pela OLT (ONU → OLT)');
|
|
console.log(' - PRxPower: Potência recebida pela ONU (OLT → ONU) ⭐');
|
|
console.log(' - TxPower: Potência transmitida pela OLT (OLT → ONU)');
|
|
console.log(' - PTxPower: Potência transmitida pela ONU (ONU → OLT)');
|
|
console.log('='.repeat(60));
|