Support for TR-181 data model when looking for ConnectionRequestURL and SoftwareVersion parameters.
This commit is contained in:
1 parent
4c0c590791
commit
4add20fe82
2 files changed
+17
-3
No files matched your search
@@ -90,11 +90,21 @@ connectionRequest = (deviceId, callback) ->
|
||||
)
|
||||
)
|
||||
|
||||
db.devicesCollection.findOne({_id : deviceId}, {'InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value' : 1}, (err, device)->
|
||||
proj = {
|
||||
'Device.ManagementServer.ConnectionRequestURL._value' : 1,
|
||||
'InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value' : 1
|
||||
}
|
||||
|
||||
db.devicesCollection.findOne({_id : deviceId}, proj, (err, device)->
|
||||
if err
|
||||
callback(err)
|
||||
return
|
||||
connectionRequestUrl = device.InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value
|
||||
|
||||
if device.Device? # TR-181 data model
|
||||
connectionRequestUrl = device.Device.ManagementServer.ConnectionRequestURL._value
|
||||
else # TR-098 data model
|
||||
connectionRequestUrl = device.InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value
|
||||
|
||||
# for testing
|
||||
#connectionRequestUrl = connectionRequestUrl.replace(/^(http:\/\/)([0-9\.]+)(\:[0-9]+\/[a-zA-Z0-9]+\/?$)/, '$110.1.1.254$3')
|
||||
conReq(connectionRequestUrl, null, (statusCode, authHeader) ->
|
||||
|
||||
+5
-1
@@ -84,6 +84,7 @@ exports.getDevicePreset = (deviceId, presets, objects, aliases, callback) ->
|
||||
if commandfile of deviceCustomCommands
|
||||
projection["_customCommands.#{c.command.split(' ', 1)}"] = 1
|
||||
when 'software_version'
|
||||
projection['Device.DeviceInfo.SoftwareVersion'] = 1
|
||||
projection['InternetGatewayDevice.DeviceInfo.SoftwareVersion'] = 1
|
||||
when 'add_tag', 'delete_tag'
|
||||
projection['_tags'] = 1
|
||||
@@ -204,7 +205,10 @@ exports.getDevicePreset = (deviceId, presets, objects, aliases, callback) ->
|
||||
when 'software_version'
|
||||
devicePreset.softwareVersion ?= {}
|
||||
devicePreset.softwareVersion.preset = c.software_version
|
||||
devicePreset.softwareVersion.current = common.getParamValueFromPath(device, 'InternetGatewayDevice.DeviceInfo.SoftwareVersion')
|
||||
if device?.Device? # TR-181 data model
|
||||
devicePreset.softwareVersion.current = common.getParamValueFromPath(device, 'Device.DeviceInfo.SoftwareVersion')
|
||||
else # TR-098 data model
|
||||
devicePreset.softwareVersion.current = common.getParamValueFromPath(device, 'InternetGatewayDevice.DeviceInfo.SoftwareVersion')
|
||||
|
||||
else
|
||||
throw new Error('Unknown configuration type')
|
||||
|
||||
Reference in new issue
Block a user