Code Review
/
oam
/
tr069-adapter.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
netconf notifications with namespace
[oam/tr069-adapter.git]
/
mapper
/
src
/
main
/
java
/
org
/
commscope
/
tr069adapter
/
mapper
/
netconf
/
NetConfNotificationSender.java
diff --git
a/mapper/src/main/java/org/commscope/tr069adapter/mapper/netconf/NetConfNotificationSender.java
b/mapper/src/main/java/org/commscope/tr069adapter/mapper/netconf/NetConfNotificationSender.java
index
15024c2
..
aaf70d3
100644
(file)
--- a/
mapper/src/main/java/org/commscope/tr069adapter/mapper/netconf/NetConfNotificationSender.java
+++ b/
mapper/src/main/java/org/commscope/tr069adapter/mapper/netconf/NetConfNotificationSender.java
@@
-86,10
+86,12
@@
public class NetConfNotificationSender {
convertTR069ToNetConfParams(parameters, deviceInform.getDeviceDetails().getSoftwareVersion(),
\r
deviceInform.getDeviceDetails().getHardwareVersion());
\r
\r
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
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
NetConfNotificationDTO netConfDTO = new NetConfNotificationDTO(
\r
deviceInform.getDeviceDetails().getDeviceId(), notificationXml);
\r
\r
@@
-108,7
+110,7
@@
public class NetConfNotificationSender {
final String uri = getUri();
\r
LOG.debug("Posting custom notification to netconf server " + uri);
\r
try {
\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
NetConfNotificationDTO netConfDTO = new NetConfNotificationDTO(deviceId, notificationXml);
\r
\r
response = restTemplate.postForObject(uri, netConfDTO, ResponseEntity.class);
\r
@@
-158,8
+160,8
@@
public class NetConfNotificationSender {
return config.getNbiNotificationUri();
\r
}
\r
\r
return config.getNbiNotificationUri();
\r
}
\r
\r
- private
String getNetconfResponseXML(List<ParameterDTO> parameters, String notificationType
,
\r
- String n
ameSpace, String swVersion, String hwVersion
) {
\r
+ private
static String getNetconfResponseXML(List<ParameterDTO> parameters
,
\r
+ String n
otificationType, String nameSpace
) {
\r
if (parameters == null || parameters.isEmpty()) {
\r
LOG.debug("There are no parameters found in the response.");
\r
return null;
\r
if (parameters == null || parameters.isEmpty()) {
\r
LOG.debug("There are no parameters found in the response.");
\r
return null;
\r
@@
-262,12
+264,6
@@
public class NetConfNotificationSender {
element.appendChild(element.getOwnerDocument().importNode(eventTime, true));
\r
\r
if (notificationType != 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
final Element evtTypeElement = doc.createElementNS(nameSpace, notificationType);
\r
evtTypeElement.appendChild(dataNode);
\r
element.appendChild(element.getOwnerDocument().importNode(evtTypeElement, true));
\r
@@
-278,7
+274,7
@@
public class NetConfNotificationSender {
result = convertDocumentToString(element);
\r
}
\r
} catch (ParserConfigurationException pce) {
\r
result = convertDocumentToString(element);
\r
}
\r
} catch (ParserConfigurationException pce) {
\r
- LOG.error("E
rror occured while preparing the notification"
);
\r
+ LOG.error("E
xception while converting the notification: {}", pce.getMessage()
);
\r
}
\r
\r
return result;
\r
}
\r
\r
return result;
\r
@@
-296,8
+292,7
@@
public class NetConfNotificationSender {
} catch (Exception e) {
\r
LOG.error("Error while converting Element to String" + e);
\r
}
\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
return strxml;
\r
}
\r
-
\r
}
\r
}
\r