Details
-
Bug
-
Status: Resolved
-
Resolution: Cannot Reproduce
-
None
-
None
-
None
-
Operating System: Windows
Platform: PC
-
1125
Description
To detect when a switch disconnects, I register a datachangelistener on InstanceIdentifier.builder(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class)
Then I get the set from changeEvent.getRemovedOperationalData() and see if it is a FlowCapableNode. If it is, I take that to mean the node has disconnected.
This was working in builds from April but is no longer working. I'm not getting any notifications when a switch disconnects.
Here are some code snippets:
dataChangeListenerRegistration = dataBrokerService.registerDataChangeListener(InstanceIdentifier.builder(Nodes.class)
.child(Node.class)
.toInstance(),
this);
final Set<InstanceIdentifier<?>> removedSet = changeEvent.getRemovedOperationalData();
for (final InstanceIdentifier<?> removedItemPath : removedSet)
{
final InstanceIdentifier<Node> switchPath = IIDUtil.getSwitchPath(removedItemPath);
final Class removedClass = removedItemPath.getTargetType();
final String className = removedClass.getSimpleName();
log.debug("Removed: {}", className);
if (className.contains("FlowCapableNode"))
{
log.debug("REMOVED SWITCH: switch{}", IIDUtil.getSwitchId(switchPath));
}
}