HIGUCHI Yuta
Committed by Gerrit Code Review

Ignore event if not ready to serve as MASTER

- Issue similar to ONOS-1208 on Device Store

Change-Id: I1f3922f29d66ff68c18e364aff27ded414664889
...@@ -1488,6 +1488,11 @@ public class GossipDeviceStore ...@@ -1488,6 +1488,11 @@ public class GossipDeviceStore
1488 ProviderId providerId = event.providerId(); 1488 ProviderId providerId = event.providerId();
1489 DeviceId deviceId = event.deviceId(); 1489 DeviceId deviceId = event.deviceId();
1490 DeviceDescription deviceDescription = event.deviceDescription(); 1490 DeviceDescription deviceDescription = event.deviceDescription();
1491 + if (!deviceClockService.isTimestampAvailable(deviceId)) {
1492 + // workaround for ONOS-1208
1493 + log.warn("Not ready to accept update. Dropping {}", deviceDescription);
1494 + return;
1495 + }
1491 1496
1492 try { 1497 try {
1493 createOrUpdateDevice(providerId, deviceId, deviceDescription); 1498 createOrUpdateDevice(providerId, deviceId, deviceDescription);
...@@ -1508,6 +1513,11 @@ public class GossipDeviceStore ...@@ -1508,6 +1513,11 @@ public class GossipDeviceStore
1508 ProviderId providerId = event.providerId(); 1513 ProviderId providerId = event.providerId();
1509 DeviceId deviceId = event.deviceId(); 1514 DeviceId deviceId = event.deviceId();
1510 List<PortDescription> portDescriptions = event.portDescriptions(); 1515 List<PortDescription> portDescriptions = event.portDescriptions();
1516 + if (!deviceClockService.isTimestampAvailable(deviceId)) {
1517 + // workaround for ONOS-1208
1518 + log.warn("Not ready to accept update. Dropping {}", portDescriptions);
1519 + return;
1520 + }
1511 1521
1512 try { 1522 try {
1513 updatePorts(providerId, deviceId, portDescriptions); 1523 updatePorts(providerId, deviceId, portDescriptions);
......