Global variables?

Hello,

We have a bunch of presets with conditions like Device.DeviceInfo.SoftwareVersion = “6.48”, and other presets to trigger the upgrade that push “6.48” as an argument to the provision.

Is there any way to use some kind of global identifier so that when we want to upgrade from version “6.48” that we can change it in one place? I tried creating a Virtual Parameter for this for the conditions to match on something like Device.DeviceInfo.SoftwareVersion = VirtualParameters.StandardVersion but it didn’t work.

It would be better to create a provision script to do the firmware upgrades. I check on boot (and between 1-3 AM) if the particular model of CPE needs a firmware upgrade, and if so push the necessary file(s).

Virtual parameters are designed to abstract away some of the complexities between different TR spec versions. For example, I have this provision script:

const keys = [
  'InternetGatewayDevice.DeviceInfo.SoftwareVersion',
  'Device.DeviceInfo.SoftwareVersion'
];

return {writable: false, value: [getParameterValue(keys, ''), "xsd:string"]};

function getParameterValue(keys, def) {
    for (let key of keys) {
        let d = declare(key, {value: Date.now()});

        for (let item of d) {
            if (item.value && item.value[0]) {
                return item.value[0];
            }
        }
    }

    return def;
}

This lets me use the virtual param VirtualParameters.SoftwareVersion regardless of if the CPE is running TR-069 or TR-181.

Yes, we have a provision script to do the firmware upgrades. The problem is right now I have to match SoftwareVersion = “6.48” as a precondition for 6 different presets. Each time we upgrade, I have to remember to change the string “6.48” to whatever new version “6.48.1” in all 8 places. If I miss one, I will have devices not getting configured.

It is because our provisions that push the configurations all require the specific software version, and so most of our presets that have nothing to do with updating firmware have SoftwareVersion = “6.48” as a precondition that must be met for the preset to run. It is fine as long as we are using 6.48 but when we need to change it is possible to miss somewhere, or there may be a device that comes online and requests a config while we are partway through changing all instances of the string “6.48” to “6.48.1” in all the different preset preconditions.

I’m curious why you would set a specific software version as a precondition for configuration?

Working around a firmware defect one time I understand. You could also change you precondition to be >= instead of just = (if thats applicable in your use case).

What happens is that MikroTik makes minor changes to their config syntax from time to time. They may change a setting named “discover-list” to “discovery-list” or some similar change. When they do this, we have to make the similar change to our configuration files. If a CPE device that was perhaps offline for a while (and so has an older firmware version) gets plugged in and tries to download the config meant for a new version on an older version, and it gets “discovery-list” instead of “discover-list” or whatever the syntax change is, it will fail to load the config and will instead have a completely blank config that has no IP address and no TR069 settings. This requires manual intervention by a technician to fix. As a result we have preconditions for all of our presets that push down configuration files so that the configuration files will only push down after the device reports that is running the correct version.

My only concern with >= is that it is probably handled in lexicographic order, so the comparison may not work as intended once version numbers go beyond something like 6.48.9 to 6.48.10 or 6.48.11

Hi, one idea could be to use tags but it implies to handle them externally in the case of changes. For example you will tie all configuration presets to the presence of a tag, for example “latest”. The “latest” tag will be added by the firmware upgrade provision or by a single present that compares the SoftwareVersion with the one you want, like “6.48” and adds the “latest” tag. This way if a new version arrives, you do this steps:

  • change the preset that adds the “latest” tag to the new version: “6.49”
  • remove the latest tag from all devices (have to be done externally, either by calling the API for each device or directly in mongo, see this thread)