ipoe: fluxo adicionado fix_2
Signed-off-by: Rodrigo Martins <rodrigo@martinsevieira.adv.br>
This commit is contained in:
1 parent
a976a9fa58
commit
168b8d511d
1 file changed
+9
-7
@@ -910,12 +910,14 @@ class FiberhomeManager {
|
|||||||
const onuInfo = await this.buscarOnuRegistrada(serial);
|
const onuInfo = await this.buscarOnuRegistrada(serial);
|
||||||
|
|
||||||
const nameOlt = onuInfo.nameOlt || this.config.olt.name;
|
const nameOlt = onuInfo.nameOlt || this.config.olt.name;
|
||||||
const portAlias = onuInfo.portAlias;
|
// portAlias de buscarOnuRegistrada é "1-1-14-5" (frameId-slotId-slot-porta)
|
||||||
|
// Mas PONID precisa ser NA-NA-{slot}-{porta}, então usamos slot e porta separados
|
||||||
|
const ponId = `${onuInfo.slot}-${onuInfo.porta}`;
|
||||||
|
|
||||||
this.logger.info('ONU encontrada, consultando WAN Services existentes', { nameOlt, portAlias, serial });
|
this.logger.info('ONU encontrada, consultando WAN Services existentes', { nameOlt, ponId, serial });
|
||||||
|
|
||||||
// 1. Consultar WAN services existentes
|
// 1. Consultar WAN services existentes
|
||||||
const lstCmd = `LST-ONUWANSERVICECFG::OLTID=${nameOlt},PONID=NA-NA-${portAlias},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::;`;
|
const lstCmd = `LST-ONUWANSERVICECFG::OLTID=${nameOlt},PONID=NA-NA-${ponId},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::;`;
|
||||||
this.logger.debug('Consultando WAN Services', { comando: lstCmd });
|
this.logger.debug('Consultando WAN Services', { comando: lstCmd });
|
||||||
const lstResult = await this.executarComandoTL1(lstCmd);
|
const lstResult = await this.executarComandoTL1(lstCmd);
|
||||||
|
|
||||||
@@ -927,7 +929,7 @@ class FiberhomeManager {
|
|||||||
|
|
||||||
// 2. Deletar WAN services existentes
|
// 2. Deletar WAN services existentes
|
||||||
for (const ws of wanServices) {
|
for (const ws of wanServices) {
|
||||||
const delCmd = `SET-WANSERVICE::OLTID=${nameOlt},PONID=NA-NA-${portAlias},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::STATUS=2,MODE=${ws.mode},CONNTYPE=${ws.connType},VLAN=${ws.vlan},COS=${ws.cos},UPORT=${ws.uport};`;
|
const delCmd = `SET-WANSERVICE::OLTID=${nameOlt},PONID=NA-NA-${ponId},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::STATUS=2,MODE=${ws.mode},CONNTYPE=${ws.connType},VLAN=${ws.vlan},COS=${ws.cos},UPORT=${ws.uport};`;
|
||||||
this.logger.debug(`Deletando WAN Service porta ${ws.uport}`, { comando: delCmd });
|
this.logger.debug(`Deletando WAN Service porta ${ws.uport}`, { comando: delCmd });
|
||||||
|
|
||||||
const delResult = await this.executarComandoTL1(delCmd);
|
const delResult = await this.executarComandoTL1(delCmd);
|
||||||
@@ -945,7 +947,7 @@ class FiberhomeManager {
|
|||||||
: Array.from({ length: numPortas }, (_, i) => i + 1);
|
: Array.from({ length: numPortas }, (_, i) => i + 1);
|
||||||
|
|
||||||
for (const porta of portas) {
|
for (const porta of portas) {
|
||||||
const addCmd = `SET-WANSERVICE::OLTID=${nameOlt},PONID=NA-NA-${portAlias},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::STATUS=1,MODE=2,CONNTYPE=1,VLAN=${VLAN_IPOE},COS=0,QOS=2,UPORT=${porta};`;
|
const addCmd = `SET-WANSERVICE::OLTID=${nameOlt},PONID=NA-NA-${ponId},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::STATUS=1,MODE=2,CONNTYPE=1,VLAN=${VLAN_IPOE},COS=0,QOS=2,UPORT=${porta};`;
|
||||||
this.logger.debug(`Criando WAN Service IPoE porta ${porta}`, { comando: addCmd });
|
this.logger.debug(`Criando WAN Service IPoE porta ${porta}`, { comando: addCmd });
|
||||||
|
|
||||||
const addResult = await this.executarComandoTL1(addCmd);
|
const addResult = await this.executarComandoTL1(addCmd);
|
||||||
@@ -957,7 +959,7 @@ class FiberhomeManager {
|
|||||||
|
|
||||||
// 4. Reiniciar ONU para aplicar
|
// 4. Reiniciar ONU para aplicar
|
||||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
const resetCmd = `RESET-ONU::OLTID=${nameOlt},PONID=NA-NA-${portAlias},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::;`;
|
const resetCmd = `RESET-ONU::OLTID=${nameOlt},PONID=NA-NA-${ponId},ONUIDTYPE=MAC,ONUID=${serial}:${this.commandId++}::;`;
|
||||||
this.logger.debug('Reiniciando ONU após IPoE', { comando: resetCmd });
|
this.logger.debug('Reiniciando ONU após IPoE', { comando: resetCmd });
|
||||||
const resultadoReset = await this.executarComandoTL1(resetCmd);
|
const resultadoReset = await this.executarComandoTL1(resetCmd);
|
||||||
if (!resultadoReset.success) {
|
if (!resultadoReset.success) {
|
||||||
@@ -971,7 +973,7 @@ class FiberhomeManager {
|
|||||||
message: `VLAN alterada para ${VLAN_IPOE} (IPoE)`,
|
message: `VLAN alterada para ${VLAN_IPOE} (IPoE)`,
|
||||||
details: {
|
details: {
|
||||||
olt: nameOlt,
|
olt: nameOlt,
|
||||||
porta: portAlias,
|
porta: ponId,
|
||||||
serial,
|
serial,
|
||||||
vlan: VLAN_IPOE,
|
vlan: VLAN_IPOE,
|
||||||
portasConfiguradas: portas,
|
portasConfiguradas: portas,
|
||||||
|
|||||||
Reference in new issue
Block a user