Bug fixes/improvements:
1. DeviceManager must not have a dependency on DeviceClockService. Clocks and Timestamps are purely distribution concerns.
2. Eliminated DeviceClockProviderService which merely served as a cache for mastership terms thereby introducing a source of staleness. Now we directly query mastership service which is already optimized for high volume reads.
3. DistributedLeadershipManager fix to ensure election won by local node immediately reflects in the local leaderboard. This is to ensure a subsequent read does not return a stale value.

Change-Id: I774b64923e382b788df5f8bde2a9fafc0294bad0
diff --git a/core/api/src/main/java/org/onosproject/mastership/MastershipService.java b/core/api/src/main/java/org/onosproject/mastership/MastershipService.java
index 75d0eac..a709f5c 100644
--- a/core/api/src/main/java/org/onosproject/mastership/MastershipService.java
+++ b/core/api/src/main/java/org/onosproject/mastership/MastershipService.java
@@ -15,6 +15,8 @@
  */
 package org.onosproject.mastership;
 
+import static org.onosproject.net.MastershipRole.MASTER;
+
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
 
@@ -43,6 +45,16 @@
     MastershipRole getLocalRole(DeviceId deviceId);
 
     /**
+     * Returns true if the local controller is the Master for the specified deviceId.
+     *
+     * @param deviceId the the identifier of the device
+     * @return true if local node is master; false otherwise
+     */
+    default boolean isLocalMaster(DeviceId deviceId) {
+        return getLocalRole(deviceId) == MASTER;
+    }
+
+    /**
      * Returns the mastership status of the local controller for a given
      * device forcing master selection if necessary.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/device/DeviceClockProviderService.java b/core/api/src/main/java/org/onosproject/net/device/DeviceClockProviderService.java
deleted file mode 100644
index 3901deb..0000000
--- a/core/api/src/main/java/org/onosproject/net/device/DeviceClockProviderService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.device;
-
-import org.onosproject.mastership.MastershipTerm;
-import org.onosproject.net.DeviceId;
-
-/**
-* Interface for feeding term information to a logical clock service
-* that vends per device timestamps.
-*/
-public interface DeviceClockProviderService {
-
-    /**
-     * Checks if this service can issue Timestamp for specified device.
-     *
-     * @param deviceId device identifier.
-     * @return true if timestamp can be issued for specified device
-     */
-    boolean isTimestampAvailable(DeviceId deviceId);
-
-    /**
-     * Updates the mastership term for the specified deviceId.
-     *
-     * @param deviceId device identifier.
-     * @param term mastership term.
-     */
-    void setMastershipTerm(DeviceId deviceId, MastershipTerm term);
-}
diff --git a/core/api/src/test/java/org/onosproject/net/device/DeviceClockServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/device/DeviceClockServiceAdapter.java
new file mode 100644
index 0000000..5bfdd76
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/device/DeviceClockServiceAdapter.java
@@ -0,0 +1,21 @@
+package org.onosproject.net.device;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.store.Timestamp;
+
+/**
+ * Test adapter for device clock service.
+ */
+public class DeviceClockServiceAdapter implements DeviceClockService {
+
+    @Override
+    public boolean isTimestampAvailable(DeviceId deviceId) {
+        return false;
+    }
+
+    @Override
+    public Timestamp getTimestamp(DeviceId deviceId) {
+        return null;
+    }
+
+}