Performance best practice question

I can’t find performance best practice.

If the’re a single task I want to do only at bootstrap (create uplink interfaces) but can’t do it on bootstrap because I must first make sure firmware is at required version, what would be the best way to do it without much impact on system performance ?

Do it only on boot event ?

Create an additional preset with tag condition that would create an additional condition to check check at every events ?

Make sure uplink exist at every events and leave optimisation to the cache ?

Maybe some a config manipulation on the device to delete and recreate the device acs config to try to generate an other bootstrap event ?

I perform our firmware upgrade on 1 BOOT, and also on a schedule (between 2 and 4 am).

In your provision script that creates the necessary uplink interfaces, I would add a conditional check in your bootstrap provision script that checks for the necessary firmware version. I would not do the checking in the preset as you cannot do “or” conditions in presets, example only run the provision script if the mfgr == Zyxel && firmware_version == 1.2.3 || mfgr == Comtrend && firmware_version == 2.6.8.

Here is what I have in one of my provision scripts:

let model = declare("InternetGatewayDevice.DeviceInfo.ModelName", {value: 1}).value[0];

//The 516 is funky with the 2.6.1.6 f/w. So don't do anything if the CPE is running this firmware version and let the firmware upgrade process occur
let currentVersion = declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", {value: now}).value[0];
if (model === 'SR516ac' && cmpVersions(currentVersion, "2.6.1.6") <= 0) {
    info('This CPE is running old firmware (' + currentVersion + '). Exiting for now...');
    return;
}

function cmpVersions(a, b) {
    var i, diff;
    var regExStrip0 = /(\.0+)+$/;
    var segmentsA = a.replace(regExStrip0, '').split('.');
    var segmentsB = b.replace(regExStrip0, '').split('.');
    var l = Math.min(segmentsA.length, segmentsB.length);

    for (i = 0; i < l; i++) {
        diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10);
        if (diff) {
            return diff;
        }
    }

    return segmentsA.length - segmentsB.length;
}
1 Like