Hi!
We are a regional ISP, and we use Genie to manage a mix of CPEs.
90% of our equipment is divided into 3 models, each with a different WAN ID:
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ExternalIPAddress
Others use
IInternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.ExternalIPAddress
We can’t get the manufacturer to change this to standardize the IDs.
We created a VirtualParameter (VP) with a switch, collect the model, and perform actions for each model, returning the value.
This is repeated for WAN, VOIP, and LoginPPP collection.
The script averages 50 lines, so we would have 150 lines executed.
We are working to reduce this repetitive work.
We tried to pass the model parameter in the VirtualParameter, but according to the documentation, it’s not possible.
We thought about using 3 VirtualParameters and using Preconditions so that each model calls its own VirtualParameter.
But the VirtualParameters would have different names, and we would have to declare many things in the User Interface (UI), and it doesn’t seem smart.
We came to the community to look for a smarter way to reduce the server workload and the execution of repetitive lines.
Thank you to everyone who dispende time to read this topic.
Our current WAN collection script looks like this:
let IP_WAN='semIP';
//pega modelo
let modelo = declare("DeviceID.ProductClass", {value: Date.now()});
//Jogar para String
let modeloLimpo = modelo.value[0].toString();
//Verificar parametro deacorod com modelo
switch (modeloLimpo) {
case 'MP_X421RQ_F':
case 'MP_G421R':
case 'MP_G421RQ':
case 'MP_X421R':
case 'HG9':
case 'AC10':
case 'EG8141A5':
case 'EG8145X6':
case 'HS8546V5':
case 'EG8145V5':
case 'EG8145V5-V2':
case 'HG8546M':
case 'HG8546M-RMS':
case 'HS8145V':
case 'G-140W-C':
case 'F670L':
// Coletando dADOS
IP_WAN = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ExternalIPAddress", {value: Date.now()});
//verificar se esta vazio
if (IP_WAN.path){
return {writable: false, value: [IP_WAN.value[0], "xsd:string"]};
} else {
//testando outra WAN
IP_WAN = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.ExternalIPAddress", {value: Date.now()});
IP_WAN = "FP_" + IP_WAN.value[0];
return {writable: false, value: [IP_WAN , "xsd:string"]};
}
//Coleta da Stevix VLAN - Se der Erro | trocar no CASE
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.X_RTK_WANGponLinkConfig.VLANIDMark", {value: Date.now()});
break;
//MELECA - na Gambianara
case 'UN1200X-AC':
IP_WAN = declare("InternetGatewayDevice.X_CT-COM_DNSSpeedLimit.HgwInfo", {value: Date.now()});
if (IP_WAN.path){
// qeubra em 2 caracter "," e "|"
IP_WAN = IP_WAN.value[0].split(/[,|_]+/ , 1 );
return {writable: false, value: [IP_WAN , "xsd:string"]};
} else {
//testando outra WAN
IP_WAN = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.ExternalIPAddress", {value: Date.now()});
return {writable: false, value: [IP_WAN.value[0], "xsd:string"]};
}
break;
default:
return {writable: false, value: [IP_WAN, "xsd:string"]};
}