log("SmartRG_515_Managed"); const now = Date.now(); let serialNumber = declare("DeviceID.SerialNumber", {value: 1}); let productClass = declare("DeviceID.ProductClass", {value: 1}); let oui = declare("DeviceID.OUI", {value: 1}); let args = {serial: serialNumber.value[0], productClass: productClass.value[0], oui: oui.value[0]}; //Remove the WANIPConnection instance from the ATM interface log('Disabling WANIPConnection'); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", null, {path: 0}); //Ensure we have a WANPPPConnection instance log('Creating WANPPPConnection (if necessary)'); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*", null, {path: 1}); let hasPpp = declare("Tags.HasPppCreds", {value: 1}); if (hasPpp.value !== undefined) { log('hasPpp, returning'); return; } //Set a flag so we don't keep resetting the ppp creds declare("Tags.HasPppCreds", null, {value: true}); //Get the PPPoE creds let userConfig = ext('cpe-config', 'resetPppoe', JSON.stringify(args)); log('Setting up WANPPPConnection'); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Name", {value: now}, {value: "Internet"}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.ConnectionType", {value: now}, {value: "IP_Routed"}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_IfName", {value: now}, {value: "ppp0.1"}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.NATEnabled", {value: now}, {value: true}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_FirewallEnabled", {value: now}, {value: true}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Enable", {value: now}, {value: true}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.PPPoEServiceName", {value: now}, {value: "broadband"}); //{value: now} forces GenieACS to update the value of the username/password if the value hasn't been updated before now log('Setting un: ' + userConfig.username + ', pw: ' + userConfig.password); declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: userConfig.username}); declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: userConfig.password}); log('Setting connection services'); declare("InternetGatewayDevice.Layer3Forwarding.X_BROADCOM_COM_DefaultConnectionServices", {value: now}, {value: "ppp0.1,ppp1.1"}); declare("InternetGatewayDevice.X_BROADCOM_COM_NetworkConfig.DNSIfName", {value: now}, {value: "ppp0.1,ppp1.1"}); //Refresh the mac and external ip declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPPConnection.*.MACAddress", {value: now}); //Refresh the WLAN config log('Refreshing WLAN'); declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.SSID", {value: now}); //Refresh the vParams declare("VirtualParameters.pppoeUsername", {value: now}); log('Setting tags'); declare("Tags.Provisioned",null, {value: true}); declare("Tags.HasPppCreds", null, {value: false});