datacom: add ONU with custom VLAN
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
88366f25e6
commit
600555596d
2 files changed
+209
No files matched your search
@@ -14,6 +14,7 @@ class NLPProcessor {
|
||||
'ver_sinal': ['ver sinal', 'verificar sinal', 'sinal', 'check signal', 'signal'],
|
||||
'remover_onu': ['remover onu', 'deletar onu', 'apagar onu', 'remove onu', 'delete onu'],
|
||||
'adicionar_onu': ['adicionar onu', 'add onu', 'criar onu', 'cadastrar onu', 'registrar onu'],
|
||||
'adicionar_onu_vlan': ['adicionar onu vlan', 'add onu vlan', 'criar onu vlan', 'cadastrar onu vlan'],
|
||||
'ping': ['ping', 'testar', 'test', 'conectividade'],
|
||||
'admin': ['admin', 'administração', 'administracao', 'painel'],
|
||||
'usuarios_autorizados': ['usuarios autorizados', 'users autorizados', 'lista usuarios', 'listar usuarios autorizados'],
|
||||
@@ -55,6 +56,9 @@ class NLPProcessor {
|
||||
// Padrões específicos para ver sinal
|
||||
/^(ver|verificar|check)\s+(sinal|signal)\s+([A-Z0-9]+)$/i,
|
||||
/^(sinal|signal)\s+([A-Z0-9]+)$/i,
|
||||
// Padrões específicos para adicionar ONU com VLAN customizada
|
||||
/^(adicionar|add|criar|cadastrar|registrar)\s+(onu|ont)\s+vlan\s+(\d+)\s+([A-Z0-9]+)$/i,
|
||||
/^(adicionar|add|criar)\s+vlan\s+(\d+)\s+([A-Z0-9]+)$/i,
|
||||
// Padrões específicos para adicionar ONU
|
||||
/^(adicionar|add|criar|cadastrar|registrar)\s+(onu|ont)\s+([A-Z0-9]+)$/i,
|
||||
/^(adicionar|add|criar|cadastrar|registrar)\s+([A-Z0-9]+)$/i,
|
||||
@@ -281,6 +285,32 @@ class NLPProcessor {
|
||||
|
||||
// Padrões específicos para adicionar ONU
|
||||
if (/adicionar|add|criar|cadastrar|registrar/i.test(action)) {
|
||||
// Padrão especial: "adicionar onu vlan XXX SERIAL" ou "add onu vlan XXX SERIAL"
|
||||
if (/vlan/i.test(fullMatch)) {
|
||||
let vlanId, serialNumber;
|
||||
|
||||
// Formato: "adicionar onu vlan XXX SERIAL"
|
||||
if (match.length === 5 && /onu|ont/i.test(fullMatch)) {
|
||||
vlanId = match[3]; // VLAN ID
|
||||
serialNumber = match[4]; // Serial
|
||||
}
|
||||
// Formato: "adicionar vlan XXX SERIAL"
|
||||
else if (match.length === 4) {
|
||||
vlanId = match[2]; // VLAN ID
|
||||
serialNumber = match[3]; // Serial
|
||||
}
|
||||
|
||||
if (vlanId && serialNumber) {
|
||||
return {
|
||||
action: 'adicionar_onu_vlan',
|
||||
target: serialNumber.trim().toUpperCase(),
|
||||
vlanId: parseInt(vlanId),
|
||||
confidence: 0.95,
|
||||
type: 'add_onu_vlan_pattern'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Padrão 1: "adicionar onu SERIAL" ou "add ont SERIAL"
|
||||
if (/onu|ont/i.test(fullMatch)) {
|
||||
let serialNumber = match[3]; // Terceiro grupo capturado (serial após "onu/ont")
|
||||
|
||||
Reference in new issue
Block a user