import org.slf4j.LoggerFactory;
/**
- * Listens to packetIn notification and
+ * Listens to packetIn notification and
* <ul>
* <li>in HUB mode simply floods all switch ports (except ingress port)</li>
- * <li>in LSWITCH mode collects source MAC address of packetIn and bind it with ingress port.
- * If target MAC address is already bound then a flow is created (for direct communication between
+ * <li>in LSWITCH mode collects source MAC address of packetIn and bind it with ingress port.
+ * If target MAC address is already bound then a flow is created (for direct communication between
* corresponding MACs)</li>
* </ul>
*/
public class LearningSwitchManagerSimpleImpl implements DataChangeListenerRegistrationHolder,
LearningSwitchManager {
-
+
protected static final Logger LOG = LoggerFactory
.getLogger(LearningSwitchManagerSimpleImpl.class);
private Registration packetInRegistration;
private ListenerRegistration<DataChangeListener> dataChangeListenerRegistration;
-
+
/**
* @param notificationService the notificationService to set
*/
PacketProcessingService packetProcessingService) {
this.packetProcessingService = packetProcessingService;
}
-
+
/**
* @param data the data to set
*/
learningSwitchHandler.setDataStoreAccessor(dataStoreAccessor);
learningSwitchHandler.setPacketProcessingService(packetProcessingService);
packetInRegistration = notificationService.registerNotificationListener(learningSwitchHandler);
-
+
WakeupOnNode wakeupListener = new WakeupOnNode();
wakeupListener.setLearningSwitchHandler(learningSwitchHandler);
dataChangeListenerRegistration = data.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
DataBroker.DataChangeScope.SUBTREE);
LOG.debug("start() <--");
}
-
+
/**
- * stopping learning switch
+ * stopping learning switch
*/
@Override
public void stop() {
try {
packetInRegistration.close();
} catch (Exception e) {
- LOG.error(e.getMessage(), e);
+ LOG.warn("closing packetInRegistration failed: {}", e.getMessage());
+ LOG.debug("closing packetInRegistration failed..", e);
}
try {
dataChangeListenerRegistration.close();
} catch (Exception e) {
- LOG.error(e.getMessage(), e);
+ LOG.warn("failed to close dataChangeListenerRegistration: {}", e.getMessage());
+ LOG.debug("failed to close dataChangeListenerRegistration..", e);
}
LOG.debug("stop() <--");
}
-
-
+
+
@Override
public ListenerRegistration<DataChangeListener> getDataChangeListenerRegistration() {
return dataChangeListenerRegistration;