Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Reset and FactoryReset #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions data_model_202BC1-BM632w-8KA8WA1151100043.csv
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,117 @@ InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.X_HUAW
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnectionNumberOfEntries,false,false,1,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection,true,true,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnectionNumberOfEntries,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1,true,true,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ConnectionStatus,false,false,Connected,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ConnectionTrigger,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ConnectionType,false,true,IP_Routed,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.CurrentMRUSize,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSOverrideAllowed,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.DNSServer,false,true,202.155.0.150,202.155.0.10,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Enable false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.ExternalIPAddress,false,false,182.29.4.3,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.IdleDisconnectTime,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.LastConnectionError,false,false,ERROR_NONE,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.MACAddress,false,false,d4:9a:a0:98:56:cb,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.MACAddressOverride,false,false,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.NATEnabled,false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Name,false,true,INTERNET,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPAuthenticationProtocol,false,true,AUTO_AUTH,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPCompressionProtocol,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPEncryptionProtocol,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPLCPEcho,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPLCPEchoRetry,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPMtu,false,true,1492,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PPPoEServiceName,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Password,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PortMapping,true,true,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PortMappingNumberOfEntries,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PossibleConnectionTypes,false,false,Unconfigured IP_Routed,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.RSIPAvailable,false,false,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.RemoteIPAddress,false,false,182.29.16.3,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.RouteProtocolRx,false,false,Off,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats,true,false,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.ByteRateReceived,false,false,4486,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.ByteRateSent,false,false,33008505,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.EthernetBytesReceived,false,false,293120503,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.EthernetBytesSent,false,false,1027558218,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.EthernetPacketsReceived,false,false,1056947658,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.EthernetPacketsSent,false,false,995488963,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_BroadcastPacketsReceived,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_BroadcastPacketsSent,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_MulticastBytesReceived,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_MulticastBytesSent,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_MulticastPacketsReceived,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_MulticastPacketsSent,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_RxDrops,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_RxErrors,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_TxDrops,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_TxErrors,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_UnicastPacketsReceived,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Stats.X_BROADCOM_COM_UnicastPacketsSent,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.TransportType,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Uptime,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.Username,false,true,GG10114601,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.WanIdx,false,true,3,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_AFlag,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_AddPppToBridge,false,false,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_ConnectionEstablishedTime,false,false,33,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_DefaultGateway,false,false,182.29.16.3,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_DefaultIPv6Gateway,false,false,fe80::12e8:78ff:fe6f:6751,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_Dhcp6cForAddress,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_Dhcp6cForPrefixDelegation,false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_Dhcp6cPid,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_Enable_Debug,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_ExternalIPv6Address,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallEnabled,false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException,true,true,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1,true,true
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.DestinationIPAddress,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.DestinationNetMask,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.DestinationPortEnd,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.DestinationPortStart,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.Enable,false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.FilterName,false,true,open_icmp,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.IPVersion,false,true,4,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.Protocol,false,true,ICMP,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.SourceIPAddress,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.SourceNetMask,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.SourcePortEnd,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FirewallException.1.SourcePortStart,false,true,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_FullconeNATEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IGMPEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IGMP_SOURCEEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPExtension,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv4Enabled,false,true,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6AddressingType,false,true,DHCP,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6ConnStatus,false,false,Unconfigured,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6DNSServers,false,true,2001:e00:e:3::10 2001:e00:e:9::2,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6DomainName,false,true,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6Enabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6PppUp,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6PrefixDelegationEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6SitePrefix,false,false,2001:e00:100:cb61::/64,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6SitePrefixPltime,false,false,600,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IPv6SitePrefixVltime,false,false,600,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_IfName,false,true,ppp0.0,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_LFlag,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_LocalIPAddress,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_MFlag,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_MLDEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_MLD_SOURCEEnabled,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_NoMcastVlanFilter,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_OFlag,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_PCPMode,false,false,0,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_PCPServer,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_PortTriggering,true,true,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_TransientLayer2LinkStatus,false,false,Up,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_UnnumberedModel,false,false,true,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_UseStaticIPAddress,false,true,false,xsd:boolean
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_UserRequest,false,false,None,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_VlanMux8021p,false,true,1,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_VlanMuxID,false,true,30,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.X_BROADCOM_COM_VlanTpid,false,true,33024,xsd:unsignedInt
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WiMAXLinkConfig,true,false,,
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WiMAXLinkConfig.SubscriptionParametersIdentifier,false,false,,xsd:string
InternetGatewayDevice.WANDevice.1.WANConnectionNumberOfEntries,false,false,1,xsd:unsignedInt
Expand Down
19 changes: 13 additions & 6 deletions genieacs-sim
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@ cluster.on("fork", function(worker) {
});

cluster.on("exit", function(worker, code, signal) {
console.log(`Simulator ${worker.env["SERIAL_NUMBER"]} died (${signal || code}). Restarting in 10 seconds...`)
setTimeout(function() {
let newWorker = cluster.fork(worker.env);
newWorker.env = worker.env;
}, 10000);
if(code == 255){
console.log(`Simulator ${worker.env["SERIAL_NUMBER"]} - Factory Reset - Restarting`);
setTimeout(function() {
let newWorker = cluster.fork(worker.env);
newWorker.env = worker.env;
}, 1000);
}else{
console.log(`Simulator ${worker.env["SERIAL_NUMBER"]} died (${signal || code}). Restarting in 10 seconds... ${signal} and ${code}`);
setTimeout(function() {
let newWorker = cluster.fork(worker.env);
newWorker.env = worker.env;
}, 10000);
};
});


for (let i = 0; i < program.processes; ++ i) {
setTimeout(function() {
let env = {
Expand Down
52 changes: 47 additions & 5 deletions methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const INFORM_PARAMS = [
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress"
];

var deviceTemplate = null;

function setDeviceTemplate(device){
deviceTemplate = JSON.parse(JSON.stringify(device));
}

function inform(device, event, callback) {
let manufacturer = "";
Expand Down Expand Up @@ -123,9 +128,21 @@ function inform(device, event, callback) {
]
);

let evnt = xmlUtils.node("Event", {
"soap-enc:arrayType": "cwmp:EventStruct[1]"
}, eventStruct);
let strEvent = (event || "2 PERIODIC").split(",");
let events = [];

for(let p of strEvent){
let evt = p.replace(/^\s+|\s+$/gm,'');
if(evt === "") {
continue;
}
events.push(xmlUtils.node("EventStruct",{},[
xmlUtils.node("EventCode", {}, evt),
xmlUtils.node("CommandKey")]
)
);
}
let evnt = xmlUtils.node("Event", {"soap-enc:arrayType": `cwmp:EventStruct[${events.length}]`}, events);

let params = [];
for (let p of INFORM_PARAMS) {
Expand Down Expand Up @@ -172,6 +189,7 @@ function getSortedPaths(device) {


function GetParameterNames(device, request, callback) {
//console.log(device);
let parameterNames = getSortedPaths(device);

let parameterPath, nextLevel;
Expand Down Expand Up @@ -230,6 +248,7 @@ function GetParameterNames(device, request, callback) {
function GetParameterValues(device, request, callback) {
let parameterNames = request.children[0].children;


let params = []
for (let p of parameterNames) {
let name = p.text;
Expand Down Expand Up @@ -298,18 +317,21 @@ function AddObject(device, request, callback) {
"xsd:dateTime": "0001-01-01T00:00:00Z"
};

for (let p of getSortedPaths(device)) {
getSortedPaths(device);
for (let p of getSortedPaths(deviceTemplate)) {
if (p.startsWith(objectName) && p.length > objectName.length) {
let n = `${objectName}${instanceNumber}${p.slice(p.indexOf(".", objectName.length))}`;
if (!device[n])
device[n] = [device[p][0], defaultValues[device[p][2]] || "", device[p][2]];
device[n] = [deviceTemplate[p][0], defaultValues[deviceTemplate[p][2]] || "", deviceTemplate[p][2]];
}
}


let response = xmlUtils.node("cwmp:AddObjectResponse", {}, [
xmlUtils.node("InstanceNumber", {}, String(instanceNumber)),
xmlUtils.node("Status", {}, "0")
]);
delete deviceTemplate._sortedPaths;
delete device._sortedPaths;
return callback(response);
}
Expand Down Expand Up @@ -409,7 +431,24 @@ function Download(device, request, callback) {
return callback(response);
}

function Reboot(device, request, callback) {
let response = xmlUtils.node("cwmp:RebootResponse", {}, "");
callback(response);
return "inform";
}


function FactoryReset(device, request, callback) {
let response = xmlUtils.node("cwmp:FactoryResetResponse", {}, "");
callback(response);
return "reset";
}

function getDeviceTemplate(){
return deviceTemplate;
}

exports.setDeviceTemplate = setDeviceTemplate;
exports.inform = inform;
exports.getPending = getPending;
exports.GetParameterNames = GetParameterNames;
Expand All @@ -418,3 +457,6 @@ exports.SetParameterValues = SetParameterValues;
exports.AddObject = AddObject;
exports.DeleteObject = DeleteObject;
exports.Download = Download;
exports.Reboot = Reboot;
exports.FactoryReset = FactoryReset;
exports.getDeviceTemplate = getDeviceTemplate;
Loading