diff --git a/protocols/p4runtime/ctl/BUCK b/protocols/p4runtime/ctl/BUCK
new file mode 100644
index 0000000..baf1645
--- /dev/null
+++ b/protocols/p4runtime/ctl/BUCK
@@ -0,0 +1,46 @@
+GRPC_DEPS = [
+    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
+    '//lib:grpc-protobuf-1.3.0',
+    '//lib:grpc-protobuf-lite-1.3.0',
+    '//lib:grpc-stub-1.3.0',
+    '//lib:grpc-netty-1.3.0',
+    '//lib:grpc-auth-1.3.0',
+    '//lib:google-instrumentation-0.3.0',
+    '//lib:protobuf-java-3.0.2',
+    # Lazily adding all netty-related packages.
+    # Some of them might not be necessary.
+    '//lib:netty',
+    '//lib:netty-buffer',
+    '//lib:netty-codec',
+    '//lib:netty-codec-http',
+    '//lib:netty-codec-http2',
+    '//lib:netty-common',
+    '//lib:netty-handler',
+    '//lib:netty-transport',
+    '//lib:netty-transport-native-epoll',
+    '//lib:netty-resolver',
+]
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//protocols/grpc/api:onos-protocols-grpc-api',
+    '//protocols/p4runtime/api:onos-protocols-p4runtime-api',
+    '//protocols/p4runtime/proto:onos-protocols-p4runtime-proto'
+] + GRPC_DEPS
+
+TEST_DEPS = [
+    '//lib:TEST',
+    '//core/api:onos-api-tests',
+]
+
+BUNDLES = [
+    '//protocols/grpc/api:onos-protocols-grpc-api',
+    '//protocols/p4runtime/api:onos-protocols-p4runtime-api',
+    '//protocols/p4runtime/proto:onos-protocols-p4runtime-proto'
+] + GRPC_DEPS
+
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+)
\ No newline at end of file
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketInEvent.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketInEvent.java
new file mode 100644
index 0000000..dd2f021
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketInEvent.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2017-present 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.p4runtime.ctl;
+
+import com.google.common.base.Objects;
+import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.event.AbstractEvent;
+import org.onosproject.net.DeviceId;
+import org.onosproject.p4runtime.api.P4RuntimeEvent;
+import org.onosproject.p4runtime.api.P4RuntimeEventListener;
+import org.onosproject.p4runtime.api.P4RuntimeEventSubject;
+import org.onosproject.p4runtime.api.P4RuntimePacketIn;
+
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of a packet-in event.
+ */
+final class DefaultPacketInEvent
+        extends AbstractEvent<P4RuntimeEventListener.Type, P4RuntimeEventSubject>
+        implements P4RuntimeEvent {
+
+    DefaultPacketInEvent(DeviceId deviceId, ImmutableByteSequence data,
+                                   List<ImmutableByteSequence> metadata) {
+        super(P4RuntimeEventListener.Type.PACKET_IN, new DefaultPacketIn(deviceId, data, metadata));
+    }
+
+    /**
+     * Default implementation of a packet-in in P4Runtime.
+     */
+    private static final class DefaultPacketIn implements P4RuntimePacketIn {
+
+        private final DeviceId deviceId;
+        private final ImmutableByteSequence data;
+        private final List<ImmutableByteSequence> metadata;
+
+        private DefaultPacketIn(DeviceId deviceId, ImmutableByteSequence data, List<ImmutableByteSequence> metadata) {
+            this.deviceId = checkNotNull(deviceId);
+            this.data = checkNotNull(data);
+            this.metadata = checkNotNull(metadata);
+        }
+
+        @Override
+        public DeviceId deviceId() {
+            return deviceId;
+        }
+
+        @Override
+        public ImmutableByteSequence data() {
+            return data;
+        }
+
+        @Override
+        public List<ImmutableByteSequence> metadata() {
+            return metadata;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+            DefaultPacketIn that = (DefaultPacketIn) o;
+            return Objects.equal(deviceId, that.deviceId) &&
+                    Objects.equal(data, that.data) &&
+                    Objects.equal(metadata, that.metadata);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(deviceId, data, metadata);
+        }
+    }
+}
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
new file mode 100644
index 0000000..e6603ea
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2017-present 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.p4runtime.ctl;
+
+import com.google.common.collect.ImmutableList;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.ExtensionRegistry;
+import com.google.protobuf.TextFormat;
+import io.grpc.ManagedChannel;
+import io.grpc.Status;
+import io.grpc.StatusRuntimeException;
+import io.grpc.stub.StreamObserver;
+import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.pi.runtime.PiTableEntry;
+import org.onosproject.net.pi.runtime.PiTableId;
+import org.onosproject.p4runtime.api.P4RuntimeClient;
+import org.onosproject.p4runtime.api.P4RuntimeEvent;
+import org.slf4j.Logger;
+import p4.P4RuntimeGrpc;
+import p4.config.P4InfoOuterClass;
+import p4.tmp.P4Config;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import static org.onlab.util.ImmutableByteSequence.copyFrom;
+import static org.slf4j.LoggerFactory.getLogger;
+import static p4.P4RuntimeOuterClass.*;
+import static p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest.Action.VERIFY_AND_COMMIT;
+
+/**
+ * Implementation of a P4Runtime client.
+ */
+public class P4RuntimeClientImpl implements P4RuntimeClient {
+
+    private static final int DEADLINE_SECONDS = 15;
+
+    private final Logger log = getLogger(getClass());
+
+    private final DeviceId deviceId;
+    private final int p4DeviceId;
+    private final P4RuntimeControllerImpl controller;
+    private final P4RuntimeGrpc.P4RuntimeBlockingStub blockingStub;
+    private final P4RuntimeGrpc.P4RuntimeStub asyncStub;
+    private ExecutorService executorService;
+    private StreamObserver<StreamMessageRequest> streamRequestObserver;
+
+
+    P4RuntimeClientImpl(DeviceId deviceId, int p4DeviceId, ManagedChannel channel, P4RuntimeControllerImpl controller,
+                        ExecutorService executorService) {
+        this.deviceId = deviceId;
+        this.p4DeviceId = p4DeviceId;
+        this.controller = controller;
+        this.executorService = executorService;
+        this.blockingStub = P4RuntimeGrpc.newBlockingStub(channel)
+                .withDeadlineAfter(DEADLINE_SECONDS, TimeUnit.SECONDS);
+        this.asyncStub = P4RuntimeGrpc.newStub(channel)
+                .withDeadlineAfter(DEADLINE_SECONDS, TimeUnit.SECONDS);
+    }
+
+    @Override
+    public CompletableFuture<Boolean> initStreamChannel() {
+        return CompletableFuture.supplyAsync(this::doInitStreamChannel, executorService);
+    }
+
+    private boolean doInitStreamChannel() {
+        if (this.streamRequestObserver == null) {
+            this.streamRequestObserver = this.asyncStub.streamChannel(new StreamChannelResponseObserver());
+            // To listen for packets and other events, we need to start the RPC.
+            // Here we do it by sending an empty packet out.
+            try {
+                this.streamRequestObserver.onNext(StreamMessageRequest.newBuilder()
+                                                          .setPacket(PacketOut.getDefaultInstance())
+                                                          .build());
+            } catch (StatusRuntimeException e) {
+                log.warn("Unable to initialize stream channel for {}: {}", deviceId, e);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public CompletableFuture<Boolean> setPipelineConfig(InputStream p4info, InputStream targetConfig) {
+        return CompletableFuture.supplyAsync(() -> doSetPipelineConfig(p4info, targetConfig), executorService);
+    }
+
+    private boolean doSetPipelineConfig(InputStream p4info, InputStream targetConfig) {
+
+        log.debug("Setting pipeline config for {}", deviceId);
+
+        P4InfoOuterClass.P4Info.Builder p4iInfoBuilder = P4InfoOuterClass.P4Info.newBuilder();
+
+        try {
+            TextFormat.getParser().merge(new InputStreamReader(p4info),
+                                         ExtensionRegistry.getEmptyRegistry(),
+                                         p4iInfoBuilder);
+        } catch (IOException ex) {
+            log.warn("Unable to load p4info for {}: {}", deviceId, ex.getMessage());
+            return false;
+        }
+
+        P4Config.P4DeviceConfig deviceIdConfig;
+        try {
+            deviceIdConfig = P4Config.P4DeviceConfig
+                    .newBuilder()
+                    .setExtras(P4Config.P4DeviceConfig.Extras.getDefaultInstance())
+                    .setReassign(true)
+                    .setDeviceData(ByteString.readFrom(targetConfig))
+                    .build();
+        } catch (IOException ex) {
+            log.warn("Unable to load target-specific config for {}: {}", deviceId, ex.getMessage());
+            return false;
+        }
+
+        SetForwardingPipelineConfigRequest request = SetForwardingPipelineConfigRequest
+                .newBuilder()
+                .setAction(VERIFY_AND_COMMIT)
+                .addConfigs(ForwardingPipelineConfig
+                                    .newBuilder()
+                                    .setDeviceId(p4DeviceId)
+                                    .setP4Info(p4iInfoBuilder.build())
+                                    .setP4DeviceConfig(deviceIdConfig.toByteString())
+                                    .build())
+                .build();
+        try {
+            this.blockingStub.setForwardingPipelineConfig(request);
+        } catch (StatusRuntimeException ex) {
+            log.warn("Unable to set pipeline config for {}: {}", deviceId, ex.getMessage());
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean writeTableEntries(Collection<PiTableEntry> entries, WriteOperationType opType) {
+
+        throw new UnsupportedOperationException("writeTableEntries not implemented.");
+    }
+
+    @Override
+    public CompletableFuture<Collection<PiTableEntry>> dumpTable(PiTableId tableId) {
+
+        throw new UnsupportedOperationException("dumpTable not implemented.");
+    }
+
+    @Override
+    public void shutdown() {
+
+        if (this.streamRequestObserver != null) {
+            this.streamRequestObserver.onError(new StatusRuntimeException(Status.CANCELLED));
+            this.streamRequestObserver.onCompleted();
+        }
+
+        this.executorService.shutdownNow();
+        try {
+            executorService.awaitTermination(5, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            log.warn("Executor service didn't shutdown in time.");
+        }
+
+        // Prevent the execution of other tasks.
+        executorService = null;
+    }
+
+    private class StreamChannelResponseObserver implements StreamObserver<StreamMessageResponse> {
+
+        @Override
+        public void onNext(StreamMessageResponse message) {
+
+            P4RuntimeEvent event;
+
+            if (message.getPacket().isInitialized()) {
+                // Packet-in
+                PacketIn packetIn = message.getPacket();
+                ImmutableByteSequence data = copyFrom(packetIn.getPayload().asReadOnlyByteBuffer());
+                ImmutableList.Builder<ImmutableByteSequence> metadataBuilder = ImmutableList.builder();
+                packetIn.getMetadataList().stream()
+                        .map(m -> m.getValue().asReadOnlyByteBuffer())
+                        .map(ImmutableByteSequence::copyFrom)
+                        .forEach(metadataBuilder::add);
+                event = new DefaultPacketInEvent(deviceId, data, metadataBuilder.build());
+
+            } else if (message.getArbitration().isInitialized()) {
+                // Arbitration.
+                throw new UnsupportedOperationException("Arbitration not implemented.");
+
+            } else {
+                log.warn("Unrecognized stream message from {}: {}", deviceId, message);
+                return;
+            }
+
+            controller.postEvent(event);
+        }
+
+        @Override
+        public void onError(Throwable throwable) {
+            log.warn("Error on stream channel for {}: {}", deviceId, throwable);
+        }
+
+        @Override
+        public void onCompleted() {
+            // TODO: declare the device as disconnected?
+        }
+    }
+
+}
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
new file mode 100644
index 0000000..cd4151c
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeControllerImpl.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2017-present 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.p4runtime.ctl;
+
+import com.google.common.collect.Maps;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.grpc.NameResolverProvider;
+import io.grpc.internal.DnsNameResolverProvider;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onosproject.event.AbstractListenerManager;
+import org.onosproject.grpc.api.GrpcChannelId;
+import org.onosproject.grpc.api.GrpcController;
+import org.onosproject.net.DeviceId;
+import org.onosproject.p4runtime.api.P4RuntimeClient;
+import org.onosproject.p4runtime.api.P4RuntimeController;
+import org.onosproject.p4runtime.api.P4RuntimeEvent;
+import org.onosproject.p4runtime.api.P4RuntimeEventListener;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.lang.String.format;
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * P4Runtime controller implementation.
+ */
+@Component(immediate = true)
+@Service
+public class P4RuntimeControllerImpl
+        extends AbstractListenerManager<P4RuntimeEvent, P4RuntimeEventListener>
+        implements P4RuntimeController {
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected GrpcController grpcController;
+
+    private final Logger log = getLogger(getClass());
+
+    private final NameResolverProvider nameResolverProvider = new DnsNameResolverProvider();
+    private final Map<DeviceId, P4RuntimeClient> clients = Maps.newConcurrentMap();
+    private final Map<DeviceId, GrpcChannelId> channelIds = Maps.newConcurrentMap();
+    // TODO: should use a cache to delete unused locks.
+    private final Map<DeviceId, Lock> deviceLocks = Maps.newConcurrentMap();
+
+    @Activate
+    public void activate() {
+        log.info("Started");
+    }
+
+
+    @Deactivate
+    public void deactivate() {
+        grpcController = null;
+        log.info("Stopped");
+    }
+
+
+    @Override
+    public boolean createClient(DeviceId deviceId, int p4DeviceId, ManagedChannelBuilder channelBuilder) {
+        checkNotNull(deviceId);
+        checkNotNull(channelBuilder);
+
+        deviceLocks.putIfAbsent(deviceId, new ReentrantLock());
+        deviceLocks.get(deviceId).lock();
+
+        log.info("Creating client for {} (with internal device id {})...", deviceId, p4DeviceId);
+
+        try {
+            if (clients.containsKey(deviceId)) {
+                throw new IllegalStateException(format("A client already exists for %s", deviceId));
+            } else {
+                return doCreateClient(deviceId, p4DeviceId, channelBuilder);
+            }
+        } finally {
+            deviceLocks.get(deviceId).unlock();
+        }
+    }
+
+    private boolean doCreateClient(DeviceId deviceId, int p4DeviceId, ManagedChannelBuilder channelBuilder) {
+        GrpcChannelId channelId = GrpcChannelId.of(deviceId, "p4runtime");
+
+        // Channel defaults.
+        channelBuilder.nameResolverFactory(nameResolverProvider);
+
+        ManagedChannel channel;
+        try {
+            channel = grpcController.connectChannel(channelId, channelBuilder);
+        } catch (IOException e) {
+            log.warn("Unable to connect to gRPC server of {}: {}", deviceId, e.getMessage());
+            return false;
+        }
+
+        P4RuntimeClient client = new P4RuntimeClientImpl(deviceId, p4DeviceId, channel, this,
+                                                         newSingleThreadExecutor());
+
+        channelIds.put(deviceId, channelId);
+        clients.put(deviceId, client);
+
+        return true;
+    }
+
+    @Override
+    public P4RuntimeClient getClient(DeviceId deviceId) {
+
+        deviceLocks.putIfAbsent(deviceId, new ReentrantLock());
+        deviceLocks.get(deviceId).lock();
+
+        try {
+            return clients.get(deviceId);
+        } finally {
+            deviceLocks.get(deviceId).unlock();
+        }
+    }
+
+    @Override
+    public void removeClient(DeviceId deviceId) {
+
+        deviceLocks.putIfAbsent(deviceId, new ReentrantLock());
+        deviceLocks.get(deviceId).lock();
+
+        try {
+            if (clients.containsKey(deviceId)) {
+                clients.get(deviceId).shutdown();
+                grpcController.disconnectChannel(channelIds.get(deviceId));
+                clients.remove(deviceId);
+            }
+        } finally {
+            deviceLocks.get(deviceId).unlock();
+        }
+    }
+
+    @Override
+    public boolean hasClient(DeviceId deviceId) {
+
+        deviceLocks.putIfAbsent(deviceId, new ReentrantLock());
+        deviceLocks.get(deviceId).lock();
+
+        try {
+            return clients.containsKey(deviceId);
+        } finally {
+            deviceLocks.get(deviceId).unlock();
+        }
+    }
+
+    void postEvent(P4RuntimeEvent event) {
+        post(event);
+    }
+}
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/package-info.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/package-info.java
new file mode 100644
index 0000000..f7503a5
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2017-present 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.
+ */
+
+/**
+ * Implementation classes of the P4Runtime protocol subsystem.
+ */
+package org.onosproject.p4runtime.ctl;
\ No newline at end of file
