<div dir="ltr">Two things, first use this syntax:<div><span style="color:rgb(0,0,0);font-family:monospace;font-size:11px;white-space:pre">  declare("InternetGatewayDevice.WANDevice.<b>*</b>.WANConnectionDevice.<b>*</b>.WANPPPConnection.<b>*</b>.Username", <b>{value: Date.now()}</b>, {value: "user@domain"});</span><br></div><div><span style="color:rgb(0,0,0);font-family:monospace;font-size:11px;white-space:pre"><br></span></div><div>The reason for the <b>*</b> 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.</div><div><br></div><div>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: <a href="https://pastebin.com/hfZZJB2Z">https://pastebin.com/hfZZJB2Z</a>  The getConfig method you might not need in your environment. In ours, it determines if the CPE is going to be bridged or routed.</div><div><br></div><div>Your provision script will contain the following code:</div><div><div>const now = Date.now();</div><div>let serialNumber = declare("DeviceID.SerialNumber", {value: 1}).value[0];</div><div>let productClass = declare("DeviceID.ProductClass", {value: 1}).value[0];</div><div>let oui = declare("DeviceID.OUI", {value: 1}).value[0];</div><div>let args = {serial: serialNumber, productClass: productClass, oui: oui};</div><div><br></div><div>//Get the PPPoE creds</div><div>let config = ext('cpe-config', 'resetPppoe', JSON.stringify(args));</div><div>if (!config) {</div><div>  log('No config returned from API');</div><div>  return;</div><div>}</div></div><div><br></div><div><div>declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: config.username});</div><div>declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: config.password});</div></div><div><br></div><div>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.</div><div><br></div><div>-dan</div></div>