Hi! Hope it finds you well.
It’s been basically 2 years since we first implemented GenieACS, and in the last month we opened around 70 Service Orders for customers claiming not having internet.
The thing is, once we access their router, there are 2 PPPoE Wan created, check it out:
At first i thought on some missconfigured settings on provision, but after spending all day trying to reproduce this on production i couldn’t find any problem on the script itself.
Does anyone here could notice if our configuring script has any interaction that could lead to this kinda of error? Creating another PPPoE i say.
The only thing i thought of was if the technician created a 3rd wan manually, then, the filter on checkWAN() wouldn’t work i guess, but even if it happens, the following line should keep only 1 instance of PPP Wan, right?
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*`, null, { path: 1 });
Check the full script:
// Auditoria das ONTs\\
const now = Date.now();
const provisionado = declare("Tags.Provisionado", { value: 1 })?.value?.[0];
const bootstrap = args[0];
log(`provisionado: ${provisionado} || bootstrap: ${bootstrap}`);
if (provisionado && !bootstrap) {
bindLANToWAN();
log("CPE está (supostamente) configurada, retornando...");
return;
}
const serial = declare('DeviceID.SerialNumber', { value: 1 }).value[0];
const productClass = declare('DeviceID.ProductClass', { value: 1 }).value[0];
const pppoe = ext("cpe-config", "GetPPPoE", serial);
declareBasicDevices();
log("[1]");
refreshWlan();
log("[2]");
checkWAN();
log("[3]");
setupAdditionalConfigs();
updateTags();
log('>> Reiniciando CPE para finalizar configuração...');
declare("Reboot", null, { value: now });
function updateTags() {
declare("Tags.Provisionado", null, { value: true });
}
function refreshWlan() {
log('>> Refreshing WLAN...');
declareWLANConfiguration(1);
declareWLANConfiguration(5);
}
function checkWAN() {
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*", { value: now });
const wanNames = [1, 2, 3].map(getWANName);
if (!wanNames[0] && !wanNames[1] && !wanNames[2]) {
setupBaseWanPppConnection(true, 1);
} else {
for (let i = 0; i < wanNames.length; i++) {
if (wanNames[i] && wanNames[i].includes("internet")) {
setupBaseWanPppConnection(false, i + 1);
break;
}
}
}
}
function getWANName(connectionDeviceNumber) {
const name = declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${connectionDeviceNumber}.WANPPPConnection.1.Name`, { value: now })?.value?.[0];
return name ? name.toLowerCase() : null;
}
function setupBaseWanPppConnection(createWan, WANConnectionDevicePATH) {
if (createWan) {
if (productClass.includes('EN8255X6s-8X')) {
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.*`, null, { path: 1 });
} else {
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*`, null, { path: 1 });
}
}
declareWanPppConnection(WANConnectionDevicePATH, pppoe.username, pppoe.password);
huaweiOntX6AdditionalConfigs(WANConnectionDevicePATH);
}
function declareWanPppConnection(WANConnectionDevicePATH, username, password) {
log('>> Atualizando valores WANPPP Base...');
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Enable`, { value: now }, { value: true });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.MaxMTUSize`, { value: now }, { value: "1492" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.MaxMRUSize`, { value: now }, { value: "1492" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.CurrentMRUSize`, { value: now }, { value: "1492" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.DNSEnabled`, { value: now }, { value: true });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.NATEnabled`, { value: now }, { value: true });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.DNSServers`, { value: now });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Username`, { value: now }, { value: username });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.Password`, { value: now }, { value: password });
}
function huaweiOntX6AdditionalConfigs(WANConnectionDevicePATH) {
declare(`InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.EnabledForInternet`, { value: now }, { value: true });
declare(`InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.WANAccessType`, { value: now }, { value: "Ethernet" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_VLAN`, { value: now }, { value: 10 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_NatType`, { value: now }, { value: 0 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6Enable`, { value: now }, { value: true });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]`, { value: now }, { path: 0 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]`, { value: now }, { path: 0 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]`, { value: now }, { path: 1 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Address.1.Origin`, { value: now }, { value: "AutoConfigured" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]`, { value: now }, { path: 1 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.1.Origin`, { value: now }, { value: "PrefixDelegation" });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.*`, { value: now });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.SSID1Enable`, { value: now }, { value: 1 });
declare(`InternetGatewayDevice.WANDevice.1.WANConnectionDevice.${WANConnectionDevicePATH}.WANPPPConnection.1.X_HW_LANBIND.SSID5Enable`, { value: now }, { value: 1 });
}
function setupAdditionalConfigs() {
log('>> Finalizando configurações adicionais...');
declare("InternetGatewayDevice.X_HW_MainUPnP.Enable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_SlvUPnP.Enable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_Security.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.*.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.AccessControlListEnable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.AccessControlListNumberOfEntries", { value: now }, { value: 1 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*", null, { path: 1 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.Mode", { value: now }, { value: 0 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.Priority", { value: now }, { value: 1 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.HTTPLanEnable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_Security.AclServices.HTTPSLanEnable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_Security.AclServices.SamBaLanEnable", { value: now }, { value: true });
declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*", null, { path: 1 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.*.*", { value: now });
declare("InternetGatewayDevice.X_HW_Security.AclServices.WanAccess.1.Enable", { value: now }, { value: 1 });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.ServicePort", { value: now }, { value: "HTTP,ICMP" });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcIp", { value: now }, { value: "XXXXXX" });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcPortName", { value: now }, { value: "ALL" });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.SrcPortType", { value: now }, { value: 2 });
declare("InternetGatewayDevice.X_HW_AppRemoteManage.CurrentMgtURL", { value: now }, { value: "XXXXXXXX" });
declare("InternetGatewayDevice.X_HW_AppRemoteManage.CurrentPort", { value: now }, { value: "00000" });
declare("InternetGatewayDevice.X_HW_AppRemoteManage.PhoneAppURL", { value: now }, { value: "XXXXXXX" });
declare("InternetGatewayDevice.LANDevice.*", { value: now });
//declare("InternetGatewayDevice.LANDevice.1.LANEthernetInterfaceConfig.*", null, { path: 4 });
declare("InternetGatewayDevice.LANDevice.1.LANEthernetInterfaceConfig.*.X_HW_L3Enable", { value: now }, { value: true });
declare("InternetGatewayDevice.Time.*", { value: now });
declare("InternetGatewayDevice.Time.Enable", { value: now }, { value: true });
declare("InternetGatewayDevice.Time.LocalTimeZone", { value: now }, { value: "-03:00" });
declare("InternetGatewayDevice.Time.LocalTimeZoneName", { value: now }, { value: "Brasilia" });
declare("InternetGatewayDevice.Time.NTPServer1", { value: now }, { value: "clock.fmt.he.net" });
declare("InternetGatewayDevice.Time.NTPServer2", { value: now }, { value: "time.windows.com" });
declare("InternetGatewayDevice.Time.X_HW_SynInterval", { value: now }, { value: "3600" });
declare("InternetGatewayDevice.X_HW_Security.Firewall.Enable", { value: now }, { value: true });
const ont = ext("cpe-config", "GetONTPassword", pppoe.username);
declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*", { value: now });
declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*.*", { value: now });
declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.*.Enable", { value: now }, { value: true });
declare("InternetGatewayDevice.UserInterface.X_HW_WebUserInfo.2.Password", { value: 1 }, { value: ont.password });
}
function declareBasicDevices() {
declare("InternetGatewayDevice", { value: now });
declare("InternetGatewayDevice.*", { value: now });
declare("InternetGatewayDevice.WANDevice.*", { value: now });
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*", { value: now });
}
function bindLANToWAN() {
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan1Enable", { value: now }, { value: 1 });
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan2Enable", { value: now }, { value: 1 });
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan3Enable", { value: now }, { value: 1 });
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANPPPConnection.1.X_HW_LANBIND.Lan4Enable", { value: now }, { value: 1 });
//declare("InternetGatewayDevice.Layer3Forwarding.X_HW_policy_route.2.PhyPortName", { value: now }, { value: "LAN1,LAN2,LAN3,LAN4,SSID1,SSID5" });
declare("InternetGatewayDevice.X_HW_Security.AclServices.AccessControl.List.*.ServicePort", { value: now }, { value: "HTTP,ICMP" });
}
function declareWLANConfiguration(configNumber) {
declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.*`, { value: now });
declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.Enable`, { value: now }, { value: true });
declare(`InternetGatewayDevice.LANDevice.1.WLANConfiguration.${configNumber}.X_HW_AttachConf.X_HW_AirtimeFairness`, { value: now }, { value: true });
}
Thank you so much for the attention

