Complete backup of all GenieACS ACS configuration: - 24 provision scripts (default, inform, bootstrap, firmware upgrades, per-model configs for HT803G, HT502, HT812, Deco, XX230v, XX430v, XX530v) - 25 presets (trigger rules mapping events to provisions) - 6 ext scripts (provisioning.js, wifi.js, voip.js — query MariaDB for per-device WiFi SSID/password and VoIP credentials) - 12 firmware images catalogued (HT502, HG8245, HT803G-W/WS2, HT812, Deco) - 7,550 device fleet snapshot (4,035 online, 53.4% online rate) - GenieACS env config (MongoDB at 10.5.2.116, ext dir, JWT secret) Fleet breakdown: - Device2 (TP-Link Deco): 4,051 units (74% online) — bulk of fleet - HT803G (Raisecom): 2,833 units (33% online) — legacy ONTs - DISCOVERYSERVICE: 156 ghost entries (0% online) - Grandstream phones: GXP2130/2160/1630, HT502/812 Key finding: ext scripts use MariaDB (10.5.14.21) for WiFi/VoIP provisioning data (SSID, passwords, SIP credentials per serial). This data must be migrated to ERPNext or a new provisioning DB for Oktopus. Custom fork: @genieacs/genieacs-targo v1.2.8-targo.3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
84 lines
3.8 KiB
JavaScript
84 lines
3.8 KiB
JavaScript
// va chercher les arguments, strips les deux premieres entre par defaut
|
|
args = process.argv.slice(2);
|
|
// met le premier arguments dans la variable arg et le second dans extFunction
|
|
serial = args[0];
|
|
extFunction = args[1];
|
|
|
|
// fait pointe la variable sur le script externe de Zaid
|
|
//let provisioningData = require('/opt/genieacs/ext/provisioning.js');
|
|
|
|
if ( extFunction == "getWifi" ) {
|
|
let provisioningData = require('/opt/genieacs/ext/wifi.js');
|
|
provisioningData[extFunction](args,function(err, res){
|
|
if (err != null) {
|
|
console.log(err);
|
|
process.exit();
|
|
} else {
|
|
const wifiList = res
|
|
let i = 0;
|
|
let w = 1;
|
|
// verifie si le retour est vide mais vérifie la première valeur du array car le retour contient au minimum les braquets du json
|
|
if ( wifiList[i] ) {
|
|
// passe en boucle tout les entrees reçu dans wifiList
|
|
const wifiListLength = wifiList.length
|
|
//console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*=path:"+wifiListLength);
|
|
while ( i < wifiListLength ) {
|
|
// desactive l'instance s'il y a une ou des informations manquante ou si desactive
|
|
if ( !wifiList[i].enable || !wifiList[i].ssid || !wifiList[i].password || wifiList[i].enable == 0 ) {
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.${"+w+"}.Enable=false");
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.instance}.SSID=ssidDisabledByACS");
|
|
console.log("")
|
|
} else {
|
|
// active l'instance et inscrit le ssid ainsi que le mot de passe
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.${"+w+"}.Enable=true");
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.${"+w+"}.SSID="+wifiList[i].ssid);
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.${"+w+"}.PreSharedKey="+wifiList[i].password);
|
|
console.log("")
|
|
}
|
|
i++
|
|
w++
|
|
}
|
|
// desactive tout les instances wifi si vide
|
|
} else {
|
|
//console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*=path:1");
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.RadioEnabled=false");
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.Enable=false");
|
|
console.log("InternetGatewayDevice.LANDevice.1.WLANConfiguration.*.instance}.SSID=radioDisabledByACS");
|
|
}
|
|
}
|
|
process.exit();
|
|
})
|
|
} else if ( extFunction == "getVoip" ) {
|
|
let provisioningData = require('/opt/genieacs/ext/voip.js');
|
|
provisioningData[extFunction](args,function(err, res){
|
|
if (err != null) {
|
|
console.log(err);
|
|
process.exit();
|
|
} else {
|
|
const voipList = res
|
|
let i = 0;
|
|
let v = 1;
|
|
if ( voipList[i] ) {
|
|
const voipListLength = voipList.length;
|
|
while ( i < voipListLength ) {
|
|
if ( !voipList[i].enable || !voipList[i].username || !voipList[i].password || voipList[i].enable == 0 ) {
|
|
console.log("InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line."+v+".Enable = Disabled");
|
|
} else {
|
|
console.log("InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line."+v+".Enable = Enabled");
|
|
console.log("InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line."+v+".SIP.AuthUserName = "+voipList[i].username);
|
|
console.log("InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line."+v+".SIP.AuthPassword = "+voipList[i].password);
|
|
}
|
|
i++;
|
|
v++;
|
|
}
|
|
} else {
|
|
console.log("InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.1.Line.*.Enable = Disabled");
|
|
}
|
|
}
|
|
process.exit();
|
|
})
|
|
} else {
|
|
console.log("unknow fonction")
|
|
process.exit();
|
|
}
|