Two things, first use this syntax:
declare("InternetGatewayDevice.WANDevice.***.WANConnectionDevice.***
.WANPPPConnection.***.Username", *{value: Date.now()}*, {value: "user@domain
"});The reason for the *** is because you cannot guarantee that the instance ID will always be 1. On the CPE's I have in my lab, WANDevice 1 is ATM, 2 is PTM, 3 is WAN Ethernet. We use both ATM and eth in our environment. Second, and the bigger issue is how you are configuring your CPEs. A giganto switch statement that has to be constantly maintained is unsustainable. Your provision script should call an external service to retrieve the un/pw for the CPE. Use this external script as your starting point: https://pastebin.com/hfZZJB2Z The getConfig method you might not need in your environment. In ours, it determines if the CPE is going to be bridged or routed. Your provision script will contain the following code: const now = Date.now(); let serialNumber = declare("DeviceID.SerialNumber", {value: 1}).value[0]; let productClass = declare("DeviceID.ProductClass", {value: 1}).value[0]; let oui = declare("DeviceID.OUI", {value: 1}).value[0]; let args = {serial: serialNumber, productClass: productClass, oui: oui}; //Get the PPPoE creds let config = ext('cpe-config', 'resetPppoe', JSON.stringify(args)); if (!config) { log('No config returned from API'); return; } declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: config.username}); declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: config.password}); Because the script can be called multiple times, you will either want to have your API cache the password for 10 minutes and return the password from cache; or make your CPE password deterministic. In my environment I combine the CPE serial number, the pppoe username and a secret value. Then I hash that and return 16 chars from the hash. This allows the provisioning script to be called multiple times without any issues. -dan
_______________________________________________ Users mailing list [email protected] http://lists.genieacs.com/mailman/listinfo/users
