Creating Configfile via GenieACS

1. Adding Objects

To add PPPoE credentials, the "InternetGatewayDevice.WANDevice.3.WANConnectionDevice.1.WANPPPConnection.1" has to exist. So an additional WANPPPConnection-Interface must be created, before any parameters can be modified.

curl -X PUT -i 'http://ip:7557/objects/1' -d '{}'

2. Creating virtual parameters

To differentiate between an 'InternetGatewayDevice' and a 'Device', there are virtual parameters, preventing to check both types of devices.

curl -i 'http://ip:7557/virtual_parameters/SerialNumber' -X PUT -d 'var sn = declare("DeviceID.SerialNumber", {value: Date.now()}); 
return {writable: false, value: [sn.value[0], "xsd:string"]};'

3. Building provisions

A Provision is JavaScript code that can handle provisioning workflow. After a factory reset the device needs to have the correct MAC. So at every refresh, GenieACS needs to get the most important values from the device. The TR-069 connection request- and PPPoE credentials should be present.

curl -X PUT -i 'http://ip:7557/provisions/BOOTSTRAP' -d 
'const now = Date.now(); 
declare("InternetGatewayDevice.DeviceInfo.SerialNumber", {value: now}); 
declare("InternetGatewayDevice.DeviceInfo.ProductClass", {value: now}); 
declare("InternetGatewayDevice.DeviceInfo.ManufacturerOUI", {value: now}); 
declare("InternetGatewayDevice.DeviceInfo.Manufacturer", {value: now}); 
declare("InternetGatewayDevice.DeviceInfo.HardwareVersion", {value: now}); 
declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", {value: now}); 
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress", {value: now}); 
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", {value: now}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", {value: now}); 
declare("InternetGatewayDevice.ManagementServer.PeriodicInformEnable", {value: now} , {value: true}); 
declare("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", {value: now} , {value: 86400}); 
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestUsername", {value: now} , {value: "admin"}); 
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestPassword", {value: now} , {value: "admin"});'

The default gateway should also be set in a provision but can be called in a preset.

curl -X PUT -i 'http://ip:7557/provisions/setDefaultGw' -d 'declare("InternetGatewayDevice.Layer3Forwarding.X_BROADCOM_COM_DefaultConnectionServices", {value: Date.now()} , {value: "ppp0.2"});'

4.  Building presets

We use presets to store most of the logic from the configfile and set parameters at every reboot. 

curl -X PUT -i 'http://ip:7557/presets/nameOfPreset' -d
'{ "weight":0,"precondition":"{\"VirtualParameters.SerialNumber\":\"aabbccddeeff\"}",
"events":{"1 BOOT":true,"0 BOOTSTRAP":false},
"configurations":[{"type":"add_tag","tag":"provisioned"}]}'

There is always the option to create a preset via GenieACS GUI and show them via GET to see how to call different functions (refreshObject, add_object, age, ...).

curl -X GET -i 'http://ip:7557/presets/'