<div dir="ltr">Provision scripts will take care of adding object instances if needed. You will have so many fewer issues if you switch to using provisioning scripts and move away from using the API to add specific object instances. I went from getting several emails a week about modems not working properly when we used the old v1.0 way of configuring CPEs (manually adding/deleting object instances, etc), to going over a year with no complaints about the CPE provisioning process.<div><br></div><div>This right here is all the code in a provisioning script you need to ensure that a PPPoE connection is created for the device. Add a few dozen lines in your external script and whatever API code you need, and any device/mfgr specific code to the provisioning script and you can easily have CPEs auto provisioning in under 200 lines of code.</div><div><div><font face="monospace, monospace"><div><br></div><div>const now = Date.now();</div><div><br></div><div>let provisioned = declare("Tags.Provisioned", {value: 1});</div><div>if (provisioned.value !== undefined) {</div><div>  log('CPE is provisioned, returning');</div><div>  return;</div><div>}</div><div><br></div><div>let model = declare("InternetGatewayDevice.DeviceInfo.ModelName", {value: 1}).value[0];</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 from our external script which calls out to our API</div><div>let config = ext('cpe-config', 'resetPppoe', JSON.stringify(args));</div><div>if (!config) {</div><div>  log('SmartRG_Managed - No config returned from API');</div><div>  return;</div><div>}</div><div><br></div></font></div><div><font face="monospace, monospace">//Ensure we have 1 WANPPPConnection instance on the ATM device</font></div><div><font face="monospace, monospace">log('SmartRG_Managed - Creating WANPPPConnection (if necessary)');</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*", null, {path: 1});</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">log('SmartRG_Managed - Setting up WANPPPConnection');</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.*", {path: now}); //Refresh the node...</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Name", {value: now}, {value: "Internet"});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.ConnectionType", {value: now}, {value: "IP_Routed"});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_IfName", {value: now}, {value: "ppp0.1"});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.NATEnabled", {value: now}, {value: true});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_FirewallEnabled", {value: now}, {value: true});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Enable", {value: now}, {value: true});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.PPPoEServiceName", {value: now}, {value: "broadband"});</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">//{value: now} forces GenieACS to update the value of the username/password</font></div><div><font face="monospace, monospace">log('SmartRG_Managed - Setting un: ' + config.username + ', pw: ' + config.password);</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: config.username});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: config.password});</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><div>log('Done configuring. Setting tags');</div><div>declare("Tags.Provisioned", null, {value: true});</div></font></div><div class="gmail_extra"><br><div class="gmail_quote"><br></div></div></div>