Thomas Vachuska
Committed by Gerrit Code Review

Fixed device subsystem behaviour where auxiliary provider prevented emitting dev…

…ice availability change events.

Change-Id: Iaed6359598ff87d5706e10eb9d905ed0883617d9
...@@ -383,7 +383,8 @@ public class GossipDeviceStore ...@@ -383,7 +383,8 @@ public class GossipDeviceStore
383 // We allow only certain attributes to trigger update 383 // We allow only certain attributes to trigger update
384 boolean propertiesChanged = 384 boolean propertiesChanged =
385 !Objects.equals(oldDevice.hwVersion(), newDevice.hwVersion()) || 385 !Objects.equals(oldDevice.hwVersion(), newDevice.hwVersion()) ||
386 - !Objects.equals(oldDevice.swVersion(), newDevice.swVersion()); 386 + !Objects.equals(oldDevice.swVersion(), newDevice.swVersion()) ||
387 + !Objects.equals(oldDevice.providerId(), newDevice.providerId());
387 boolean annotationsChanged = 388 boolean annotationsChanged =
388 !AnnotationsUtil.isEqual(oldDevice.annotations(), newDevice.annotations()); 389 !AnnotationsUtil.isEqual(oldDevice.annotations(), newDevice.annotations());
389 390
...@@ -399,16 +400,14 @@ public class GossipDeviceStore ...@@ -399,16 +400,14 @@ public class GossipDeviceStore
399 , newDevice); 400 , newDevice);
400 } 401 }
401 if (!providerId.isAncillary()) { 402 if (!providerId.isAncillary()) {
403 + boolean wasOnline = availableDevices.contains(newDevice.id());
402 markOnline(newDevice.id(), newTimestamp); 404 markOnline(newDevice.id(), newTimestamp);
405 + if (!wasOnline) {
406 + notifyDelegateIfNotNull(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null));
403 } 407 }
404 - return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
405 } 408 }
406 409
407 - // Otherwise merely attempt to change availability if primary provider 410 + return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
408 - if (!providerId.isAncillary()) {
409 - boolean added = markOnline(newDevice.id(), newTimestamp);
410 - return !added ? null :
411 - new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null);
412 } 411 }
413 return null; 412 return null;
414 } 413 }
......
1 +{
2 + "devices": [
3 + { "alias": "s1", "uri": "of:0000000000000001", "annotations": { "driver": "ovs-corsa" } },
4 + { "alias": "s2", "uri": "of:0000000000000002", "annotations": { "driver": "ovs-corsa" } }
5 + ]
6 +}