Fixed internal device ID in P4Runtime

Data type for the P4Runtime server-specific device ID is uint_64.
We were using int to store it in ONOS.

Change-Id: Ia4624cfc453ccf6b00a690eb9e4e4ad14a7881ec
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeHandshaker.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeHandshaker.java
index 82a9b85..ee070eb 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeHandshaker.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeHandshaker.java
@@ -55,7 +55,7 @@
 
         String serverAddr = data.value("p4runtime_ip");
         int serverPort = Integer.valueOf(data.value("p4runtime_port"));
-        int p4DeviceId = Integer.valueOf(data.value("p4runtime_deviceId"));
+        long p4DeviceId = Long.parseUnsignedLong(data.value("p4runtime_deviceId"));
 
         ManagedChannelBuilder channelBuilder = NettyChannelBuilder
                 .forAddress(serverAddr, serverPort)
diff --git a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeController.java b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeController.java
index 6101f8b..b095bca 100644
--- a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeController.java
+++ b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeController.java
@@ -39,7 +39,7 @@
      * @return true if the client was created and the channel to the device is open
      * @throws IllegalStateException if a client already exists for the given device identifier
      */
-    boolean createClient(DeviceId deviceId, int p4DeviceId, ManagedChannelBuilder channelBuilder);
+    boolean createClient(DeviceId deviceId, long p4DeviceId, ManagedChannelBuilder channelBuilder);
 
     /**
      * Returns a client to operate on the given device.
@@ -69,7 +69,7 @@
     /**
      * Returns true if the P4Runtime server running on the given device is reachable, i.e. the channel is open and the
      * server is able to respond to RPCs, false otherwise. Reachability can be tested only if a client was previously
-     * created using {@link #createClient(DeviceId, int, ManagedChannelBuilder)}, otherwise this method returns false.
+     * created using {@link #createClient(DeviceId, long, ManagedChannelBuilder)}, otherwise this method returns false.
      *
      * @param deviceId device identifier.
      * @return true if a client was created and is able to contact the P4Runtime server, false otherwise.
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
index 3a4a1b5..26ec75a 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
@@ -94,7 +94,7 @@
     private final Logger log = getLogger(getClass());
 
     private final DeviceId deviceId;
-    private final int p4DeviceId;
+    private final long p4DeviceId;
     private final P4RuntimeControllerImpl controller;
     private final P4RuntimeGrpc.P4RuntimeBlockingStub blockingStub;
     private final Context.CancellableContext cancellableContext;
@@ -104,7 +104,8 @@
     private final StreamObserver<StreamMessageRequest> streamRequestObserver;
 
 
-    P4RuntimeClientImpl(DeviceId deviceId, int p4DeviceId, ManagedChannel channel, P4RuntimeControllerImpl controller) {
+    P4RuntimeClientImpl(DeviceId deviceId, long p4DeviceId, ManagedChannel channel,
+                        P4RuntimeControllerImpl controller) {
         this.deviceId = deviceId;
         this.p4DeviceId = p4DeviceId;
         this.controller = controller;
@@ -391,7 +392,7 @@
      *
      * @return P4 device ID
      */
-    public int p4DeviceId() {
+    public long p4DeviceId() {
         return p4DeviceId;
     }
 
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeControllerImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeControllerImpl.java
index 33930bb..e26341b 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeControllerImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeControllerImpl.java
@@ -81,7 +81,7 @@
 
 
     @Override
-    public boolean createClient(DeviceId deviceId, int p4DeviceId, ManagedChannelBuilder channelBuilder) {
+    public boolean createClient(DeviceId deviceId, long p4DeviceId, ManagedChannelBuilder channelBuilder) {
         checkNotNull(deviceId);
         checkNotNull(channelBuilder);
 
@@ -101,7 +101,7 @@
         }
     }
 
-    private boolean doCreateClient(DeviceId deviceId, int p4DeviceId, ManagedChannelBuilder channelBuilder) {
+    private boolean doCreateClient(DeviceId deviceId, long p4DeviceId, ManagedChannelBuilder channelBuilder) {
 
         GrpcChannelId channelId = GrpcChannelId.of(deviceId, "p4runtime");