Various fixes in preparation of Stratum demo at ONS 2019
- Do not read counters with table entries for Barefoot drivers
- If driver behavior setup fails, log which operation we are aborting
- Remove unnecessary setup steps in Stratum-related drivers
- Always get clients by their key in gRPC-based drivers
- Log when P4Runtime group operation fails because of missing group in
store
- Fix polling of table entry counters for P4Runtime driver
Change-Id: Ic9bf19b76d8cb5a191aec24852af4410fea8b998
diff --git a/drivers/gnoi/src/main/java/org/onosproject/drivers/gnoi/GnoiBasicSystemOperationsImpl.java b/drivers/gnoi/src/main/java/org/onosproject/drivers/gnoi/GnoiBasicSystemOperationsImpl.java
index 411a8bf..b979546 100644
--- a/drivers/gnoi/src/main/java/org/onosproject/drivers/gnoi/GnoiBasicSystemOperationsImpl.java
+++ b/drivers/gnoi/src/main/java/org/onosproject/drivers/gnoi/GnoiBasicSystemOperationsImpl.java
@@ -16,17 +16,18 @@
package org.onosproject.drivers.gnoi;
+import gnoi.system.SystemOuterClass.RebootMethod;
import gnoi.system.SystemOuterClass.RebootRequest;
import gnoi.system.SystemOuterClass.RebootResponse;
-import gnoi.system.SystemOuterClass.RebootMethod;
import org.onosproject.net.behaviour.BasicSystemOperations;
-import java.util.concurrent.CompletableFuture;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.concurrent.CompletableFuture;
+
/**
- * Implementation of the BasicSystemOperations behavior for gNOI-enabled devices.
+ * Implementation of the BasicSystemOperations behavior for gNOI-enabled
+ * devices.
*/
public class GnoiBasicSystemOperationsImpl
extends AbstractGnoiHandlerBehaviour implements BasicSystemOperations {
@@ -36,12 +37,13 @@
@Override
public CompletableFuture<Boolean> reboot() {
- if (!setupBehaviour()) {
+ if (!setupBehaviour("reboot()")) {
return CompletableFuture.completedFuture(false);
}
final RebootRequest.Builder requestMsg = RebootRequest.newBuilder().setMethod(RebootMethod.COLD);
- final CompletableFuture<Boolean> future = client.reboot(requestMsg.build())
+
+ return client.reboot(requestMsg.build())
.handle((response, error) -> {
if (error == null) {
log.debug("gNOI reboot() for device {} returned {}", deviceId, response);
@@ -51,16 +53,14 @@
return false;
}
});
-
- return future;
}
@Override
public CompletableFuture<Long> time() {
- if (!setupBehaviour()) {
+ if (!setupBehaviour("time()")) {
return CompletableFuture.completedFuture(0L);
}
- final CompletableFuture<Long> future = client.time()
+ return client.time()
.handle((response, error) -> {
if (error == null) {
log.debug("gNOI time() for device {} returned {}", deviceId.uri(), response.getTime());
@@ -70,7 +70,5 @@
return 0L;
}
});
-
- return future;
}
}