convertTR069ToNetConfParams(parameters, deviceInform.getDeviceDetails().getSoftwareVersion(),\r
deviceInform.getDeviceDetails().getHardwareVersion());\r
\r
+ String nameSpace = metaDataUtil.getMetaDataByTR69Name(deviceInform.getInformType().toString(),\r
+ deviceInform.getDeviceDetails().getSoftwareVersion(),\r
+ deviceInform.getDeviceDetails().getHardwareVersion()).getURI();\r
+\r
String notificationXml =\r
- getNetconfResponseXML(parameters, deviceInform.getInformType().toString(), null,\r
- deviceInform.getDeviceDetails().getSoftwareVersion(),\r
- deviceInform.getDeviceDetails().getHardwareVersion());\r
+ getNetconfResponseXML(parameters, deviceInform.getInformType().toString(), nameSpace);\r
NetConfNotificationDTO netConfDTO = new NetConfNotificationDTO(\r
deviceInform.getDeviceDetails().getDeviceId(), notificationXml);\r
\r
final String uri = getUri();\r
LOG.debug("Posting custom notification to netconf server " + uri);\r
try {\r
- String notificationXml = getNetconfResponseXML(parameters, null, nameSpace, null, null);\r
+ String notificationXml = getNetconfResponseXML(parameters, null, nameSpace);\r
NetConfNotificationDTO netConfDTO = new NetConfNotificationDTO(deviceId, notificationXml);\r
\r
response = restTemplate.postForObject(uri, netConfDTO, ResponseEntity.class);\r
return config.getNbiNotificationUri();\r
}\r
\r
- private String getNetconfResponseXML(List<ParameterDTO> parameters, String notificationType,\r
- String nameSpace, String swVersion, String hwVersion) {\r
+ private static String getNetconfResponseXML(List<ParameterDTO> parameters,\r
+ String notificationType, String nameSpace) {\r
if (parameters == null || parameters.isEmpty()) {\r
LOG.debug("There are no parameters found in the response.");\r
return null;\r
element.appendChild(element.getOwnerDocument().importNode(eventTime, true));\r
\r
if (notificationType != null) {\r
- if (nameSpace == null && metaDataUtil.getMetaDataByTR69Name(notificationType, swVersion,\r
- hwVersion) != null) {\r
- nameSpace =\r
- metaDataUtil.getMetaDataByTR69Name(notificationType, swVersion, hwVersion).getURI();\r
- }\r
-\r
final Element evtTypeElement = doc.createElementNS(nameSpace, notificationType);\r
evtTypeElement.appendChild(dataNode);\r
element.appendChild(element.getOwnerDocument().importNode(evtTypeElement, true));\r
result = convertDocumentToString(element);\r
}\r
} catch (ParserConfigurationException pce) {\r
- LOG.error("Error occured while preparing the notification");\r
+ LOG.error("Exception while converting the notification: {}", pce.getMessage());\r
}\r
\r
return result;\r
} catch (Exception e) {\r
LOG.error("Error while converting Element to String" + e);\r
}\r
- LOG.debug("Converted XML is : " + strxml);\r
+ LOG.debug("Converted XML is : {}", strxml);\r
return strxml;\r
}\r
-\r
}\r