92 lines
3.9 KiB
JavaScript
92 lines
3.9 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
|
|
* Nova Hipótese: UNM2000 mostra TxPower da OLT (que é o sinal recebido pela ONU)
|
|
*/
|
|
|
|
// 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 -20.22 Normal 15.80 Normal 62.37 Normal 3.40 Normal 1.85 -19.50
|
|
-----------------------------------------------------------
|
|
`;
|
|
|
|
console.log('🧪 Teste de Extração do RX Power - NOVA HIPÓTESE\n');
|
|
console.log('=' .repeat(70));
|
|
|
|
// Processar resposta
|
|
const linhasTabela = respostaSimulada.split('\n').filter(linha =>
|
|
linha.includes('\t') &&
|
|
!linha.includes('ONUID\tRxPower') &&
|
|
!linha.includes('ONUID RxPower') &&
|
|
!linha.includes('---') &&
|
|
linha.match(/[+-]?\d+[,.]?\d*/)
|
|
);
|
|
|
|
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) => {
|
|
const nomes = ['ONUID', 'RxPower', 'RxPowerR', 'TxPower', 'TxPowerR',
|
|
'CurrTxBias', 'CurrTxBiasR', 'Temperature', 'TemperatureR',
|
|
'Voltage', 'VoltageR', 'PTxPower', 'PRxPower'];
|
|
console.log(` [${idx}] ${nomes[idx]?.padEnd(15)}: "${campo}"`);
|
|
});
|
|
|
|
// Extrair valores
|
|
const valores = {
|
|
rxPower: campos[1]?.replace(',', '.').trim(), // OLT recebe da ONU
|
|
txPower: campos[3]?.replace(',', '.').trim(), // OLT transmite para ONU ⭐
|
|
ptxPower: campos[11]?.replace(',', '.').trim(), // ONU transmite para OLT
|
|
prxPower: campos[12]?.replace(',', '.').trim() // ONU recebe da OLT
|
|
};
|
|
|
|
console.log('\n' + '='.repeat(70));
|
|
console.log('📡 ANÁLISE DOS VALORES:');
|
|
console.log('='.repeat(70));
|
|
|
|
console.log(`\n🔴 Bot estava usando (ERRADO):`);
|
|
console.log(` RxPower = ${valores.rxPower} dBm (sinal que OLT recebe da ONU)`);
|
|
|
|
console.log(`\n🟡 Tentativa anterior (ainda errado):`);
|
|
console.log(` PRxPower = ${valores.prxPower} dBm (sinal que ONU recebe da OLT)`);
|
|
|
|
console.log(`\n🟢 NOVA HIPÓTESE (pode ser o correto!):`);
|
|
console.log(` TxPower = ${valores.txPower} dBm ⭐ (sinal que OLT transmite = ONU recebe)`);
|
|
|
|
console.log('\n' + '='.repeat(70));
|
|
console.log('✅ COMPARAÇÃO:');
|
|
console.log('='.repeat(70));
|
|
console.log(`UNM2000 mostra: -20.22 dBm`);
|
|
console.log(`TxPower (campo 3): ${valores.txPower} dBm ${valores.txPower === '-20.22' ? '✅ MATCH!' : '❌'}`);
|
|
console.log(`PRxPower (campo 12): ${valores.prxPower} dBm ${valores.prxPower === '-20.22' ? '✅ MATCH!' : '❌'}`);
|
|
console.log(`RxPower (campo 1): ${valores.rxPower} dBm ${valores.rxPower === '-20.22' ? '✅ MATCH!' : '❌'}`);
|
|
|
|
console.log('\n' + '='.repeat(70));
|
|
console.log('📖 INTERPRETAÇÃO:');
|
|
console.log('='.repeat(70));
|
|
console.log('Campo | Significado | Quem mede');
|
|
console.log('------------|--------------------------------------|------------------');
|
|
console.log('RxPower | Potência recebida (ONU→OLT) | Medido na OLT');
|
|
console.log('TxPower ⭐ | Potência transmitida (OLT→ONU) | Medido na OLT');
|
|
console.log('PTxPower | Potência transmitida (ONU→OLT) | Medido na ONU');
|
|
console.log('PRxPower | Potência recebida (OLT→ONU) | Medido na ONU');
|
|
console.log('\n💡 TxPower da OLT é o sinal que a ONU RECEBE da OLT!');
|
|
|
|
} else {
|
|
console.log('❌ Nenhuma linha de dados encontrada');
|
|
}
|
|
|
|
console.log('\n' + '='.repeat(70));
|