Removes the gRPC channel if an exception occurs while instantiating the client
Includes also other minor changes to gRPC channel creation/connection
process, such as:
- More compact logs showing the gRPC client key
- GrpcChannelController.connectChannel() now returns the same
StatusRuntime exception, no need to wrap it in an IOException
- Wait for channel shutdown after initial connection error
Change-Id: Ib7d2b728b8c82d9f9b2097cffcebd31cac891b27
diff --git a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClientKey.java b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClientKey.java
index 70bf33c..4c23bbc 100644
--- a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClientKey.java
+++ b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClientKey.java
@@ -27,7 +27,7 @@
*/
@Beta
public final class P4RuntimeClientKey extends GrpcClientKey {
- private static final String P4R_SERVICE_NAME = "p4runtime";
+ private static final String P4RUNTIME = "P4Runtime";
private final long p4DeviceId;
/**
@@ -40,7 +40,7 @@
*/
public P4RuntimeClientKey(DeviceId deviceId, String serverAddr,
int serverPort, long p4DeviceId) {
- super(P4R_SERVICE_NAME, deviceId, serverAddr, serverPort);
+ super(P4RUNTIME, deviceId, serverAddr, serverPort);
this.p4DeviceId = p4DeviceId;
}
@@ -75,8 +75,6 @@
@Override
public String toString() {
- return super.toStringHelper()
- .add("p4DeviceId", p4DeviceId)
- .toString();
+ return super.toString() + "/" + p4DeviceId;
}
}