1 parent
34de9c7e7d
commit
bc1f6311a0
2 files changed
+34
-20
No files matched your search
+6
-6
@@ -168,14 +168,14 @@ transferComplete = (sessionData, rpcReq, callback) ->
|
|||||||
sessionData.operationsTouched ?= {}
|
sessionData.operationsTouched ?= {}
|
||||||
sessionData.operationsTouched[commandKey] = 1
|
sessionData.operationsTouched[commandKey] = 1
|
||||||
|
|
||||||
if rpcReq.faultStruct? and rpcReq.faultStruct.FaultCode != '0'
|
if rpcReq.faultStruct? and rpcReq.faultStruct.faultCode != '0'
|
||||||
return revertDownloadParameters(sessionData, operation.args.instance, (err) ->
|
return revertDownloadParameters(sessionData, operation.args.instance, (err) ->
|
||||||
for channel, provisions of operation.provisions
|
for channel, provisions of operation.provisions
|
||||||
faults[channel] = {
|
faults[channel] = {
|
||||||
provisions: provisions
|
provisions: provisions
|
||||||
timestamp: sessionData.timestamp
|
timestamp: sessionData.timestamp
|
||||||
code: "cwmp.#{rpcReq.faultStruct['FaultCode']}"
|
code: "cwmp.#{rpcReq.faultStruct.faultCode}"
|
||||||
message: rpcReq.faultStruct['FaultString']
|
message: rpcReq.faultStruct.faultString
|
||||||
detail: rpcReq.faultStruct
|
detail: rpcReq.faultStruct
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1546,9 +1546,9 @@ rpcFault = (sessionData, id, faultResponse, callback) ->
|
|||||||
fault = {
|
fault = {
|
||||||
provisions: []
|
provisions: []
|
||||||
timestamp: sessionData.timestamp
|
timestamp: sessionData.timestamp
|
||||||
code: "cwmp.#{faultResponse.detail.Fault['FaultCode']}"
|
code: "cwmp.#{faultResponse.detail.faultCode}"
|
||||||
message: faultResponse.detail.Fault['FaultString']
|
message: faultResponse.detail.faultString
|
||||||
detail: faultResponse.detail.Fault
|
detail: faultResponse.detail
|
||||||
}
|
}
|
||||||
|
|
||||||
if sessionData.faults[channel]?
|
if sessionData.faults[channel]?
|
||||||
|
|||||||
+28
-14
@@ -238,7 +238,12 @@ cpeDownloadResponse = (xml) ->
|
|||||||
acsInform = (xml) ->
|
acsInform = (xml) ->
|
||||||
{
|
{
|
||||||
parameterList : parameterValueList(xml.get('ParameterList')),
|
parameterList : parameterValueList(xml.get('ParameterList')),
|
||||||
deviceId : traverseXml(xml.get('DeviceId')),
|
deviceId : {
|
||||||
|
'Manufacturer' : xml.get('DeviceId/Manufacturer').text(),
|
||||||
|
'OUI' : xml.get('DeviceId/OUI').text(),
|
||||||
|
'ProductClass' : xml.get('DeviceId/ProductClass').text(),
|
||||||
|
'SerialNumber' : xml.get('DeviceId/SerialNumber').text()
|
||||||
|
}
|
||||||
event : event(xml.get('Event')),
|
event : event(xml.get('Event')),
|
||||||
retryCount : parseInt(xml.get('RetryCount').text())
|
retryCount : parseInt(xml.get('RetryCount').text())
|
||||||
}
|
}
|
||||||
@@ -262,7 +267,7 @@ acsGetRPCMethodsResponse = (xml, methodResponse) ->
|
|||||||
acsTransferComplete = (xml) ->
|
acsTransferComplete = (xml) ->
|
||||||
{
|
{
|
||||||
commandKey : xml.get('CommandKey').text(),
|
commandKey : xml.get('CommandKey').text(),
|
||||||
faultStruct : traverseXml(xml.get('FaultStruct')),
|
faultStruct : faultStruct(xml.get('FaultStruct')),
|
||||||
startTime : Date.parse(xml.get('StartTime').text()),
|
startTime : Date.parse(xml.get('StartTime').text()),
|
||||||
completeTime : Date.parse(xml.get('CompleteTime').text())
|
completeTime : Date.parse(xml.get('CompleteTime').text())
|
||||||
}
|
}
|
||||||
@@ -283,20 +288,29 @@ acsRequestDownloadResponse = (xml, methodResponse) ->
|
|||||||
xml.node('cwmp:RequestDownloadResponse').text('')
|
xml.node('cwmp:RequestDownloadResponse').text('')
|
||||||
|
|
||||||
|
|
||||||
traverseXml = (xml) ->
|
faultStruct = (xml) ->
|
||||||
obj = {}
|
f = {
|
||||||
for n in xml.childNodes()
|
faultCode: xml.get('FaultCode').text(),
|
||||||
if n.type() == 'element'
|
faultString: xml.get('FaultString').text()
|
||||||
obj[n.name()] = traverseXml(n)
|
}
|
||||||
|
|
||||||
if Object.keys(obj).length == 0
|
for e in xml.find('SetParameterValuesFault')
|
||||||
xml.text()
|
f.setParameterValuesFault ?= []
|
||||||
else
|
f.setParameterValuesFault.push({
|
||||||
obj
|
parameterName: e.get('ParameterName').text(),
|
||||||
|
faultCode: e.get('FaultCode').text(),
|
||||||
|
faultString: e.get('FaultString').text()
|
||||||
|
})
|
||||||
|
|
||||||
|
return f
|
||||||
|
|
||||||
|
|
||||||
fault = (xml) ->
|
fault = (xml, cwmpVersion) ->
|
||||||
return traverseXml(xml)
|
{
|
||||||
|
faultCode: xml.get('faultcode').text(),
|
||||||
|
faultString: xml.get('faultstring').text(),
|
||||||
|
detail: faultStruct(xml.get('detail/cwmp:Fault', NAMESPACES[cwmpVersion]))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.request = (httpRequest, cwmpVersion) ->
|
exports.request = (httpRequest, cwmpVersion) ->
|
||||||
@@ -374,7 +388,7 @@ exports.request = (httpRequest, cwmpVersion) ->
|
|||||||
throw Error('8000 Method not supported ' + methodElement.name())
|
throw Error('8000 Method not supported ' + methodElement.name())
|
||||||
else
|
else
|
||||||
faultElement = xml.get('/soap-env:Envelope/soap-env:Body/soap-env:Fault', NAMESPACES[cwmpRequest.cwmpVersion])
|
faultElement = xml.get('/soap-env:Envelope/soap-env:Body/soap-env:Fault', NAMESPACES[cwmpRequest.cwmpVersion])
|
||||||
cwmpRequest.fault = fault(faultElement)
|
cwmpRequest.fault = fault(faultElement, cwmpRequest.cwmpVersion)
|
||||||
|
|
||||||
return cwmpRequest
|
return cwmpRequest
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user