Value not setting on '0 BOOTSTRAP' event

Hi there, hope you feel good.

So, I’ve been working on a script to configure the Huawei ONT EG8145X6-10, and I’ve successfully gathered all the necessary parameters for proper configuration. However, when I attempt to execute the script using ‘0 BOOTSTRAP’, I encounter the error “cwmp.9002 (internal error).”

To elaborate, my intention is to bind LAN ports to my WAN profile. However, before proceeding with this step, I need to activate these ports. Attempting to bind them before activation results in the cwmp.9002 error.

I’ve tried various approaches to activate the ports first and then bind them afterward. However, for some inexplicable reason, GenieACS persistently attempts to bind them before activation. I’ve even tried invoking different functions or setting an asynchronous function to await the declaration before proceeding, but these attempts have proved unsuccessful.

Curiously, when I execute the script using ‘6 CONNECTION REQUEST’ instead of ‘0 BOOTSTRAP,’ it functions as expected.

I would greatly appreciate it if anyone could confirm whether this is the intended behavior for these parameters/events. If you’d like to examine the relevant code section, I’m happy to provide it:

//Requirement
declare("InternetGatewayDevice.LANDevice.*", null, {path: 1});
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});

//Parameter that requires them activated
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan1Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan2Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan3Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan4Enable", {value: now}, {value: 1});

Bellow i’ll leave the full script code, so, if the problem is in it, we could solve it.

//Configs Checker\\

const now = Date.now();

let OK = declare("Tags.OK", { value: 1 });
if (OK.value !== undefined) {
  log("CPE está (supostamente) configurada, retornando...");
  log(">> ......................")
  return;
}
let model = declare("InternetGatewayDevice.DeviceInfo.ModelName", {value: 1});

refreshWlan();
log("1");
setupBaseWanPppConnection();
log("2");
setupAdditionalConfigs();
log("3");

//Refresh the mac and external ip
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.MACAddress", {value: now});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.IpAddress", {value: now});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan1Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan2Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.Lan3Enable", {value: now}, {value: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.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"});

updateTags();

log('#####################################################');
log('## Reiniciando CPE para finalizar configuração!!!! ##');
log('#####################################################\n');

//declare("Reboot", null, {value: now});
log("REBOOTADO!!!!!");

function updateTags() {
  log('Auditoria realizada! Retornando Script...');
  declare("Tags.OK", null, {value: true});
}

function refreshWlan() {
  log('=> Refreshing WLAN');
  log('=> .........');
  //Standard WiFiConfigs
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.*", {value: now});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.SSID", {value: now});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.AutoChannelEnable", { value: now }, { value: false});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.WPS.DevicePassword", {value: now}, {value: ""});
  //Tenda TX2ProV1.0
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*", { value: now });
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.*", { value: now });  
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.*.*", { value: now }); 
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.*.*.*", { value: now }); 
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.*.*.*.*", { value: now }); 
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.X_CT-COM_WLANApInfo.*.X_CT-COM_Radio.*.AutoChannelEnable", { value: now }, { value: 0});  
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.X_CT-COM_ChannelWidth",{ value: now }, { value: "0" });
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.AutoChannelRefreshPeriod", {value: now}, {value: ""});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.TotalPSKFailures", {value: now}, {value: ""});
  //Huawei ONT Ax6/Ax6-10
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.X_HW_CurrentOperatingChannelBandwidth", {value: now}, {value: "20MHz"});
  declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.X_HW_CurrentOperatingChannelBandwidth", {value: now}, {value: "160MHz"});
}

function setupBaseWanPppConnection() {
  //Garantir que temos a instância WanPPPConnection
  log('=> Criando instância WANPPPConnection (se necessário)...');
  log('=> .........');
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*", null, {path: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*", null, {path: 2});
  log('=> Atualizando valores WANPPP Base');
  log('=> .........');
  //Common WanPPPConnection
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.*", {value: now}); //Atualizar parâmetros
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.MaxMTUSize", {value: now}, {value: "1492"})
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.MaxMRUSize", {value: now}, {value: "1492"});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.CurrentMRUSize", {value: now}, {value: "1492"});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSEnabled", {value: now}, {value: true});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.NATEnabled", {value: now}, {value: true});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSServers", {value: now});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Username", {value: now}, {value: "userPPP"});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Password", {value: now}, {value: "passwordPPP"});

    //Huawei Ax2/Ax2S
  declare("InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.EnabledForInternet", {value: now}, {value: true});
  declare("InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.WANAccessType", {value: now}, {value: "Ethernet"});

  //Huawei EG8145X6/EG8145X6-10
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_VLAN", {value: now}, {value: 10});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_NatType", {value: now});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_NatType", {value: now}, {value: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6Enable", {value: now}, {value: true});  
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]", {value: now}, {path: 0}); // LIMPANDO ENTRADAS
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]", {value: now}, {path: 0}); // LIMPANDO ENTRADAS  
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Address.[]", {value: now}, {path: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Address.1.Origin", {value: now});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Address.1.Origin", {value: now}, {value: "AutoConfigured"});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.[]", {value: now}, {path: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.1.Origin", {value: now});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_IPv6.IPv6Prefix.1.Origin", {value: now}, {value: "PrefixDelegation"});
}

async function setupAdditionalConfigs() {
  log('=> Finalizando configurações adicionais...');
  log('=> .........');
  declare("InternetGatewayDevice.1", {value: now});
  declare("InternetGatewayDevice.*", {value: now});

  //Tenda Tx2ProV1.0
  declare("InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.EnabledUpnp", {value: now}, {value: true});
  declare("InternetGatewayDevice.DeviceInfo.X_CT-COM_UPNP.Enable", {value: now}, {value: 1});
  declare("InternetGatewayDevice.UserInterface.RemoteAccess.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.UserInterface.RemoteAccess.IP", {value: now}, {value: "011.100.010.001"});
  declare("InternetGatewayDevice.UserInterface.RemoteAccess.Port", {value: now}, {value: "port"});
  declare("InternetGatewayDevice.UserInterface.RemoteAccess.Protocol", {value: now}, {value: "HTTP"})

  //Huawei ONT Ax6/Ax6-10
  declare("InternetGatewayDevice.X_HW_MainUPnP.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.X_HW_SlvUPnP.Enable", {value: now}, {value: true}); 
  declare("InternetGatewayDevice.*", {value: now}); 
  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: "011.100.010.001-011.100.010.001"});
  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: "url"});
  declare("InternetGatewayDevice.X_HW_AppRemoteManage.CurrentPort", {value: now}, {value: "port"});
  declare("InternetGatewayDevice.X_HW_AppRemoteManage.PhoneAppURL", {value: now}, {value: "url"});
  declare("InternetGatewayDevice.LANDevice.*", null, {path: 1});
  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.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*", null, {path: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.*", {value: now});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.SSID1Enable", {value: now}, {value: 1});
  declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_HW_LANBIND.SSID5Enable", {value: now}, {value: 1});
  //Huawei Ax2/Ax2S
  declare("InternetGatewayDevice.Services.X_HUAWEI_IPv6.*", {value: now});
  declare("InternetGatewayDevice.Services.X_HUAWEI_IPv6.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.Enable", {value: now}, {value: true});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.Enable", {value: now}, {value: "IPAddress1"});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.IPAddress1", {vale: now}, {value: "011.100.010.001"});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.IPAddress2", {vale: now}, {value: ""});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.IPAddress3", {vale: now}, {value: ""});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.IPAddress4", {vale: now}, {value: ""});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.IPAddress5", {vale: now}, {value: ""});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.MaskLength1", {value: now}, {value: '32'});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.MaskLength2", {value: now}, {value: '32'});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.MaskLength3", {value: now}, {value: '32'});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.MaskLength4", {value: now}, {value: '32'});
  declare("InternetGatewayDevice.Services.X_HUAWEI_WANRemoteAccess.MaskLength5", {value: now}, {value: '32'});

}

Thanks so much in advance! Have a good week.