[MikroTik] Setting L2TP / PPPoE credentials not in TR069 tree

I am facing an issue when trying to “get/set” parameters on L2TP from a MikroTik hapac connected to GenieACS.
Whenever I create an l2tp interface entry (in CPE) and refresh the tree I get these informations on WebUI :

Device.X_MIKROTIK_Interface.Generic.3.Enable - true
Device.X_MIKROTIK_Interface.Generic.3.LowerLayers - blank
Device.X_MIKROTIK_Interface.Generic.3.Name - l2tp-out1
Device.X_MIKROTIK_Interface.Generic.3.Status - Up

No informations about credentials/profile/MTU etc…

Provision of parameters are done from a “models.py” to define Device paths :

mikrotik_hapac = {

'dhcp_state': 'Device.DHCPv4.Server.Pool.1.Enable',
'dhcp_start_ip': 'Device.DHCPv4.Server.Pool.1.MinAddress',
'dhcp_end_ip': 'Device.DHCPv4.Server.Pool.1.MaxAddress',
'dhcp_dns': 'Device.DHCPv4.Server.Pool.1.DNSServers',


Another server generates a JSON file with values based on user inputs such as :

‘dhcp_start_ip’ : “”,
‘dhcp_end_ip’ : “”

GenieACS matches these parameters and associates Device.DHCPv4.Server.Pool.1.MinAddress to properly.

:question: Is it possible to create an L2TP interface with custom MTU/credential through this process if these parameters do not appear in TR069 Tree without going through a “.alter” or another uploaded file :question:

I would like to apply this configuration to create vlans and DHCP options, these parameter are not in the TR069 tree aswell.

Thank you for your help.

If the CPE doesn’t expose the parameter name, there is no out of the box way I’m aware of to accomplish this. You have to get Mikrotik to fix their CWMP implementation, or patch the GenieACS code to look for the particular parameter names you want to set and have it ignore the checks if they exist. Even doing that, doesn’t mean the CPE will accept the SPV on those parameters.

No, you’ll have to use a .alter. What we do for this is we have nginx reverse proxy both the GenieACS FS and a Laravel instance that creates a custom .alter file for the device on the fly. We set up a provision that pushes the .alter to the device, and the .alter is actually generated by Laravel. That way, we don’t have to upload a file per device to the GenieACS files section.

1 Like

@adralith The solution @mjducharme came up with is the one you want to use. You do not want to have thousands of .alter files.

@zaidka I wonder if it might be possible to add a “Virtual Files” feature into GenieACS for something like this? Perhaps it could be like Virtual Parameters and return a string, but the string could be the file contents? That might make these sort of things possible without having to reverse proxy some other web app to generate the file contents.

That’s an intriguing idea. But are there use cases for such a feature other than as a workaround for clients that don’t expose all the necessary parameters through TR-069?

Yes, I think so. I mean, TR069 has the basic ability to push a Vendor Configuration File. It makes sense to be able to create a Vendor Configuration File on the fly for a certain client, customized to that client, rather than just a generic one. That wouldn’t necessarily be a “workaround” for clients that don’t expose the necessary parameters, but could instead greatly simplify the initial configuration process by allowing you to push a config that is already customized for the client vs. having to push a generic config at first and then adjust the various parameters exposed via TR069 to customize it.

This would be a awesome feature and I think it could be implemented with minimum additions/changes. To give you an example of the use case, setting a device with all the settings needed after a 0 BOOTSTRAP event takes ~40 seconds because of the 50+ ms RTT and all the back&forth conversation … but if genieacs implements this feature, we could generate on the fly a configuration file.
One idea to implement, if it’s possible:

  • the bootstrap preset + provision would read the necessary info in order to identify the device (sn/model/ip…etc) and initiate a download for the config file:
declare("Downloads.[FileType:3 Vendor Configuration File].FileName", {value: 1}, {value: "getconfig/MODEL_SN_ip.xml"});
  • in the FS process, at the parsing of the filename if the path contains a ‘/’ it will search a provision with name equal to the left part (getconfig in this case) and run it with the filename as argument and use the returned output as the file contents
  • the getconfig provision will make the EXT call based on the filename from the global args variable.
1 Like

I would add that a nice way of handling this might be to use some kind of templating engine, something like twig. There are a bunch of such options for nodejs. Some only work with HTML, but others such as twig are powerful enough that they can be used to generate just about any file type like .xml or a regular text .cfg file. This is the method we currently use, but we have to reverse proxy a Laravel instance to do it.