+ @Override
+ public void onSessionRemoved(SessionContext context) {
+ GetFeaturesOutput features = context.getFeatures();
+ BigInteger datapathId = features.getDatapathId();
+ InstanceIdentifier<Node> identifier = identifierFromDatapathId(datapathId);
+ NodeRef nodeRef = new NodeRef(identifier);
+ NodeRemoved nodeRemoved = nodeRemoved(nodeRef);
+ if (context.isValid()) {
+ CompositeObjectRegistration<ModelDrivenSwitch> registration = context.getProviderRegistration();
+ registration.close();
+ }
+
+ LOG.debug("ModelDrivenSwitch for {} unregistered from MD-SAL.", datapathId.toString());
+
+ NotificationQueueWrapper wrappedNotification = new NotificationQueueWrapper(
+ nodeRemoved, context.getFeatures().getVersion());
+ context.getNotificationEnqueuer().enqueueNotification(wrappedNotification);
+ }
+
+ private NodeUpdated nodeAdded(ModelDrivenSwitch sw, GetFeaturesOutput features, NodeRef nodeRef) {