Sketching more topology related stuff.
diff --git a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
index 87a548e..17d3aa0 100644
--- a/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
+++ b/net/core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceManager.java
@@ -51,7 +51,7 @@
private final AbstractListenerRegistry<DeviceEvent, DeviceListener>
listenerRegistry = new AbstractListenerRegistry<>();
- private final SimpleDeviceStore store = new SimpleDeviceStore();
+ private final SimpleDeviceStore store = new SimpleDeviceStore();
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected EventDeliveryService eventDispatcher;
@@ -143,7 +143,10 @@
public void removeDevice(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
DeviceEvent event = store.removeDevice(deviceId);
- post(event);
+ if (event != null) {
+ log.info("Device {} administratively removed", deviceId);
+ post(event);
+ }
}
// Personalized device provider service issued to the supplied provider.
@@ -159,12 +162,12 @@
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(deviceDescription, DEVICE_DESCRIPTION_NULL);
checkValidity();
- log.info("Device {} connected", deviceId);
DeviceEvent event = store.createOrUpdateDevice(provider().id(),
deviceId, deviceDescription);
// If there was a change of any kind, trigger role selection process.
if (event != null) {
+ log.info("Device {} connected", deviceId);
Device device = event.subject();
provider().roleChanged(device, store.getRole(device.id()));
post(event);
@@ -175,9 +178,11 @@
public void deviceDisconnected(DeviceId deviceId) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkValidity();
- log.info("Device {} disconnected", deviceId);
DeviceEvent event = store.markOffline(deviceId);
- post(event);
+ if (event != null) {
+ log.info("Device {} disconnected", deviceId);
+ post(event);
+ }
}
@Override
@@ -185,7 +190,6 @@
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portDescriptions, "Port descriptions list cannot be null");
checkValidity();
- log.info("Device {} ports updated", deviceId);
List<DeviceEvent> events = store.updatePorts(deviceId, portDescriptions);
for (DeviceEvent event : events) {
post(event);
@@ -199,9 +203,10 @@
checkValidity();
DeviceEvent event = store.updatePortStatus(deviceId, portDescription);
if (event != null) {
- log.info("Device {} port status changed", deviceId);
+ log.info("Device {} port {} status changed", deviceId,
+ event.port().number());
+ post(event);
}
- post(event);
}
}