var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, // { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, //{ label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, //{ label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, //{ label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, //{ label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "36", friendlyName: "36" }, { systemName: "56", friendlyName: "56" }, { systemName: "100", friendlyName: "100" }, { systemName: "153", friendlyName: "153" }, { systemName: "157", friendlyName: "157" }, { systemName: "161", friendlyName: "161" }, { systemName: "165", friendlyName: "165" } ] };
var channelWidthDataType = { type: "ENUM", choice:[ { systemName:"Auto", friendlyName: "Auto"}, { systemName:"20Hz", friendlyName: "20Hz"}, { systemName:"40Hz", friendlyName: "40Hz"} ] };
var transmitPowerDataType = { type: "ENUM", choice:[ { systemName:"0", friendlyName: "0%"}, { systemName:"25", friendlyName: "25%"}, { systemName:"50", friendlyName: "50%"}, { systemName:"75", friendlyName: "75%"}, { systemName:"100", friendlyName: "100%"} ] };
var passwordDataType = { type: "STRING", hidden: true, isPassword: true, dependencies: { securityMode:[ { name: "Disabled" }, { name: "WEP-Shared", dataType:{ type: "STRING", min:10, max:10 } }, { name: "WEP-Open", dataType:{ type: "STRING", min:13, max:13 } }, { name: "TKIPEncryption", dataType:{ type: "STRING", min:8, max:63 } }, { name: "AESEncryption", dataType:{ type: "STRING", min:8, max:63 } }, { name: "TKIPandAESEncryption", dataType:{ type: "STRING", min:8, max:63 } } ] }
};
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "securityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "securityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "securityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] }, { group: "Disabled", dependsOnParameter: "securityMode", showOnValue: ["Disabled"] } ];
var data = {
name: "wifi2",
label: "WiFi 5Ghz",
parameters: [
{ name:"ssid", label: "##wifi.ssid##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.SSID" },
{ name:"enabled", label: "##wifi.wifi_enable##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Enable" },
{ name:"broadcastSsid", label: "##wifi.broadcast_ssid##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.BeaconAdvertisementEnabled" },
{ name:"channel", label: "##wifi.channel##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel", dataType: channelDataType },
/{ name:"channelWidth",label: "##wifi.channel_width##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.X_000E50_ChannelWidth", dataType: channelWidthDataType },/
{ name: "transmitPower",label: "##wifi.transmit_power##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.TransmitPower", dataType: transmitPowerDataType },
{ name: "frequency", label: "##wifi.frequency##", description: "Frequency", value:"5GHz", writable: false },
{ name:"passwordIndex", label: "##wifi.password_index##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] },
{ name:"password1", label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: passwordDataType, groups: ["WEP-Open", "WEP-Shared"], readCallback: readPassword },
{ label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] },
{ label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] },
{ label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] },
/{ name:"password", label: "##wifi.password##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.2.PreSharedKey.1.KeyPassphrase", group: "WPA", dataType: passwordDataType },/
{ name:"password", label: "##wifi.password##", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.PreSharedKey.1.KeyPassphrase", groups: ["Disabled","WEP-Open", "WEP-Shared", "WPA"], dataType: passwordDataType, readCallback: readPassword },
{ label: "WPA Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WPAAuthenticationMode", internalOnly: true },
{ label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.WPAEncryptionModes", internalOnly: true },
{ label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.BasicAuthenticationMode", internalOnly: true },
{ label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.BasicEncryptionModes", internalOnly: true },
{ label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.BeaconType", internalOnly: true },
{ label: "Standard", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Standard", internalOnly: true },
{ name:"mode", label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false },
{ name:"securityMode", label: "##wifi.security_mode##", description: "Security Mode", readCallback: readSecurityModeCallback }
],
styles: {
definitions:{
securityMode:{
eq:[
{ "value":"TKIPEncryption|TKIPandAESEncryption", "style":"threshold-red"},
{ "value":"AESEncryption", "style":"threshold-blue"}
]
},
channel:{
lt:[
{ "value":"5", "style":"threshold-blue"}
],
gteq:[
{ "value":"8", "style":"threshold-red"}
],
eq:[
{ "value":"5", "style":"threshold-yellow"}
]
},
ssid:{
always: [
{"style":"threshold-text-red"}
]
},
password:{
always: [
{"style":"threshold-blue"}
]
},
mode:{
eq:[
{ "value":"b", "style":"threshold-green"},
{ "value":"b, g, n", "style":"threshold-brown"}
]
}
},
container:{
width:"size1",
wrapper:"{border:2px solid #cccccc; background-color:#f8f8f8; min-height: 590px}",
label:"{color:#111111; font-weight:bold; font-family: 'Courier', sans-serif;}",
conditionalValues:{
ssid:"ssid",
securityMode:"securityMode",
channel:"channel",
mode:"mode",
password:"password"
}
}
}
};
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering, collections:null });
function readPassword(cpeParameters) { var parameter = {}; parameter.writable = cpeParameters.password.writable; parameter.stale = cpeParameters.password.stale; parameter.disabled = false; parameter.dataType = passwordDataType; if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") { // WEP-Open, WEP-Shared; if (typeof cpeParameters.password1 !== 'undefined' && cpeParameters.password1 !== null) { parameter.value = cpeParameters.password1.value; } } else { if (cpeParameters.BeaconType.value == "Basic") { parameter.value = null; } else { if (typeof cpeParameters.password !== 'undefined' && cpeParameters.password !== null) { parameter.value = cpeParameters.password.value; } } }
return parameter; }
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = "b-g-n";//cpeParameters.Standard.value; parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b-g-n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "ssid":
cpeParameters.ssid.updated = true;
cpeParameters.ssid.value = value;
break;
case "channel":
// if(value < 0 || value > 165)
// throw "Channel number invalid. Must be 36 - 165";
cpeParameters.channel.value = value;
cpeParameters.channel.updated = true;
break;
case "enabled":
cpeParameters.enabled.value = value === "true" ? 1 : 0;
cpeParameters.enabled.updated = true;
break;
case "broadcastSsid":
cpeParameters.broadcastSsid.value = value === "true" ? 1 : 0;
cpeParameters.broadcastSsid.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "securityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
var PasswordIndex = 1;
/*
if(typeof scriptParameters.passwordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.passwordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "SecurityMode: Key index must be between 1 and 4";
cpeParameters.passwordIndex.value = scriptParameters.passwordIndex;
cpeParameters.passwordIndex.updated = true;
} else {
throw "SecurityMode(a):Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
*/
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
if (typeof scriptParameters.password != 'undefined' && scriptParameters.password !== null) {
if(scriptParameters.password.length !== 0 && scriptParameters.password.length != 10)
throw "Password length invalid. Must be 10 ASCII characters";
cpeParameters.passwordIndex.value = PasswordIndex;
cpeParameters.passwordIndex.updated = true;
cpeParameters.password1.value = scriptParameters.password;
cpeParameters.password1.updated = true;
}
else {
if(typeof scriptParameters.passwordIndex != 'undefined') {
PasswordIndex = parseInt(scriptParameters.passwordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "SecurityMode: Key index must be between 1 and 4";
cpeParameters.passwordIndex.value = scriptParameters.passwordIndex;
cpeParameters.passwordIndex.updated = true;
if (typeof scriptParameters.password1 != 'undefined' && scriptParameters.password1 !== null) {
if(scriptParameters.password1.length !== 0 && scriptParameters.password1.length != 10)
throw "Password length invalid. Must be 10 ASCII characters";
cpeParameters.password1.value = scriptParameters.password1;
cpeParameters.password1.updated = true;
}
}
}
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
if (typeof scriptParameters.password != 'undefined' && scriptParameters.password !== null) {
if(scriptParameters.password.length !== 0 && scriptParameters.password.length != 13)
throw "Password length invalid. Must be 13 ASCII characters";
cpeParameters.passwordIndex.value = PasswordIndex;
cpeParameters.passwordIndex.updated = true;
cpeParameters.password1.value = scriptParameters.password;
cpeParameters.password1.updated = true;
}
else {
if(typeof scriptParameters.passwordIndex != 'undefined') {
PasswordIndex = parseInt(scriptParameters.passwordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "SecurityMode: Key index must be between 1 and 4";
cpeParameters.passwordIndex.value = scriptParameters.passwordIndex;
cpeParameters.passwordIndex.updated = true;
if (typeof scriptParameters.password1 != 'undefined' && scriptParameters.password1 !== null) {
if(scriptParameters.password1.length !== 0 && scriptParameters.password1.length != 13)
throw "Password length invalid. Must be 13 ASCII characters";
cpeParameters.password1.value = scriptParameters.password1;
cpeParameters.password1.updated = true;
}
}
}
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.password != 'undefined' && scriptParameters.password !== null) {
if(scriptParameters.password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.password.value = scriptParameters.password;
cpeParameters.password.updated = true;
}
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.password != 'undefined' && scriptParameters.password !== null) {
if(scriptParameters.password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.password.value = scriptParameters.password;
cpeParameters.password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var deviceId = scriptParameters.deviceId; var response = dsc.getDeviceParameterLogs(deviceId);
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var data = { label: "TR69 Config", parameters: [ { label: "Connection Request Username", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" }, { label: "Connection Request Password", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" }, { label: "Connection Request URL", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestURL", readOnly: true }, { label: "Periodic Inform Interval", cpeParameterName:"InternetGatewayDevice.ManagementServer.PeriodicInformInterval" }, { label: "CPE Username", cpeParameterName:"InternetGatewayDevice.ManagementServer.Username" }, { label: "CPE Password", cpeParameterName:"InternetGatewayDevice.ManagementServer.Password" } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters });
response; var dsc = require("deviceserviceconfiguration");
var data = { label: "DHCP", parameters: [ { label:"Enable DHCP service", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPServerEnable" }, { label:"DNS Servers", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DNSServers" }, { label:"DHCP Start Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MinAddress" }, { label:"DHCP End Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.MaxAddress" }, { label:"Lease Time", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPLeaseTime" }, { label:"LAN IP Address", cpeParameterName:"InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.IPInterface.1.IPInterfaceIPAddress" } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters });
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var dsc = require("deviceserviceconfiguration");
var channelDataType = { type: "ENUM", choice:[ { systemName: "0", friendlyName: "auto" }, { systemName: "1", friendlyName: "1" }, { systemName: "2", friendlyName: "2" }, { systemName: "3", friendlyName: "3" }, { systemName: "4", friendlyName: "4" }, { systemName: "5", friendlyName: "5" }, { systemName: "6", friendlyName: "6" }, { systemName: "7", friendlyName: "7" }, { systemName: "8", friendlyName: "8" }, { systemName: "9", friendlyName: "9" }, { systemName: "10", friendlyName: "10" }, { systemName: "11", friendlyName: "11" } ] };
var conditionalRendering = [ { group: "WEP-Open", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Open"] }, { group: "WEP-Shared", dependsOnParameter: "SecurityMode", showOnValue: ["WEP-Shared"] }, { group: "WPA", dependsOnParameter: "SecurityMode", showOnValue: ["TKIPEncryption", "AESEncryption", "TKIPandAESEncryption"] } ];
var data = { label: "WiFi", parameters: [ { label: "SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID" }, { label: "Enabled", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Enable" }, { label: "Broadcast SSID", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconAdvertisementEnabled" }, { label: "Channel", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel", dataType: channelDataType }, { label: "Current Password Index", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKeyIndex", groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 1", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.1.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 2", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.2.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 3", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.3.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password 4", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WEPKey.4.WEPKey", description: "5 chars for 64bit and 13 chars for 128bit", dataType: { type: "PASSWORD", "min": 0, "max": 13 }, groups: ["WEP-Open", "WEP-Shared"] }, { label: "Password", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.PreSharedKey.1.PreSharedKey", group: "WPA" }, { label: "WPAA uthentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode", internalOnly: true }, { label: "WPA Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes", internalOnly: true }, { label: "Basic Authentication Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode", internalOnly: true }, { label: "Basic Encryption Modes", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicEncryptionModes", internalOnly: true }, { label: "Beacon Type", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BeaconType", internalOnly: true }, { label: "Mode", cpeParameterName: "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Standard", internalOnly: true }, { label: "Mode", description: "Standard Mode", readCallback: readStandardModeCallback, writable: false }, { label: "Security Mode", description: "Security Mode", readCallback: readSecurityModeCallback } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, customWrite: update, conditionalRendering: conditionalRendering });
/*
- callback for standard mode
*/
function readStandardModeCallback(cpeParameters) {
if (typeof cpeParameters.Standard == 'undefined' || cpeParameters.Standard === null) { return null; } if (typeof cpeParameters.Standard.value == 'undefined' || cpeParameters.Standard.value === null) { log.info("Standard value not set. Most likely parameter not set as RELEVANT in device model"); return null; }
var parameter = {}; parameter.writable = cpeParameters.Standard.writable; parameter.stale = cpeParameters.Standard.stale; parameter.value = cpeParameters.Standard.value;
if(parameter.value == "b, g") { parameter.value = "Mixed 11b & 11g"; } if(parameter.value == "b, g, n") { parameter.value = "Mixed 11b, 11g & 11n"; } if(parameter.value == "n") { parameter.value = "11n Only"; } if(parameter.value == "b") { parameter.value = "11b Only"; } if(parameter.value == "g") { parameter.value = "11g Only"; }
parameter.dataType = { type: "ENUM", choice:[ { systemName:"b", friendlyName: "11b Only" }, { systemName:"g", friendlyName: "11g Only" }, { systemName:"b, g", friendlyName: "Mixed 11b & 11g" }, { systemName:"n", friendlyName: "11n Only" }, { systemName:"b, g, n", friendlyName: "Mixed 11b, 11g & 11n" } ] }; return parameter; }
/*
- callback for security mode */ function readSecurityModeCallback(cpeParameters) { if (typeof cpeParameters.BeaconType == 'undefined' || cpeParameters.BeaconType === null) { return null; } if (typeof cpeParameters.BeaconType.value == 'undefined' || cpeParameters.BeaconType.value === null) { log.info("BeaconType value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.WPAEncryptionModes == 'undefined' || cpeParameters.WPAEncryptionModes === null) { return null; } if (typeof cpeParameters.WPAEncryptionModes.value == 'undefined' || cpeParameters.WPAEncryptionModes.value === null) { log.info("WPAEncryptionModes value not set. Most likely parameter not set as RELEVANT in device model"); return null; } if (typeof cpeParameters.BasicAuthenticationMode == 'undefined' || cpeParameters.BasicAuthenticationMode === null) { return null; } if (typeof cpeParameters.BasicEncryptionModes == 'undefined' || cpeParameters.BasicEncryptionModes === null) { return null; }
var security;
if (cpeParameters.BasicEncryptionModes.value == "WEPEncryption") {
security = "WEP-Open";
if (cpeParameters.BasicAuthenticationMode.value == "SharedAuthentication") {
security = "WEP-Shared";
}
} else {
if (cpeParameters.BeaconType.value == "Basic") {
security = "Disabled";
} else {
if(cpeParameters.WPAAuthenticationMode.value == "EAPAuthentication") {
security = "EAPAuthentication";
} else {
security = cpeParameters.WPAEncryptionModes.value;
}
}
}
log.info("--------------------- security = " + cpeParameters.WPAEncryptionModes.value); var parameter = {}; parameter.writable = cpeParameters.BeaconType.writable; parameter.stale = cpeParameters.BeaconType.stale; parameter.value = security; parameter.disabled = false; parameter.dataType = { type: "ENUM", choice:[ { systemName: "Disabled", friendlyName : "Disabled" }, { systemName: "WEP-Open", friendlyName : "WEP-Open" }, { systemName: "WEP-Shared", friendlyName : "WEP-Shared" }, { systemName: "TKIPEncryption", friendlyName : "WPA-PSK(TKIP)" }, { systemName: "AESEncryption", friendlyName : "WPA2-PSK(AES)" }, { systemName: "TKIPandAESEncryption", friendlyName : "Mixed WPA/WPA2" }, { systemName: "EAPAuthentication", friendlyName : "Enterprise (802.1x)" } ] };
return parameter; }
function update(cpeParameters) {
log.info("CPE script parameters:"); for(var name in scriptParameters) { log.info(" " + name + "=" + scriptParameters[name]); }
for(name in scriptParameters) {
var value = scriptParameters[name];
switch (name){
case "SSID":
cpeParameters.SSID.value = value;
cpeParameters.SSID.updated = true;
break;
case "Channel":
if(value < 0 || value > 11)
throw "Channel number invalid. Must be 1 - 11";
cpeParameters.Channel.value = value;
cpeParameters.Channel.updated = true;
break;
case "Enabled":
cpeParameters.Enabled.value = value === "true" ? 1 : 0;
cpeParameters.Enabled.updated = true;
break;
case "BroadcastSSID":
cpeParameters.BroadcastSSID.value = value === "true" ? 1 : 0;
cpeParameters.BroadcastSSID.updated = true;
break;
case "Standard":
cpeParameters.Standard.value = value;
cpeParameters.Standard.updated = true;
break;
case "SecurityMode":
if (value == "Disabled") {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "WEP-Shared" || value == "WEP-Open") {
if(typeof scriptParameters.CurrentPasswordIndex != 'undefined') {
var PasswordIndex = parseInt(scriptParameters.CurrentPasswordIndex,10);
if(PasswordIndex < 1 && PasswordIndex > 4)
throw "Key index must be between 1 and 4";
cpeParameters.CurrentPasswordIndex.value = scriptParameters.CurrentPasswordIndex;
cpeParameters.CurrentPasswordIndex.updated = true;
} else {
throw "Key index must be between 1 and 4";
}
if (typeof scriptParameters.Password1 != 'undefined' && scriptParameters.Password1 != null) {
if(scriptParameters.Password1.length !== 0 && scriptParameters.Password1.length != 13 && scriptParameters.Password1.length != 5)
throw "Password1 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password1.value = scriptParameters.Password1;
cpeParameters.Password1.updated = true;
}
if (typeof scriptParameters.Password2 != 'undefined' && scriptParameters.Password2 != null) {
if(scriptParameters.Password2.length !== 0 && scriptParameters.Password2.length != 13 && scriptParameters.Password2.length != 5)
throw "Password2 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password2.value = scriptParameters.Password2;
cpeParameters.Password2.updated = true;
}
if (typeof scriptParameters.Password3 != 'undefined' && scriptParameters.Password3 != null) {
if(scriptParameters.Password3.length !== 0 && scriptParameters.Password3.length != 13 && scriptParameters.Password3.length != 5)
throw "Password3 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password3.value = scriptParameters.Password3;
cpeParameters.Password3.updated = true;
}
if (typeof scriptParameters.Password4 != 'undefined' && scriptParameters.Password4 != null) {
if(scriptParameters.Password4.length !== 0 && scriptParameters.Password4.length != 13 && scriptParameters.Password4.length != 5)
throw "Password4 length invalid. Must be 5 (64bit) or 13 (128bit) ASCII characters";
cpeParameters.Password4.value = scriptParameters.Password4;
cpeParameters.Password4.updated = true;
}
if(value == "WEP-Shared") {
cpeParameters.BasicAuthenticationMode.value = "SharedAuthentication";
cpeParameters.BasicAuthenticationMode.updated = true;
} else {
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
}
cpeParameters.BasicEncryptionModes.value = "WEPEncryption";
cpeParameters.BasicEncryptionModes.updated = true;
cpeParameters.BeaconType.value = "Basic";
cpeParameters.BeaconType.updated = true;
} else if(value == "EAPAuthentication") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "EAPAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = "TKIPandAESEncryption";
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
} else if(value == "TKIPEncryption" || value == "AESEncryption" || value == "TKIPandAESEncryption") {
cpeParameters.BeaconType.value = "WPA";
cpeParameters.BeaconType.updated = true;
cpeParameters.WPAAuthenticationMode.value = "PSKAuthentication";
cpeParameters.WPAAuthenticationMode.updated = true;
cpeParameters.WPAEncryptionModes.value = value;
cpeParameters.WPAEncryptionModes.updated = true;
cpeParameters.BasicAuthenticationMode.value = "None";
cpeParameters.BasicAuthenticationMode.updated = true;
cpeParameters.BasicEncryptionModes.value = "None";
cpeParameters.BasicEncryptionModes.updated = true;
if (typeof scriptParameters.Password != 'undefined' && scriptParameters.Password !== null) {
if(scriptParameters.Password.length < 8)
throw "Password length invalid. Must be 8-63 ASCII characters";
cpeParameters.Password.value = scriptParameters.Password;
cpeParameters.Password.updated = true;
}
}
break;
default :
break;
}
} return cpeParameters; }
response; var acs = require("acs"); var composer = require("datacomposer");
var deviceId = scriptParameters.deviceId; var cpeParameterNames = [ { cpeParameterName: "InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.TotalBytesReceived" } ];
var results = acs.getDeviceParametersFromRest({ deviceId: deviceId, names: cpeParameterNames });
var response = composer.newGraphResponse(results[0].value, Date.now()); response; var acs = require("acs"); var composer = require("datacomposer");
var deviceId = scriptParameters.deviceId; var cpeParameterNames = [ { cpeParameterName: "InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.TotalBytesSent" } ];
var results = acs.getDeviceParametersFromRest({ deviceId: deviceId, names: cpeParameterNames });
var response = composer.newGraphResponse(results[0].value, Date.now()); response; var dsc = require("deviceserviceconfiguration");
var data = { label: "Connected Devices", name: "ConnectedDevices", writable: false, readCallback: readTableCallback, parameters: [ // Host name or interface name { name: "Name", label: "Name/Alias", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.Name" }, // Hard-coded: "INTERFACE" | "HOST" { name: "Type", label: "Type", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.Type" }, { name: "MACAddress", label: "MAC", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.MACAddress" }, { name: "IPAddress", label: "IP", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.IPAddress" }, { name: "Active", label: "Active", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.Active" }, { name: "InterfaceType", label: "Interface Type", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.InterfaceType" }, { name: "SignalStrength", label: "Signal Strength", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.SignalStrength" }, { name: "AcsDeviceLink", label: "AcsDeviceLink", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.AcsDeviceLink" }, { name: "AcsDeviceType", label: "AcsDeviceType", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.AcsDeviceType" }/, { name: "BytesReceived", label: "Bytes Received", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.WifiBytesReceived" }, { name: "BytesSent", label: "Bytes Sent", cpeParameterName: "Device.X_Incognito.ConnectedDevices.Host.{i}.WifiBytesSent" }/ ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters, isConnectedDevices: true, refreshInterval: 60 });
/* { "description":"", "dataType":{ "type":"TABLE", "elements":[ { "name":"Name", "friendlyName":"Name/Alias", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"Type", "friendlyName":"Type", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"Category", "friendlyName":"Category", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"MACAddress", "friendlyName":"MAC", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"IPAddress", "friendlyName":"IP", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"Active", "friendlyName":"Active", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"InterfaceType", "friendlyName":"Interface Type", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"SignalStrength", "friendlyName":"Signal Strength", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"BytesReceived", "friendlyName":"Bytes Received", "writable":false, "dataType":{ "type":"STRING" } }, { "name":"BytesSent", "friendlyName":"Bytes Sent", "writable":false, "dataType":{ "type":"STRING" } } ] }, "value":[ { "id":"1", "MACAddress":"ff:ee:25:00:00:01", "Type":"INTERFACE", "Name":"Ethernet 1" }, { "id":"2", "Type":"HOST", "IPAddress":"192.0.0.2", "MACAddress":"ff:ff:ff:00:00:01", "Category":"apple-tv", "Name":"Device1", "InterfaceType":"Ethernet", "SignalStrength":null, "Active":"true" }, { "id":"11", "BytesReceived":"13317137", "BytesSent":"753439697", "Type":"INTERFACE", "Name":"WiFi 2.4Ghz" }, { "id":"12", "Type":"HOST", "IPAddress":"192.0.0.27", "MACAddress":"ff:ff:ff:00:00:1A", "Category":null, "Name":"Device26 (alias2)", "InterfaceType":"WIFI", "SignalStrength":null, "Active":"true" }, { "id":"13", "Type":"HOST", "IPAddress":"192.0.0.39", "MACAddress":"ff:ff:ff:00:00:26", "Category":null, "Name":"Device38", "InterfaceType":"WIFI", "SignalStrength":null, "Active":"true" }, ], "name":"ConnectedDevices", "friendlyName":"Connected Devices" } */
function readTableCallback(table) { var tableSize = table.value.length; var connectedDevicesTables = []; var currentTableIdx = -1; for (var i = 0; i < tableSize; i++) { var row = table.value[i]; if (row.id === '*') { continue; } if (row.Type === 'INTERFACE') { connectedDevicesTables.push({ name: row.Name, rows: [] }); currentTableIdx = connectedDevicesTables.length - 1; } else { if (connectedDevicesTables.length === 0) { throw 'The Connected Devices table is not categorized based on interfaces correctly'; } delete row.id; connectedDevicesTables[currentTableIdx].rows.push(reformatRow(row)); } }
//table.columns = table.dataType.elements; table.dataType.type = 'MULTI-TABLE'; table.order = 0; table.friendlyName = 'Table';
table.dataType.columns = table.dataType.elements; delete table.dataType.elements; var numColumns = table.dataType.columns.length;
for (var i = 0; i < numColumns; i++) { setColumnHeaderStyle(table.dataType.columns[i]); }
table.tables = connectedDevicesTables; delete table.value;
return table; }
/**
-
A function that restructures the service config output into a multi-table
-
output format that used
-
@param row
-
@returns */ function reformatRow(row) { if (row === null || row === undefined || typeof row !== 'object') { return row; } delete row.Type; var newRow = {}; for (var field in row) { newRow[field] = { value: row[field] };
setCellStyle(field, newRow[field]); } newRow = postFormatRow(newRow); return newRow; }
/**
- A callback function to perform any custom post-processing
- on a table row after the row construction
- @param newRow
- @returns */ function postFormatRow(newRow) { if (newRow.InterfaceType.value === 'Ethernet' && newRow.SignalStrength !== undefined && newRow.SignalStrength !== null) { newRow.SignalStrength.value = 'NA'; newRow.SignalStrength.className = undefined; } return newRow; }
/**
- A function to customize the format and behavior
- @param columnHeader
- @returns */ function setColumnHeaderStyle(columnHeader) { if (columnHeader) { columnHeader.align = 'center'; if (columnHeader.name === 'Type' || columnHeader.name === 'AcsDeviceLink') { columnHeader.hidden = true; } else { columnHeader.hidden = false; } } }
/**
- This function serves as a callback to customize the style
- of each cell in a table. The function can be used to do
- the following:
-
- Reformat the value of the table cell
-
- Set the style of the specific cell. Supported style
- parameters include:
- a. align: 'right', 'center' 'left'
- b. className: 'status-failure-background',
-
'status-warning-background',
-
'status-success-background'.
-
className is used to set the background color
-
of the specified cell. More className parameters
-
will be added in the future.
- @param columnName
- @param rowCell
- @returns */ function setCellStyle(columnName, rowCell) { if (rowCell) { rowCell.align = 'center'; if (columnName === 'SignalStrength') { var v = 0; if ((typeof rowCell.value) === 'number') { v = rowCell.value; } if ((typeof rowCell.value) === 'string') { try { v = parseInt(rowCell.value,10); } catch (error) {} } if (v < -80) { rowCell.className = 'status-failure-background'; } else if (v < -67) { rowCell.className = 'status-warning-background'; } else { rowCell.className = 'status-success-background'; } } } }
/**
-
TODO move this method to deviceserviceconfiguration module
-
@param response
-
@returns */ function reformatResponse(response) { response.tabs = response.parameters; delete response.parameters; if (response.tabs && response.tabs.length > 0) { var dataType = JSON.parse(JSON.stringify(response.tabs[0].dataType)); dataType.type = 'GRAPH'; var tables = JSON.parse(JSON.stringify(response.tabs[0].tables));
response.tabs.push({ order: 1, friendlyName: "Graph", dataType: dataType, tables: tables }); }
} reformatResponse(response); response; var dsc = require("deviceserviceconfiguration");
var data = { label: "TR69 Config", parameters: [ { label: "Connection Request Username", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" }, { label: "Connection Request Password", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" }, { label: "Connection Request URL", cpeParameterName:"InternetGatewayDevice.ManagementServer.ConnectionRequestURL", readOnly: true }, { label: "Periodic Inform Interval", cpeParameterName:"InternetGatewayDevice.ManagementServer.PeriodicInformInterval" }, { label: "CPE Username", cpeParameterName:"InternetGatewayDevice.ManagementServer.Username" }, { label: "CPE Password", cpeParameterName:"InternetGatewayDevice.ManagementServer.Password" } ] };
var response = dsc.createResponse({ data: data, scriptParameters: scriptParameters });
response; var acs = require('acs');
var deviceId = scriptParameters.deviceId;
var response = acs.getDeviceInfo(deviceId); var ui_response = createDeviceInfoPanelUiResponse(response);
/**
- Below is a sample response for device information rest call which can be used to populate device info panel.
- For more information, please refer to Rest API documentation at {@link https://developer.incognito.com/acs/rest-api/acs-device#misc-device-information}
- { "protocol": "TR069", "tags": [], "oui": "FFFFFF", "productClass": "MockDevice", "serial": "1", "syncStatus": "SYNCHRONIZED", "connectivityStatus": "UNKNOWN", "firmwareVersion": "1.0.0.1", "manufacturer": "Incognito", "hardwareVersion": "1.0.0.0", "discovered": "2019-10-16T15:24:45", "lastModified": "2019-10-19T18:51:33", "lastModifiedBy": "Administrator", "dhcpOption82": null, "macAddr": "ff:ff:5f:e5:83:99", "ipAddr": "172.0.0.10, 192.168.0.16", "xmpp": false, "stun": true, "upTime": "5", "deviceModelSummary": { "name": "Incognito_MockDevice_FFFFFF", "id": "3535a4b9-6560-db31-60df-3712c7d1c303" }, "clusterId": "default", "division": null, "nextExpectedInform": "2019-10-19T18:51:36", "imei": null, "iccid": null, "mqttInformInterval": null, "numMissedInform": null, "lastBoot": null, "subscriberId": null, "interfaces": [], "parameters": [ { "name": "periodicInformInterval", "value": "30" }, { "name": "connectionRequestUsername", "value": "" }, { "name": "connectionRequestPassword", "value": "" }, { "name": "cpeUsername", "value": "testUsr" }, { "name": "cpePassword", "value": "testPwd" }, { "name": "stunEnabled", "value": false }, { "name": "stunServerAddress", "value": null }, { "name": "stunServerPort", "value": "3478" }, { "name": "stunUsername", "value": null }, { "name": "stunPassword", "value": null }, { "name": "xmppEnabled", "value": null }, { "name": "xmppServerAddress", "value": null }, { "name": "xmppServerPort", "value": null }, { "name": "xmppUsername", "value": null }, { "name": "xmppPassword", "value": null }, { "name": "xmppDomain", "value": null }, { "name": "xmppResource", "value": null }, { "name": "xmppJabberId", "value": null }, { "name": "discoveryMethod", "value": null }, { "name": "ignoreError", "value": null }, { "name": "cookiePath", "value": null }, { "name": "batchSize", "value": null } ], "lastInformTime": "2019-10-19T18:51:06", "taskId": "2c26cd3e-e534-55ef-a759-d91bfe8a0471" } */
function createDeviceInfoPanelUiResponse(deviceInfo) {
var deviceInfoPanelData = { "tabs": [ { "order": 0, "friendlyName": "Summary", "rows": [ { "friendlyName": "Manufacturer", "value": deviceInfo.manufacturer }, { "friendlyName": "IPs", "value": deviceInfo.ipAddr }, { "friendlyName": "MACs", "value": deviceInfo.macAddr }, { "friendlyName": "Firmware Version", "value": deviceInfo.firmwareVersion }, { "friendlyName": "Hardware Version", "value": deviceInfo.hardwareVersion }, { "friendlyName": "OUI", "value": deviceInfo.oui }, { "friendlyName": "Product Class", "value": deviceInfo.productClass }, { "friendlyName": "Serial", "value": deviceInfo.serial }, { "friendlyName": "CWMP Cluster ID", "value": deviceInfo.clusterId } ] } /*, { "order": 1, "friendlyName": "XMPP", "rows": [ { "friendlyName": "Enabled", "value": deviceInfo.xmpp }, { "friendlyName": "Manufacturer", "value": deviceInfo.manufacturer }, { "friendlyName": "Server Address", "value": getXmppServerAddress(deviceInfo.parameters) }, { "friendlyName": "Server Port", "value": getXmppServerPort(deviceInfo.parameters) } ] } */ ] }; return deviceInfoPanelData; }
/**
- Helper method to extract a given parameter from device info parameters (deviceInfo.parameters)
- @param parameterName
- @param parameters
- @returns */ function findDeviceInfoParameter(parameterName, parameters) { if (!Array.isArray(parameters)) { return undefined; } for (var i = 0; i < parameters.length; i++) { if (parameters[i].name === parameterName) { return parameters[i].value; } } return undefined; }
/**
- Extract stunEnabled flag from device info parameters structure
- @param parameters
- @returns */ function getStunEnabled(parameters) { return findDeviceInfoParameter('stunEnabled', parameters) || false; }
/**
- Extract Server address from device info parameters
- @param parameters
- @returns */ function getXmppServerAddress(parameters) { return findDeviceInfoParameter('xmppServerAddress', parameters) || ''; }
/**
- Extract Server Port from device info parameters
- @param parameters
- @returns */ function getXmppServerPort(parameters) { return findDeviceInfoParameter('xmppServerPort', parameters) || ''; }
ui_response; icon wifi-signal index 16 size size-1x1 service WiFi 8 icon wifi-signal index 19 size size-1x1 service WiFi 3 index 11 size size-1x1 service TR-69 Config icon wifi-signal index 15 size size-1x1 service WiFi 4 icon wifi-signal index 18 size size-1x1 service WiFi 7 index 1 readOnly false serviceId null selectable false icon file index 28 readOnly true size size-1x1 service Device Log icon wifi-signal index 22 size size-1x1 service WiFi 1 icon stethoscope index 24 size size-1x1 index 12 unit second readOnly true size size-1x1 parameter InternetGatewayDevice.DeviceInfo.UpTime index 13 unit byte readOnly true size size-1x1 parameter InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.TotalBytesSent index 23 size size-1x1 service DHCP icon wifi-signal index 17 size size-1x1 service WiFi 6 icon three-desktops index 25 size size-1x1 yMin 0 unit byte graphType linegraph size size-1x1 lowThreshold 0 service Bytes Sent index 26 highThreshold 0 xMin 0 yMin 0 unit byte graphType linegraph size size-1x1 lowThreshold 0 service Bytes Received index 27 highThreshold 0 xMin 0 index 14 unit byte readOnly true size size-1x1 parameter InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.TotalBytesReceived index 0 readOnly false serviceId null selectable false index 10 readOnly false serviceId null selectable false index 2 readOnly false serviceId null selectable false icon wifi-signal index 21 size size-1x1 service WiFi 2 icon wifi-signal index 20 size size-1x1 service WiFi 5 TRUE {"links":{"#panelStatusOperationsFailed":{"url":"#devices/{deviceId}/failed-operations"}},"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]},"rules":{"type":"numeric","threshold":"NONE"},"unit":null} {"dataSource":{"type":"DASHBOARD_SCRIPT","sourceId":"##dashboard.tr069_config.name##","sourceIdSet":[]},"buttons":{"handlers":[{"text":"Save","handler":"saveServiceConfigParameters","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"POST"},"visible":true,"tab":null},{"text":"Cancel","handler":"cancel","endpoint":{"url":"/deviceoperations/cancellation","verb":"POST"},"visible":false,"tab":null},{"text":"Refresh","handler":"refresh","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"GET"},"visible":true,"tab":null}]},"readOnly":false} {"dataSource":{"type":"DEVICE_PARAMETER","sourceId":"InternetGatewayDevice.DeviceInfo.UpTime","sourceIdSet":[]},"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]},"duration":{"enable":true,"unit":"seconds"}} {"buttons":{"handlers":[{"text":"Run","handler":"runDiagnostics","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"POST"},"visible":true,"tab":null},{"text":"Cancel","handler":"cancelDiagnostics","endpoint":{"url":"/deviceoperations/cancellation","verb":"POST"},"visible":false,"tab":null}]},"diagnosticsConfig":[{"id":"TraceRoute Diagnostics","subType":"TRACEROUTE","diagnosticParameters":[{"name":"InternetGatewayDevice.TraceRouteDiagnostics.MaxHopCount","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.Host","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.Timeout","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.NumberOfTries","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.Interface","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.DataBlockSize","value":null},{"name":"InternetGatewayDevice.TraceRouteDiagnostics.DSCP","value":null}]}]} {"buttons":{"handlers":[{"text":"Initiate Session","handler":"initiateSession","endpoint":{"url":"/devices/{deviceId}/connectionrequest?async=true","verb":"POST"},"visible":true,"tab":null}]},"websockets":{"ws":"/devices/{deviceId}?X-Atmosphere-tracking-id=0&X-Cache-Date=0&Content-Type=application/json&X-atmo-protocol=true","handlers":[{"type":"TR69_INFORM_EVENT"},{"type":"TR69_SESSION_EVENT"},{"type":"TR69_CONNECTION_REQUEST_EVENT"}]},"readOnly":false} {"actionsConfig":[],"moreButton":{"handlers":[{"text":"##dashboard.more_device_actions##","handler":"showMoreActions","visible":true}]}} {"actionsConfig":[{"id":"ManageOperation","text":"Manage Operations","url":"#devices/{deviceId}/active-operations","order":1,"visible":true},{"id":"ObjectStructParameter","text":"Manage Object Structure & Parameters","url":"#devices/{deviceId}/parameters","order":2,"visible":true},{"id":"ManageGroupings","text":"Manage Groupings","url":"#devices/{deviceId}/device-groups","order":3,"visible":true},{"id":"ViewDeviceInfo","text":"View Device Information","url":"#devices/{deviceId}/device","order":4,"visible":true},{"id":"DeviceWorkbench","text":"Device Workbench","url":"#devices/{deviceId}/workbench","order":5,"visible":true},{"id":"ComplianceTestSuite","text":"Run Compliance Test Suite","url":"#devices/{deviceId}/execute-device-compliance-suite","order":6,"visible":true},{"id":"PerformActions","text":"Perform Actions","url":"#devices/{deviceId}/devicemodel/{deviceModelId}/device_actions","order":7,"visible":true},{"id":"PerformDiagnostics","text":"Perform Diagnostics","url":"#devices/{deviceId}/devicemodel/{deviceModelId}/diagnostics","order":8,"visible":true}]} {"links":{"#panelStatusOperationsActive":{"url":"#devices/{deviceId}/active-operations"}},"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]},"rules":{"type":"numeric","threshold":"NONE"},"unit":null} {"diagnosticsConfig":[{"id":"Download Diagnostics","subType":"DOWNLOADSPEED","diagnosticParameters":[{"name":"InternetGatewayDevice.DownloadDiagnostics.DownloadURL","value":"http://35.215.210.14:9090/download.bin"},{"name":"InternetGatewayDevice.DownloadDiagnostics.Interface","value":""},{"name":"InternetGatewayDevice.DownloadDiagnostics.DSCP","value":""},{"name":"InternetGatewayDevice.DownloadDiagnostics.EthernetPriority","value":""}]},{"id":"Upload Diagnostics","subType":"UPLOADSPEED","diagnosticParameters":[{"name":"InternetGatewayDevice.UploadDiagnostics.EthernetPriority","value":""},{"name":"InternetGatewayDevice.UploadDiagnostics.UploadURL","value":"http://35.215.210.14:9090/upload.bin"},{"name":"InternetGatewayDevice.UploadDiagnostics.DSCP","value":""},{"name":"InternetGatewayDevice.UploadDiagnostics.Interface","value":""},{"name":"InternetGatewayDevice.UploadDiagnostics.TestFileLength","value":"1000"}]}],"tabName":"98fb32c6-5c3a-ae4a-3999-3a52118865a1","downloadEnabled":true,"uploadEnabled":true,"InternetGatewayDevice.DownloadDiagnostics.DownloadURL":"http://35.215.210.14:9090/download.bin","InternetGatewayDevice.DownloadDiagnostics.Interface":"","InternetGatewayDevice.DownloadDiagnostics.DSCP":"","InternetGatewayDevice.DownloadDiagnostics.EthernetPriority":"","InternetGatewayDevice.UploadDiagnostics.EthernetPriority":"","InternetGatewayDevice.UploadDiagnostics.UploadURL":"http://35.215.210.14:9090/upload.bin","InternetGatewayDevice.UploadDiagnostics.DSCP":"","InternetGatewayDevice.UploadDiagnostics.Interface":"","InternetGatewayDevice.UploadDiagnostics.TestFileLength":"1000"} {"dataSource":{"type":"DASHBOARD_SCRIPT","sourceId":"##dashboard.device_info.name##","sourceIdSet":[]},"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"panelType":"PANEL_STATUS_ONLINE"}}]},"buttons":{"handlers":[{"text":"Refresh","handler":"refresh","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"GET"},"visible":true,"tab":null}]},"readOnly":true} {"diagnosticsConfig":[{"id":"IP Ping Diagnostics","subType":"IPPING","diagnosticParameters":[{"name":"InternetGatewayDevice.IPPingDiagnostics.Interface","value":""},{"name":"InternetGatewayDevice.IPPingDiagnostics.Host","value":"8.8.8.8"},{"name":"InternetGatewayDevice.IPPingDiagnostics.DSCP","value":""},{"name":"InternetGatewayDevice.IPPingDiagnostics.DataBlockSize","value":""},{"name":"InternetGatewayDevice.IPPingDiagnostics.Timeout","value":""},{"name":"InternetGatewayDevice.IPPingDiagnostics.NumberOfRepetitions","value":""}]}],"tabName":"5c987c0f-f453-1f54-be91-71c4bb6aed6c","InternetGatewayDevice.IPPingDiagnostics.Interface":"","InternetGatewayDevice.IPPingDiagnostics.Host":"8.8.8.8","InternetGatewayDevice.IPPingDiagnostics.DSCP":"","InternetGatewayDevice.IPPingDiagnostics.DataBlockSize":"","InternetGatewayDevice.IPPingDiagnostics.Timeout":"","InternetGatewayDevice.IPPingDiagnostics.NumberOfRepetitions":""} {"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]}} {"tabName":"a839facf-9c47-578c-3c84-70b47c95c2e3","diagnosticsConfig":[{"diagnosticParameters":[]}],"panelSource":"PANEL_DASHBOARD_KIBANA_IFRAME","pixelHeight":"","url":"/acs/kibana/app/visualize#/edit/c44a9eb0-ba99-11ec-96e0-c516b8f93291?embed=true&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-',default_timefield:'@timestamp',filter:(language:kuery,query:'serial.keyword:{serialNumber}'),id:'61ca57f0-469d-11e7-af02-69e470af7417',index_pattern:'monitored-parameter',interval:'15m',isModelInvalid:!f,series:!((axis_position:right,chart_type:line,color:%2368BC00,fill:'0.1',filter:(language:kuery,query:''),formatter:number,id:'61ca57f1-469d-11e7-af02-69e470af7417',label:'',line_width:1,metrics:!((id:'61ca57f2-469d-11e7-af02-69e470af7417',type:count)),point_size:1,separate_axis:0,split_color_mode:kibana,split_filters:!((color:%2368BC00,filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%201'),id:c0235550-902a-11ec-8823-65b10961c04e,label:'Canal%201'),(color:'rgba(84,179,153,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%202'),id:c94521e0-902a-11ec-8823-65b10961c04e,label:'Canal%202'),(color:'rgba(211,96,134,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%203'),id:d3408590-902a-11ec-8823-65b10961c04e,label:'Canal%203'),(color:'rgba(145,112,184,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%204'),id:d7d269c0-902a-11ec-8823-65b10961c04e,label:'Canal%204'),(color:'rgba(202,142,174,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%205'),id:dd5341d0-902a-11ec-8823-65b10961c04e,label:'Canal%205'),(color:'rgba(214,191,87,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%206'),id:e0a727c0-902a-11ec-8823-65b10961c04e,label:'Canal%206'),(color:'rgba(185,168,136,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%207'),id:e76b5540-902a-11ec-8823-65b10961c04e,label:'Canal%207'),(color:'rgba(218,139,69,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%208'),id:ea256c30-902a-11ec-8823-65b10961c04e,label:'Canal%208'),(color:'rgba(170,101,86,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%209'),id:eda32140-902a-11ec-8823-65b10961c04e,label:'Canal%209'),(color:'rgba(231,102,76,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%2010'),id:f106bea0-902a-11ec-8823-65b10961c04e,label:'Canal%2010'),(color:'rgba(22,0,188,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.Channel:%2011'),id:f3c1bff0-902a-11ec-8823-65b10961c04e,label:'Canal%2011')),split_mode:filters,stacked:none,type:timeseries)),show_grid:1,show_legend:1,time_field:'@timestamp',tooltip_mode:show_all,type:timeseries),title:'Channel%202.4%20Geral%20-%20Per%20Device',type:metrics))"} {"dataSource":{"type":"DASHBOARD_SCRIPT","sourceId":"##dashboard.connected_devices_topology.name##","sourceIdSet":[]},"buttons":{"handlers":[{"text":"Refresh","handler":"refresh","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"GET"},"visible":true,"tab":null}]},"readOnly":false} {"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]},"rules":{"type":"numeric","threshold":"NONE"}} {"readOnly":false,"tabName":"a839facf-9c47-578c-3c84-70b47c95c2e3","dataSource":{"type":"SERVICE_CONFIGURATION_SCRIPT","sourceId":"WiFi 1","sourceIdSet":[]},"diagnosticsConfig":[{"diagnosticParameters":[]}],"panelSource":"PANEL_DASHBOARD_SERVICE_CONFIG","dataType":"SERVICE_CONFIGURATION_SCRIPT","dataSourceServiceConfig":"6c2a2483-5cfd-58de-77ec-609e4f51e947"} {"tabName":"a839facf-9c47-578c-3c84-70b47c95c2e3","diagnosticsConfig":[{"diagnosticParameters":[]}],"panelSource":"PANEL_DASHBOARD_KIBANA_IFRAME","pixelHeight":"","url":"/acs/kibana/app/visualize#/edit/2872d820-bb22-11ec-96e0-c516b8f93291?embed=true&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-24h,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-',default_timefield:'@timestamp',filter:(language:kuery,query:'serial.keyword:{serialNumber}'),id:'61ca57f0-469d-11e7-af02-69e470af7417',index_pattern:'monitored-parameter',interval:'15m',isModelInvalid:!f,series:!((axis_position:right,chart_type:line,color:%2368BC00,fill:'0.1',filter:(language:kuery,query:''),formatter:number,id:'61ca57f1-469d-11e7-af02-69e470af7417',label:'',line_width:1,metrics:!((id:'61ca57f2-469d-11e7-af02-69e470af7417',type:count)),point_size:1,separate_axis:0,split_color_mode:kibana,split_filters:!((color:%2368BC00,filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2036'),id:c0235550-902a-11ec-8823-65b10961c04e,label:'Canal%2036'),(color:'rgba(84,179,153,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel:%2040'),id:c94521e0-902a-11ec-8823-65b10961c04e,label:'Canal%2040'),(color:'rgba(211,96,134,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2044'),id:d3408590-902a-11ec-8823-65b10961c04e,label:'Channel%2044'),(color:'rgba(145,112,184,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2048'),id:d7d269c0-902a-11ec-8823-65b10961c04e,label:'Channel%2048'),(color:'rgba(202,142,174,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2052'),id:dd5341d0-902a-11ec-8823-65b10961c04e,label:'Channel%2052'),(color:'rgba(214,191,87,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2056'),id:e0a727c0-902a-11ec-8823-65b10961c04e,label:'Channel%2056'),(color:'rgba(185,168,136,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2060'),id:e76b5540-902a-11ec-8823-65b10961c04e,label:'Channel%2060'),(color:'rgba(218,139,69,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%2064'),id:ea256c30-902a-11ec-8823-65b10961c04e,label:'Channel%2064'),(color:'rgba(170,101,86,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20100'),id:eda32140-902a-11ec-8823-65b10961c04e,label:'Channel%20100'),(color:'rgba(231,102,76,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20104'),id:f106bea0-902a-11ec-8823-65b10961c04e,label:'Channel%20104'),(color:'rgba(22,0,188,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20108'),id:f3c1bff0-902a-11ec-8823-65b10961c04e,label:'Channel%20108'),(color:'rgba(231,240,129,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20112'),id:cce01c50-90c1-11ec-8419-030540e36e5c,label:'Channel%20112'),(color:'rgba(115,232,113,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20116'),id:d16667c0-90c1-11ec-8419-030540e36e5c,label:'Channel%20116'),(color:'rgba(130,80,107,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20120'),id:d4d3c920-90c1-11ec-8419-030540e36e5c,label:'Channel%20120'),(color:'rgba(247,112,112,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel:%20124'),id:dd5c62f0-90c1-11ec-8419-030540e36e5c,label:'Channel%20124'),(color:'rgba(1,120,66,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20128'),id:e29387d0-90c1-11ec-8419-030540e36e5c,label:'Channel%20128'),(color:'rgba(235,198,97,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20132'),id:e7a6f810-90c1-11ec-8419-030540e36e5c,label:'Channel%20132'),(color:'rgba(205,98,139,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20136'),id:ed97f710-90c1-11ec-8419-030540e36e5c,label:'Channel%20136'),(color:'rgba(50,62,122,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20140'),id:f3d2a940-90c1-11ec-8419-030540e36e5c,label:'Channel%20140'),(color:'rgba(41,105,128,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20144'),id:f5baa320-90c1-11ec-8419-030540e36e5c,label:'Channel%20144'),(color:'rgba(38,67,83,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20149'),id:f9f3e000-90c1-11ec-8419-030540e36e5c,label:'Channel%20149'),(color:'rgba(96,125,61,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20153'),id:'518470a0-b4e4-11ec-8956-e556ebb5a566',label:'Channel%20153'),(color:'rgba(246,151,182,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel%20:%20157'),id:'64c814a0-b4e4-11ec-8956-e556ebb5a566',label:'Channel%20157'),(color:'rgba(236,205,177,1)',filter:(language:kuery,query:'params.InternetGatewayDevice.LANDevice.1.WLANConfiguration.5.Channel:%20161'),id:'7047f570-b4e4-11ec-8956-e556ebb5a566',label:'Channel%20161')),split_mode:filters,stacked:none,type:timeseries)),show_grid:1,show_legend:1,time_field:'@timestamp',tooltip_mode:show_all,type:timeseries),title:'Channel%205Ghz%20Geral%20-%20Per%20Device',type:metrics))"} {"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]}} {"buttons":{"handlers":[{"text":"Refresh","handler":"refresh","endpoint":{"url":"/devices/{deviceId}/dashboard/panels?id={panelId}","verb":"GET"},"visible":true,"tab":null}]},"tableConfig":{"searchName":"PANEL_DASHBOARD_BROADBAND_HISTORICAL","title":"Historic Broadband Speed Test Results","searchParams":{"tableName":"DIAGNOSTIC_RESULT_SUMMARY","url":"/devices/{deviceId}/diagnostics/speedtest","q":"PINGTESTDATE is null","pageSize":20,"orderBy":"LASTMODIFIED","ascending":false},"columns":[{"name":"time","field":"lastModified","label":"Time","align":"left","dataType":"DATETIME","fieldFormat":"hh:mma, dd MMM yyyy"},{"name":"dload","field":"downloadSpeed","label":"Download Speed (Mbps)","align":"center","dataType":"MBYTES","fieldFormat":"%.1f"},{"name":"uload","field":"uploadSpeed","label":"Upload Speed (Mbps)","align":"center","dataType":"MBYTES","fieldFormat":"%.1f"}]}} {"readOnly":false,"tabName":"a839facf-9c47-578c-3c84-70b47c95c2e3","dataSource":{"type":"SERVICE_CONFIGURATION_SCRIPT","sourceId":"WiFi 5","sourceIdSet":[]},"diagnosticsConfig":[{"diagnosticParameters":[]}],"panelSource":"PANEL_DASHBOARD_SERVICE_CONFIG","dataType":"SERVICE_CONFIGURATION_SCRIPT","dataSourceServiceConfig":"4ce097b3-a962-310a-e09c-da457efa5340"} {"actionsConfig":[{"order":0,"include":true,"text":"Incognito Support","url":"https://support.incognito.com/"}]} {"websocket":{"handlers":[{"type":"PANEL_UPDATE","field":"panelData.value","filter":{"name":"self"}}]},"duration":{"enable":false,"unit":null}} {"version":"1.2","children":[{"type":"COLUMN_LEFT","order":0,"hasPanelChildren":false,"children":[{"name":"##dashboard.layout.region.device_ident##","type":"REGION_DEVICE_IDENTIFIER","order":0,"hasPanelChildren":false,"children":[{"name":"PANEL_COMMON_DEVICE_IDENTIFIER","type":"PANEL_COMMON_DEVICE_IDENTIFIER","order":0,"hasPanelChildren":false}]},{"name":"##dashboard.layout.region.customer_ident##","type":"REGION_CUSTOMER_IDENTIIFIER","order":1,"hasPanelChildren":true,"children":[{"name":"PANEL_COMMON_CUSTOMER_IDENTIFIER","type":"PANEL_COMMON_CUSTOMER_IDENTIFIER","order":0,"hasPanelChildren":false}]},{"name":"##dashboard.layout.region.images##","type":"REGION_DEVICE_IMAGES","order":2,"hasPanelChildren":true,"children":[{"name":"PANEL_COMMON_DEVICE_IMAGES","type":"PANEL_COMMON_DEVICE_IMAGES","order":0,"hasPanelChildren":false}]},{"name":"##dashboard.layout.region.operations##","type":"REGION_DEVICE_OPERATIONS","order":3,"hasPanelChildren":true,"children":[{"name":"##dashboard.device_actions.name##","type":"PANEL_DEVICE_OPERATIONS_ACTIONS","order":0,"hasPanelChildren":false},{"name":"##dashboard.common_issues.name##","type":"PANEL_DEVICE_OPERATIONS_ISSUES","order":1,"hasPanelChildren":false},{"name":"##dashboard.admin_actions.name##","type":"PANEL_DEVICE_OPERATIONS_ADMIN","order":2,"hasPanelChildren":false}]}]},{"type":"COLUMN_RIGHT","order":1,"hasPanelChildren":false,"children":[{"name":"##dashboard.layout.region.status##","type":"REGION_STATUS","order":0,"hasPanelChildren":true,"children":[{"name":"##dashboard.online.name##","type":"PANEL_STATUS_ONLINE","order":0,"hasPanelChildren":false},{"name":"##dashboard.last_seen.name##","type":"PANEL_STATUS_LASTSEEN","order":1,"hasPanelChildren":false},{"name":"##dashboard.sync_status.name##","type":"PANEL_STATUS_SYNC","order":2,"hasPanelChildren":false},{"name":"##dashboard.connected_devices.name##","type":"PANEL_STATUS_CONNECTED","order":3,"hasPanelChildren":false},{"name":"##dashboard.active_operations.name##","type":"PANEL_STATUS_OPERATIONS_ACTIVE","order":4,"hasPanelChildren":false},{"name":"##dashboard.failed_operations.name##","type":"PANEL_STATUS_OPERATIONS_FAILED","order":5,"hasPanelChildren":false},{"name":"##dashboard.up_time.name##","type":"PANEL_STATUS_UPTIME","order":6,"hasPanelChildren":false}]},{"name":"##dashboard.layout.region.csr_call_log##","type":"REGION_CSR_CALL_INFO","order":1,"hasPanelChildren":true,"children":[{"name":"##dashboard.csr_call_info.name##","type":"PANEL_COMMON_CSR_CALL_INFO","order":0,"hasPanelChildren":false}]},{"name":"##dashboard.layout.region.dashboards##","type":"REGION_DASHBOARDS","order":2,"hasPanelChildren":false,"children":[{"name":"##dashboard.tab.overview##","type":"TAB_DASHBOARD","order":0,"hasPanelChildren":true,"visible":true,"children":[{"name":"##dashboard.device_info.name##","type":"PANEL_DASHBOARD_DEVICE_INFO","order":0,"hasPanelChildren":false,"size":{"h":1,"v":1}},{"name":"Broadband Speed Test","type":"PANEL_DASHBOARD_BROADBAND_SPEED","order":1,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":1,"v":1}},{"name":"##dashboard.broadband_speed_hist.name##","type":"PANEL_DASHBOARD_BROADBAND_HISTORICAL","order":2,"hasPanelChildren":false,"size":{"h":1,"v":1}},{"name":"##dashboard.session_info.name##","type":"PANEL_DASHBOARD_SESSION_INFO","order":3,"hasPanelChildren":false,"size":{"h":1,"v":1}}]},{"name":"##dashboard.tab.topology##","type":"TAB_DASHBOARD","order":1,"hasPanelChildren":true,"visible":false,"children":[{"name":"##dashboard.connected_devices_topology.name##","type":"PANEL_DASHBOARD_CONNECTED_DEVICES","order":0,"hasPanelChildren":false,"size":{"h":2,"v":1}}]},{"name":"##dashboard.tab.diagnostics##","type":"TAB_DASHBOARD","order":2,"hasPanelChildren":true,"visible":false,"children":[{"name":"##dashboard.tr069_config.name##","type":"PANEL_DASHBOARD_TR069_CONFIG","order":0,"hasPanelChildren":false,"size":{"h":1,"v":1}},{"name":"IP Ping Test","type":"PANEL_DASHBOARD_IPPING","order":1,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":1,"v":1}},{"name":"##dashboard.traceroute.name##","type":"PANEL_DASHBOARD_TRACEROUTE","order":2,"hasPanelChildren":false,"size":{"h":1,"v":1}}]},{"name":"WiFi","type":"TAB_DASHBOARD","order":3,"hasPanelChildren":true,"visible":true,"children":[{"name":"WiFi 2.4Ghz","type":"PANEL_DASHBOARD_SERVICE_CONFIG","order":0,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":1,"v":1}},{"name":"WiFi 5Ghz","type":"PANEL_DASHBOARD_SERVICE_CONFIG","order":1,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":1,"v":1}},{"name":"Utilização Canal 2.4Ghz","type":"PANEL_DASHBOARD_KIBANA_IFRAME","order":2,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":0,"v":1}},{"name":"Utilização Canal 5Ghz","type":"PANEL_DASHBOARD_KIBANA_IFRAME","order":3,"hasPanelChildren":false,"visible":true,"size":{"type":"grid","h":2,"v":1}}]}]}]}]}