Using TR-069 standard cpe methods

Hi GenieACS Community,

I am currently migrating from LibreACS to GenieACS and need guidance on adapting my existing LibreACS provisioning scripts to GenieACS. My current script handles various TR-069 methods like GetParameterValues, SetParameterValues, Reboot, Download, etc., and includes logic for handling events like BOOTSTRAP, BOOT, and PERIODIC.

Here’s a summary of my requirements:

  1. Event Handling: In LibreACS, I use events like BOOTSTRAP, BOOT, and PERIODIC to trigger specific actions. How can I replicate this event-driven logic in GenieACS?
  2. Database Queries: My script queries a database to fetch configuration data (e.g., WiFi settings, firmware URLs). Since GenieACS doesn’t support direct database queries in scripts, what’s the recommended approach?
  3. Task Scheduling: I need to schedule tasks like SetParameterValues, Reboot, and Download based on conditions. How can I use declare('task', {...}) effectively for this purpose?
  4. Firmware Upgrades: My script initiates firmware upgrades using the Download method. How can I implement this in GenieACS?

I would appreciate any guidance or examples on how to:

  • Translate event-driven logic into GenieACS scripts.
  • Replace database queries with GenieACS features like tags or presets.
  • Schedule and manage tasks like SetParameterValues, Reboot, and Download.

Thank you in advance for your support!

  1. Event logic should be the same.
  2. Instead of direct DB queries inside of LibreACS, you would call an extension script to do the data acquisition.
  3. Use a preset with a cron schedule expression
  4. Same way
1 Like

Thanks for your quick response. Please refer to the sample code from my existing script. What do you recommend for use? only the declare function? Apart from that, I have also used the AddObject and DeleteObject functions


if (sModel == "ZLT P11") {
	var PCILock = '';
	sig[0] = 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSSI';
	sig[1] = 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSRQ';
	sig[2] = 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.SignalQuality';
	sig[3] = 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSRP';
	sig[4] = 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.PCILock';
	sig[5] = 'InternetGatewayDevice.DeviceInfo.IMEI';
	try {
		r = cpe.GetParameterValues(sig);
		for (k = 0; k < r.length; k++) {
			if (r[k].name == 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSSI') rssi = r[k].value + 'dBm';
			if (r[k].name == 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSRQ') rsrq = r[k].value + 'dB';
			if (r[k].name == 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.RSRP') rsrp = r[k].value + 'dBm';
			if (r[k].name == 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.SignalQuality') sq = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.DeviceInfo.IMEI') imei = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.WANDevice.1.X_CMCC_WANNetConfigInfo.PCILock') PCILock = r[k].value;
		}
	}
	catch (er12) {
		logger(sn + "  Model: " + sModel + " >>> Capturing signaling parameters failed");
	}
	logger(sn + " >>> P11 cell lock status : " + PCILock);
	try {
		db.Update("java:ACS", "INSERT INTO CellLockStatus (serialno,status) values ('" + sn + "','" + PCILock + "') ON DUPLICATE KEY UPDATE status='" + PCILock + "'");
	} catch (er4) {
		logger(sn + " >>> Cell Lock status update to database failed");
	}
} else if (sModel == "B312-926") {
	logger(sn + " >>> Capturing signaling parameters of model: " + sModel);
	sig[0] = 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSSI';
	sig[1] = 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSRQ';
	sig[2] = 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.SignalQuality';
	sig[3] = 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSRP';
	sig[4] = 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.X_ATP_lmt_signal.cqi0';
	try {
		r = cpe.GetParameterValues(sig);
		for (k = 0; k < r.length; k++) {
			if (r[k].name == 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSSI') rssi = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSRQ') rsrq = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.RSRP') rsrp = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.SignalQuality') sq = r[k].value;
			if (r[k].name == 'InternetGatewayDevice.WANDevice.2.X_ATP_WANUMTSInterfaceConfig.X_ATP_lmt_signal.cqi0') cqi = r[k].value;
		}
	}
	catch (er12) {
		logger(sn + "  Model: " + sModel + " >>> Capturing signaling parameters failed");
	}
	try {
		var para6 = new Array();
		para6[0] = { name: 'InternetGatewayDevice.ManagementServer.PeriodicInformInterval', value: '43200', type: 'xsd:unsignedInt' };
		logger(sn + "  Model: " + sModel + " >>> Trying to change periodic interval");
		cpe.SetParameterValues(para6, sCommandKey);
	}
	catch (er13) {
		logger(sn + " >>> Changing periodic interval failed");
	}
}	

With provision scripts, you do you instances differently. Here is a piece of code to add port forward entries, but you get the idea of how it works:

let keys = [
    'InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.PortMapping',
    'Device.NAT.PortMapping'
];

for (let basePath of keys) {
    // Tell GenieACS to remove any existing port mappings.
    // No work will actually be done at this stage.
    declare(basePath + '.[]', null, {path: 0});

    // Each entry of portForwards is a JSON object. The keys/values are used to
    // build the path expression for GenieACS
    for (let forward of portForwards) {
        const path = basePath + '.[' + Object.keys(forward).map(key => key + ':' + forward[key]).join(',') + ']';

        log(`\r\n\r\nPortForwards - Updating - ${path}\r\n\r\n`, forward);

        // Declare to GenieACS what the desired state is
        declare(path, {path: 1}, {path: 1});
    }
}

// When this script finishes executing is when the actual work of determining the
// delta and sending the necessary AddObject/DeleteObject/SPV/etc commands to the CP
1 Like

Thank you very much. Can you suggest some references to follow?

docs.genieacs.com

1 Like