}
Channel channel = connections.get(client);
if (channel != null) {
+ //It's an explicit disconnect from user, so no need to notify back
+ //to user about the disconnect.
+ client.setConnectionPublished(false);
channel.disconnect();
}
connections.remove(client);
}
}
}
+
+ if (change.getRootNode().getModificationType() == DataObjectModification.ModificationType.WRITE) {
+ DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification =
+ change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class);
+ if (ovsdbNodeModification != null
+ && ovsdbNodeModification.getModifiedChildContainer(ConnectionInfo.class) != null) {
+ DataObjectModification<ConnectionInfo> connectionInfoDOM =
+ ovsdbNodeModification.getModifiedChildContainer(ConnectionInfo.class);
+
+ if (connectionInfoDOM.getModificationType() == DataObjectModification.ModificationType.DELETE
+ && connectionInfoDOM.getDataBefore() != null) {
+ ConnectionInfo key = connectionInfoDOM.getDataBefore();
+ InstanceIdentifier<Node> iid = cm.getInstanceIdentifier(key);
+ try {
+ OvsdbNodeAugmentation ovsdbNode = ovsdbNodeModification.getDataBefore();
+ cm.disconnect(ovsdbNode);
+ LOG.warn("OVSDB node {} has been disconnected, because connection-info related to "
+ + "the node is removed by user, but node still exist.", ovsdbNode);
+ cm.stopConnectionReconciliationIfActive(iid.firstIdentifierOf(Node.class), ovsdbNode);
+ } catch (UnknownHostException e) {
+ LOG.warn("Failed to disconnect ovsdbNode", e);
+ }
+ }
+ }
+ }
}
}