Details
-
Bug
-
Status: Resolved
-
Resolution: Cannot Reproduce
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
5099
Description
I am getting WARNING when trying to get values of datastore-contents-xml anyxml node for below notification.
Is there any modification to anyXML implementation? How to convert anyxml data to a DOMSource in current implementation?
NOTE: It was working fine during Dec time line.
The value I am getting for below notification looks
2016-01-26 15:58:47,020 | INFO | oupCloseable-5-2 | YangpushDOMNotificationListener | 247 - org.opendaylight.yang-push.yangpush-impl - 1.1.0.SNAPSHOT | Notification recieved ImmutableContainerNode{nodeIdentifier=(urn:ietf:params:xml:ns:yang:ietf-datastore-push?revision=2015-10-15)push-update, value=[ImmutableLeafNode{nodeIdentifier=(urn:ietf:params:xml:ns:yang:ietf-datastore-push?revision=2015-10-15)time-of-update, value=2011-01-04T12:30:46Z, attributes={}}, ImmutableLeafNode{nodeIdentifier=(urn:ietf:params:xml:ns:yang:ietf-datastore-push?revision=2015-10-15)subscription-id, value=201, attributes={}}, ImmutableChoiceNode{nodeIdentifier=(urn:ietf:params:xml:ns:yang:ietf-datastore-push?revision=2015-10-15)encoding, value=[ImmutableLeafNode{nodeIdentifier=(urn:ietf:params:xml:ns:yang:ietf-datastore-push?revision=2015-10-15)datastore-contents-xml, value=actMgmtEth0/0/CPU0/010.0.2.15255.255.255.0, attributes={}}]}], attributes={}}
2016-01-26 15:58:47,021 | WARN | oupCloseable-5-2 | YangpushDOMNotificationListener | 247 - org.opendaylight.yang-push.yangpush-impl - 1.1.0.SNAPSHOT | java.lang.ClassCastException: org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder$ImmutableLeafNode cannot be cast to org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode
Notification schema:
notification push-update {
leaf subscription-id
leaf time-of-update
{ type yang:date-and-time; } choice encoding {
case encode-xml
case encode-json {
if-feature json;
leaf datastore-contents-json
}
}
}
Sample code:
private void pushUpdateHandlder(DOMNotification notification) {
ContainerNode conNode = notification.getBody();
ChoiceNode valueNode = null;
AnyXmlNode anyXmlValue = null;
DOMSource domSource = null;
String sub_id = "";
String timeofeventupdate = "";
try
catch (Exception e)
{ LOG.warn(e.toString()); } String notificationAsString = domSourceToString(domSource);
LOG.info("Notification recieved for sub_id :{} at : {}:\n {}", sub_id, timeofeventupdate, notificationAsString);
}