diff --git a/incubator/protobuf/services/nb/BUCK b/incubator/protobuf/services/nb/BUCK
index 4d9c789..6f582e0 100644
--- a/incubator/protobuf/services/nb/BUCK
+++ b/incubator/protobuf/services/nb/BUCK
@@ -5,11 +5,14 @@
     '//incubator/protobuf/models:onos-incubator-protobuf-models-proto',
     '//incubator/protobuf/models:onos-incubator-protobuf-models',
     '//lib:protobuf-java-3.2.0',
-    '//lib:GRPC_1.3'
+    '//lib:GRPC_1.3',
+    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
+    '//lib:grpc-protobuf-lite-1.3.0'
 ]
 
 GRPC_DEPS = [
     '//lib:GRPC_1.3',
+    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
     '//incubator/protobuf/models:onos-incubator-protobuf-models-proto',
     '//lib:protobuf-java-3.2.0',
     '//lib:guava'
@@ -23,6 +26,7 @@
     '//lib:protobuf-java-3.2.0',
     '//lib:guava',
     '//lib:grpc-core-1.3.0',
+    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
     '//lib:grpc-protobuf-1.3.0',
     '//lib:grpc-stub-1.3.0',
     '//lib:grpc-netty-1.3.0',
diff --git a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/GrpcNbDeviceServiceUtil.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/GrpcNbDeviceServiceUtil.java
deleted file mode 100644
index 0ad1b3f..0000000
--- a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/GrpcNbDeviceServiceUtil.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * 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.grpc.nb.utils;
-
-import org.onlab.packet.ChassisId;
-import org.onosproject.grpc.net.device.models.DeviceDescriptionProtoOuterClass;
-import org.onosproject.grpc.net.device.models.DeviceDescriptionProtoOuterClass.DeviceDescriptionProto;
-import org.onosproject.grpc.net.device.models.DeviceEnumsProto.DeviceTypeProto;
-import org.onosproject.grpc.net.device.models.DeviceEnumsProto.MastershipRoleProto;
-import org.onosproject.grpc.net.device.models.PortDescriptionProtoOuterClass.PortDescriptionProto;
-import org.onosproject.grpc.net.device.models.PortEnumsProto;
-
-import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass;
-import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass.PortStatisticsProto;
-import org.onosproject.net.Annotations;
-import org.onosproject.net.DefaultAnnotations;
-import org.onosproject.net.Device.Type;
-import org.onosproject.net.MastershipRole;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.device.DefaultDeviceDescription;
-import org.onosproject.net.device.DefaultPortDescription;
-import org.onosproject.net.device.DefaultPortStatistics;
-import org.onosproject.net.device.DeviceDescription;
-import org.onosproject.net.device.PortDescription;
-import org.onosproject.net.device.PortStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * gRPC message conversion related utilities for device service.
- */
-public final class GrpcNbDeviceServiceUtil {
-
-    private static final Logger log = LoggerFactory.getLogger(GrpcNbDeviceServiceUtil.class);
-
-    /**
-     * Translates gRPC enum MastershipRole to ONOS enum.
-     *
-     * @param role mastership role in gRPC enum
-     * @return equivalent in ONOS enum
-     */
-    public static MastershipRole translate(MastershipRoleProto role) {
-        switch (role) {
-            case NONE:
-                return MastershipRole.NONE;
-            case MASTER:
-                return MastershipRole.MASTER;
-            case STANDBY:
-                return MastershipRole.STANDBY;
-            case UNRECOGNIZED:
-                log.warn("Unrecognized MastershipRole gRPC message: {}", role);
-                return MastershipRole.NONE;
-            default:
-                return MastershipRole.NONE;
-        }
-    }
-
-    /**
-     * Translates ONOS enum MastershipRole to gRPC enum.
-     *
-     * @param newRole ONOS' mastership role
-     * @return equivalent in gRPC message enum
-     */
-    public static MastershipRoleProto translate(MastershipRole newRole) {
-        switch (newRole) {
-            case MASTER:
-                return MastershipRoleProto.MASTER;
-            case STANDBY:
-                return MastershipRoleProto.STANDBY;
-            case NONE:
-            default:
-                return MastershipRoleProto.NONE;
-        }
-    }
-
-
-    /**
-     * Translates gRPC DeviceDescription to {@link DeviceDescriptionProtoOuterClass}.
-     *
-     * @param deviceDescription gRPC message
-     * @return {@link DeviceDescriptionProtoOuterClass}
-     */
-    public static DeviceDescription translate(
-            DeviceDescriptionProto deviceDescription) {
-        URI uri = URI.create(deviceDescription.getDeviceUri());
-        Type type = translate(deviceDescription.getType());
-        String manufacturer = deviceDescription.getManufacturer();
-        String hwVersion = deviceDescription.getHwVersion();
-        String swVersion = deviceDescription.getSwVersion();
-        String serialNumber = deviceDescription.getSerialNumber();
-        ChassisId chassis = new ChassisId(deviceDescription.getChassisId());
-        boolean defaultAvailable = deviceDescription.getIsDefaultAvailable();
-        return new DefaultDeviceDescription(uri, type, manufacturer,
-                hwVersion, swVersion, serialNumber,
-                chassis,
-                defaultAvailable,
-                asAnnotations(deviceDescription.getAnnotationsMap()));
-    }
-
-    /**
-     * Translates {@link DeviceDescription} to gRPC DeviceDescription message.
-     *
-     * @param deviceDescription {@link DeviceDescription}
-     * @return gRPC DeviceDescription message
-     */
-    public static DeviceDescriptionProto translate(
-            DeviceDescription deviceDescription) {
-
-        return DeviceDescriptionProto.newBuilder()
-                .setDeviceUri(deviceDescription.deviceUri().toString())
-                .setType(translate(deviceDescription.type()))
-                .setManufacturer(deviceDescription.manufacturer())
-                .setHwVersion(deviceDescription.hwVersion())
-                .setSwVersion(deviceDescription.swVersion())
-                .setSerialNumber(deviceDescription.serialNumber())
-                .setChassisId(deviceDescription.chassisId().toString())
-                .setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
-                .putAllAnnotations(asMap(deviceDescription.annotations()))
-                .build();
-    }
-
-
-    /**
-     * Translates gRPC DeviceType to {@link Type}.
-     *
-     * @param type      gRPC message
-     * @return  {@link Type}
-     */
-    public static Type translate(DeviceTypeProto type) {
-        switch (type) {
-            case BALANCER:
-                return Type.BALANCER;
-            case CONTROLLER:
-                return Type.CONTROLLER;
-            case FIBER_SWITCH:
-                return Type.FIBER_SWITCH;
-            case FIREWALL:
-                return Type.FIREWALL;
-            case IDS:
-                return Type.IDS;
-            case IPS:
-                return Type.IPS;
-            case MICROWAVE:
-                return Type.MICROWAVE;
-            case OTHER:
-                return Type.OTHER;
-            case OTN:
-                return Type.OTN;
-            case ROADM:
-                return Type.ROADM;
-            case ROADM_OTN:
-                return Type.ROADM_OTN;
-            case ROUTER:
-                return Type.ROUTER;
-            case SWITCH:
-                return Type.SWITCH;
-            case VIRTUAL_DEVICE:
-                return Type.VIRTUAL;
-
-            case UNRECOGNIZED:
-            default:
-                log.warn("Unexpected DeviceType: {}", type);
-                return Type.OTHER;
-        }
-    }
-
-    /**
-     * Translates {@link Type} to gRPC DeviceType.
-     *
-     * @param type {@link Type}
-     * @return  gRPC message
-     */
-    public static DeviceTypeProto translate(Type type) {
-        switch (type) {
-            case BALANCER:
-                return DeviceTypeProto.BALANCER;
-            case CONTROLLER:
-                return DeviceTypeProto.CONTROLLER;
-            case FIBER_SWITCH:
-                return DeviceTypeProto.FIBER_SWITCH;
-            case FIREWALL:
-                return DeviceTypeProto.FIREWALL;
-            case IDS:
-                return DeviceTypeProto.IDS;
-            case IPS:
-                return DeviceTypeProto.IPS;
-            case MICROWAVE:
-                return DeviceTypeProto.MICROWAVE;
-            case OTHER:
-                return DeviceTypeProto.OTHER;
-            case OTN:
-                return DeviceTypeProto.OTN;
-            case ROADM:
-                return DeviceTypeProto.ROADM;
-            case ROADM_OTN:
-                return DeviceTypeProto.ROADM_OTN;
-            case ROUTER:
-                return DeviceTypeProto.ROUTER;
-            case SWITCH:
-                return DeviceTypeProto.SWITCH;
-            case VIRTUAL:
-                return DeviceTypeProto.VIRTUAL_DEVICE;
-
-            default:
-                log.warn("Unexpected Device.Type: {}", type);
-                return DeviceTypeProto.OTHER;
-        }
-    }
-
-    /**
-     * Translates gRPC PortDescription message to {@link PortDescription}.
-     *
-     * @param portDescription gRPC message
-     * @return {@link PortDescription}
-     */
-    public static PortDescription translate(PortDescriptionProto portDescription) {
-        PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
-        boolean isEnabled = portDescription.getIsEnabled();
-        Port.Type type = translate(portDescription.getType());
-        long portSpeed = portDescription.getPortSpeed();
-        SparseAnnotations annotations = asAnnotations(portDescription.getAnnotationsMap());
-        // TODO How to deal with more specific Port...
-        return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
-    }
-
-    /**
-     * Translates {@link PortDescription} to gRPC PortDescription message.
-     *
-     * @param portDescription {@link PortDescription}
-     * @return gRPC PortDescription message
-     */
-    public static PortDescriptionProto translate(PortDescription portDescription) {
-        return PortDescriptionProto.newBuilder()
-                .setPortNumber(portDescription.portNumber().toString())
-                .setIsEnabled(portDescription.isEnabled())
-                .setType(translate(portDescription.type()))
-                .setPortSpeed(portDescription.portSpeed())
-                .putAllAnnotations(asMap(portDescription.annotations()))
-                .build();
-    }
-
-    /**
-     * Translates gRPC PortType to {@link Port.Type}.
-     *
-     * @param type      gRPC message
-     * @return  {@link Port.Type}
-     */
-    public static Port.Type translate(PortEnumsProto.PortTypeProto type) {
-        switch (type) {
-            case COPPER:
-                return Port.Type.COPPER;
-            case FIBER:
-                return Port.Type.FIBER;
-            case OCH:
-                return Port.Type.OCH;
-            case ODUCLT:
-                return Port.Type.ODUCLT;
-            case OMS:
-                return Port.Type.OMS;
-            case PACKET:
-                return Port.Type.PACKET;
-            case VIRTUAL_PORT:
-                return Port.Type.VIRTUAL;
-
-            case UNRECOGNIZED:
-            default:
-                log.warn("Unexpected PortType: {}", type);
-                return Port.Type.COPPER;
-        }
-    }
-
-    /**
-     * Translates {@link Port.Type} to gRPC PortType.
-     *
-     * @param type      {@link Port.Type}
-     * @return  gRPC message
-     */
-    public static PortEnumsProto.PortTypeProto translate(Port.Type type) {
-        switch (type) {
-            case COPPER:
-                return PortEnumsProto.PortTypeProto.COPPER;
-            case FIBER:
-                return PortEnumsProto.PortTypeProto.FIBER;
-            case OCH:
-                return PortEnumsProto.PortTypeProto.OCH;
-            case ODUCLT:
-                return PortEnumsProto.PortTypeProto.ODUCLT;
-            case OMS:
-                return PortEnumsProto.PortTypeProto.OMS;
-            case PACKET:
-                return PortEnumsProto.PortTypeProto.PACKET;
-            case VIRTUAL:
-                return PortEnumsProto.PortTypeProto.VIRTUAL_PORT;
-
-            default:
-                log.warn("Unexpected Port.Type: {}", type);
-                return PortEnumsProto.PortTypeProto.COPPER;
-        }
-    }
-
-    /**
-     * Translates gRPC PortStatistics message to {@link PortStatisticsProtoOuterClass}.
-     *
-     * @param portStatistics gRPC PortStatistics message
-     * @return {@link PortStatisticsProtoOuterClass}
-     */
-    public static PortStatistics translate(PortStatisticsProto portStatistics) {
-        // TODO implement adding missing fields
-        return DefaultPortStatistics.builder()
-                .setPort(portStatistics.getPort())
-                .setPacketsReceived(portStatistics.getPacketsReceived())
-                .setPacketsSent(portStatistics.getPacketsSent())
-                .build();
-    }
-
-    /**
-     * Translates {@link PortStatistics} to gRPC PortStatistics message.
-     *
-     * @param portStatistics {@link PortStatistics}
-     * @return gRPC PortStatistics message
-     */
-    public static PortStatisticsProto translate(PortStatistics portStatistics) {
-        // TODO implement adding missing fields
-        return PortStatisticsProto.newBuilder()
-                .setPort(portStatistics.port())
-                .setPacketsReceived(portStatistics.packetsReceived())
-                .setPacketsSent(portStatistics.packetsSent())
-                .build();
-    }
-
-    // may be this can be moved to Annotation itself or AnnotationsUtils
-    /**
-     * Converts Annotations to Map of Strings.
-     *
-     * @param annotations {@link Annotations}
-     * @return Map of annotation key and values
-     */
-    public static Map<String, String> asMap(Annotations annotations) {
-        if (annotations instanceof DefaultAnnotations) {
-            return ((DefaultAnnotations) annotations).asMap();
-        }
-        Map<String, String> map = new HashMap<>();
-        annotations.keys()
-                .forEach(k -> map.put(k, annotations.value(k)));
-
-        return map;
-    }
-
-    // may be this can be moved to Annotation itself or AnnotationsUtils
-    /**
-     * Converts Map of Strings to {@link SparseAnnotations}.
-     *
-     * @param annotations Map of annotation key and values
-     * @return {@link SparseAnnotations}
-     */
-    public static SparseAnnotations asAnnotations(Map<String, String> annotations) {
-        DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
-        annotations.entrySet().forEach(e -> {
-            if (e.getValue() != null) {
-                builder.set(e.getKey(), e.getValue());
-            } else {
-                builder.remove(e.getKey());
-            }
-        });
-        return builder.build();
-    }
-
-    // Utility class not intended for instantiation.
-    private GrpcNbDeviceServiceUtil() {}
-}
diff --git a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/package-info.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/package-info.java
deleted file mode 100644
index 341744c..0000000
--- a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/utils/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * 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.
- */
-
-/**
- * A package contains a set of utilities that are used to convert gRPC model
- * object to ONOS data model object.
- */
-package org.onosproject.grpc.nb.utils;
\ No newline at end of file
diff --git a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/GrpcNbDeviceService.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbDeviceService.java
similarity index 99%
rename from incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/GrpcNbDeviceService.java
rename to incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbDeviceService.java
index 1e1bdc9..df85f18 100644
--- a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/GrpcNbDeviceService.java
+++ b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbDeviceService.java
@@ -33,7 +33,7 @@
 import org.onosproject.net.MastershipRole;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.device.DeviceService;
-import org.onosproject.grpc.nb.utils.GrpcNbDeviceServiceUtil;
+import org.onosproject.incubator.protobuf.models.GrpcNbDeviceServiceUtil;
 
 import static org.onosproject.grpc.nb.net.device.DeviceServiceNb.*;
 
diff --git a/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkService.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkService.java
new file mode 100644
index 0000000..d6d7d61
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkService.java
@@ -0,0 +1,216 @@
+/*
+* Copyright 2017-present Open Networking Foundation
+*
+* 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.incubator.protobuf.services.nb;
+import org.onosproject.incubator.protobuf.models.net.ConnectPointProtoTranslator;
+import org.onosproject.incubator.protobuf.models.net.LinkProtoTranslator;
+
+import com.google.common.annotations.Beta;
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.grpc.stub.StreamObserver;
+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.onosproject.grpc.nb.net.link.LinkServiceGrpc.LinkServiceImplBase;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.link.LinkService;
+
+import java.io.IOException;
+
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinkCountRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinkCountReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinkRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinkReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getActiveLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getActiveLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceEgressLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceEgressLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceIngressLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getDeviceIngressLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getEgressLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getEgressLinksReply;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getIngressLinksRequest;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb.getIngressLinksReply;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A server that provides access to the methods exposed by {@link org.onosproject.net.link.LinkService}.
+ */
+@Beta
+@Component(immediate = true)
+public class GrpcNbLinkService {
+
+    private static final Logger log = LoggerFactory.getLogger(GrpcNbLinkService.class);
+
+
+    private Server server;
+    private LinkServiceNBServerInternal innerClassInstance = null;
+
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    @Activate
+    public void activate() {
+        server = ServerBuilder.forPort(64000).addService(getInnerClassInstance()).build();
+        try {
+            server.start();
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+
+    @Deactivate
+    public void deactivate() {
+        server.shutdown();
+    }
+
+    public class LinkServiceNBServerInternal extends LinkServiceImplBase {
+
+        public LinkServiceNBServerInternal() {
+            super();
+        }
+
+        @Override
+        public void getLinkCount(getLinkCountRequest request,
+                                 StreamObserver<getLinkCountReply> responseObserver) {
+            responseObserver
+                    .onNext(getLinkCountReply
+                                    .newBuilder()
+                                    .setLinkCount(linkService.getLinkCount())
+                                    .build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getLink(getLinkRequest request,
+                            StreamObserver<getLinkReply> responseObserver) {
+            ConnectPoint src = ConnectPointProtoTranslator.translate(request.getSrc()).get();
+            ConnectPoint dst = ConnectPointProtoTranslator.translate(request.getDst()).get();
+
+            org.onosproject.net.Link link = linkService.getLink(src, dst);
+            getLinkReply reply = getLinkReply.newBuilder()
+                    .setLink(LinkProtoTranslator.translate(link)).build();
+
+            responseObserver.onNext(reply);
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getActiveLinks(getActiveLinksRequest request,
+                                   StreamObserver<getActiveLinksReply> responseObserver) {
+            getActiveLinksReply.Builder builder = getActiveLinksReply.newBuilder();
+            linkService.getActiveLinks().forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getDeviceLinks(getDeviceLinksRequest request,
+                                   StreamObserver<getDeviceLinksReply> responseObserver) {
+            DeviceId deviceId = DeviceId.deviceId(request.getDeviceId());
+            getDeviceLinksReply.Builder builder = getDeviceLinksReply.newBuilder();
+            linkService.getDeviceLinks(deviceId).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getDeviceEgressLinks(getDeviceEgressLinksRequest request,
+                                         StreamObserver<getDeviceEgressLinksReply> responseObserver) {
+            DeviceId deviceId = DeviceId.deviceId(request.getDeviceId());
+            getDeviceEgressLinksReply.Builder builder = getDeviceEgressLinksReply.newBuilder();
+            linkService.getDeviceEgressLinks(deviceId).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getDeviceIngressLinks(getDeviceIngressLinksRequest request,
+                                          StreamObserver<getDeviceIngressLinksReply> responseObserver) {
+            DeviceId deviceId = DeviceId.deviceId(request.getDeviceId());
+            getDeviceIngressLinksReply.Builder builder = getDeviceIngressLinksReply.newBuilder();
+            linkService.getDeviceIngressLinks(deviceId).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getEgressLinks(getEgressLinksRequest request,
+                                   StreamObserver<getEgressLinksReply> responseObserver) {
+            ConnectPoint connectPoint = ConnectPointProtoTranslator.translate(request.getConnectPoint()).get();
+            getEgressLinksReply.Builder builder = getEgressLinksReply.newBuilder();
+            linkService.getEgressLinks(connectPoint).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getIngressLinks(getIngressLinksRequest request,
+                                    StreamObserver<getIngressLinksReply> responseObserver) {
+            ConnectPoint connectPoint = ConnectPointProtoTranslator.translate(request.getConnectPoint()).get();
+
+            getIngressLinksReply.Builder builder = getIngressLinksReply.newBuilder();
+            linkService.getIngressLinks(connectPoint).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+
+        @Override
+        public void getLinks(getLinksRequest request,
+                             StreamObserver<getLinksReply> responseObserver) {
+            ConnectPoint connectPoint = ConnectPointProtoTranslator.translate(request.getConnectPoint()).get();
+
+            getLinksReply.Builder builder = getLinksReply.newBuilder();
+            linkService.getLinks(connectPoint).forEach(l -> {
+                builder.addLink(LinkProtoTranslator.translate(l));
+            });
+            responseObserver.onNext(builder.build());
+            responseObserver.onCompleted();
+        }
+    }
+
+    public LinkServiceNBServerInternal getInnerClassInstance() {
+        if (innerClassInstance == null) {
+            innerClassInstance = new LinkServiceNBServerInternal();
+        }
+        return innerClassInstance;
+    }
+}
+
+
+
diff --git a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/package-info.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
similarity index 92%
rename from incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/package-info.java
rename to incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
index 0814b10..51cb983 100644
--- a/incubator/protobuf/services/nb/src/main/java/org/onosproject/grpc/nb/net/device/package-info.java
+++ b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
@@ -16,4 +16,4 @@
 /**
  * gRPC server implementations for northbound services.
  */
-package org.onosproject.grpc.nb.net.device;
+package org.onosproject.incubator.protobuf.services.nb;
diff --git a/incubator/protobuf/services/nb/src/main/proto/net/link/LinkServiceNb.proto b/incubator/protobuf/services/nb/src/main/proto/net/link/LinkServiceNb.proto
new file mode 100644
index 0000000..7a267b7
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/main/proto/net/link/LinkServiceNb.proto
@@ -0,0 +1,90 @@
+syntax="proto3";
+option java_package = "org.onosproject.grpc.nb.net.link";
+
+package nb.net.link;
+
+import "net/LinkProto.proto";
+import "net/ConnectPointProto.proto";
+
+message getLinkCountRequest {
+}
+
+message getLinkCountReply {
+    int32 link_count = 1;
+}
+
+message getActiveLinksRequest {
+}
+
+message getActiveLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getDeviceLinksRequest {
+    string device_id = 1;
+}
+
+message getDeviceLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getDeviceEgressLinksRequest {
+    string device_id = 1;
+}
+
+message getDeviceEgressLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getDeviceIngressLinksRequest {
+    string device_id = 1;
+}
+
+message getDeviceIngressLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getLinksRequest {
+    .net.ConnectPointProto connect_point = 1;
+}
+
+message getLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getEgressLinksRequest {
+    .net.ConnectPointProto connect_point = 1;
+}
+
+message getEgressLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getIngressLinksRequest {
+    .net.ConnectPointProto connect_point = 1;
+}
+
+message getIngressLinksReply {
+    repeated .net.LinkProto link = 1;
+}
+
+message getLinkRequest {
+    .net.ConnectPointProto src = 1;
+    .net.ConnectPointProto dst = 2;
+}
+
+message getLinkReply {
+    .net.LinkProto link = 1;
+}
+
+service LinkService {
+    rpc getLinkCount(getLinkCountRequest) returns(getLinkCountReply) {}
+    rpc getLinks(getLinksRequest) returns(getLinksReply) {}
+    rpc getActiveLinks(getActiveLinksRequest) returns(getActiveLinksReply) {}
+    rpc getDeviceLinks(getDeviceLinksRequest) returns(getDeviceLinksReply) {}
+    rpc getDeviceEgressLinks(getDeviceEgressLinksRequest) returns(getDeviceEgressLinksReply) {}
+    rpc getDeviceIngressLinks(getDeviceIngressLinksRequest) returns(getDeviceIngressLinksReply) {}
+    rpc getEgressLinks(getEgressLinksRequest) returns(getEgressLinksReply) {}
+    rpc getIngressLinks(getIngressLinksRequest) returns(getIngressLinksReply) {}
+    rpc getLink(getLinkRequest) returns(getLinkReply) {}
+}
diff --git a/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkServiceTest.java b/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkServiceTest.java
new file mode 100644
index 0000000..d734e50
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/GrpcNbLinkServiceTest.java
@@ -0,0 +1,452 @@
+/*
+* Copyright 2017-present Open Networking Foundation
+*
+* 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.incubator.protobuf.services.nb;
+
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableList;
+import org.onosproject.grpc.net.models.LinkProtoOuterClass;
+
+import static org.junit.Assert.assertTrue;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.net.PortNumber.portNumber;
+
+import io.grpc.ManagedChannel;
+import io.grpc.inprocess.InProcessChannelBuilder;
+import org.onosproject.incubator.protobuf.models.net.ConnectPointProtoTranslator;
+import org.onosproject.incubator.protobuf.models.net.LinkProtoTranslator;
+import org.onosproject.net.ConnectPoint;
+
+import org.onosproject.net.DefaultLink;
+import org.onosproject.net.DeviceId;
+
+import org.onosproject.net.Link;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.link.LinkService;
+import org.onosproject.net.provider.ProviderId;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import org.onosproject.grpc.nb.net.link.LinkServiceGrpc;
+import org.onosproject.grpc.nb.net.link.LinkServiceGrpc.LinkServiceBlockingStub;
+import org.onosproject.grpc.nb.net.link.LinkServiceNb;
+import org.onosproject.incubator.protobuf.services.nb.GrpcNbLinkService.LinkServiceNBServerInternal;
+
+public class GrpcNbLinkServiceTest {
+    private static InProcessServer<LinkServiceNBServerInternal> inprocessServer;
+    private static ManagedChannel channel;
+    private static LinkServiceBlockingStub blockingStub;
+
+    private static final String D1 = "d1";
+    private static final String D2 = "d2";
+    private static final String D3 = "d3";
+    private static final String D4 = "d4";
+    private static final String D5 = "d5";
+    private static final String D6 = "d6";
+    private static final String D7 = "d7";
+    private static final String D8 = "d8";
+    private static final String D9 = "d9";
+
+    private static final String[][] LINK_CONNECT_DATA = {
+            {D1, "12", D2, "21"},
+            {D2, "23", D3, "32"},
+            {D4, "41", D1, "14"},
+            {D5, "51", D1, "15"},
+            {D6, "61", D1, "16"},
+            {D7, "73", D3, "37"},
+            {D8, "83", D3, "38"},
+            {D9, "93", D3, "39"},
+    };
+
+    private static final DeviceId DEVID_1 = deviceId(D1);
+    private static final PortNumber PORT_14 = portNumber("14");
+
+    private static final DeviceId DEVID_4 = deviceId(D4);
+    private static final PortNumber PORT_41 = portNumber("41");
+
+    private static final DeviceId DEVID_3 = deviceId(D3);
+    private static final PortNumber PORT_32 = portNumber("32");
+
+    private static final ConnectPoint DEVID_1_14 = new ConnectPoint(DEVID_1, PORT_14);
+    private static final ConnectPoint DEVID_4_41 = new ConnectPoint(DEVID_4, PORT_41);
+
+    private static final ProviderId PID = new ProviderId("Test", "Test");
+
+    private static List<Link> allLinks = new ArrayList<Link>();
+
+    private static final LinkService MOCK_LINK = new MockLinkService();
+
+    /**
+     * Creates a list of links.
+     *
+     */
+    private static void populateLinks() {
+        for (String[] linkPair : LINK_CONNECT_DATA) {
+            allLinks.addAll(makeLinkPair(linkPair));
+        }
+    }
+
+    /**
+     * Synthesizes a pair of unidirectional links between two devices. The
+     * string array should be of the form:
+     * <pre>
+     *     { "device-A-id", "device-A-port", "device-B-id", "device-B-port" }
+     * </pre>
+     *
+     * @param linkPairData device ids and ports
+     * @return pair of synthesized links
+     */
+    private static List<Link> makeLinkPair(String[] linkPairData) {
+        DeviceId devA = deviceId(linkPairData[0]);
+        PortNumber portA = portNumber(linkPairData[1]);
+
+        DeviceId devB = deviceId(linkPairData[2]);
+        PortNumber portB = portNumber(linkPairData[3]);
+
+        Link linkA = DefaultLink.builder()
+                .providerId(PID)
+                .type(Link.Type.DIRECT)
+                .src(new ConnectPoint(devA, portA))
+                .dst(new ConnectPoint(devB, portB))
+                .build();
+
+        Link linkB = DefaultLink.builder()
+                .providerId(PID)
+                .type(Link.Type.DIRECT)
+                .src(new ConnectPoint(devB, portB))
+                .dst(new ConnectPoint(devA, portA))
+                .build();
+
+        return ImmutableList.of(linkA, linkB);
+    }
+
+    public GrpcNbLinkServiceTest() {
+    }
+
+    @Test
+    public void testGetLinkCount() throws InterruptedException {
+        LinkServiceNb.getLinkCountRequest request = LinkServiceNb.getLinkCountRequest.getDefaultInstance();
+        LinkServiceNb.getLinkCountReply response;
+
+        try {
+            response = blockingStub.getLinkCount(request);
+            int linkCount = response.getLinkCount();
+            assertTrue(allLinks.size() == linkCount);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetLink() throws InterruptedException {
+        LinkServiceNb.getLinkRequest request = LinkServiceNb.getLinkRequest.newBuilder()
+                .setSrc(ConnectPointProtoTranslator.translate(DEVID_1_14))
+                .setDst(ConnectPointProtoTranslator.translate(DEVID_4_41))
+                .build();
+        LinkServiceNb.getLinkReply response;
+
+        try {
+            response = blockingStub.getLink(request);
+            LinkProtoOuterClass.LinkProto link = response.getLink();
+            assertTrue(LinkProtoTranslator.translate(allLinks.get(5)).equals(link));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetLinks() throws InterruptedException {
+        LinkServiceNb.getLinksRequest request = LinkServiceNb.getLinksRequest.newBuilder()
+                .setConnectPoint(ConnectPointProtoTranslator.translate(DEVID_1_14))
+                .build();
+        LinkServiceNb.getLinksReply response;
+
+        try {
+            response = blockingStub.getLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(4));
+            expectedLinks.add(allLinks.get(5));
+
+            assertTrue(expectedLinks.equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetActiveLinks() throws InterruptedException {
+        LinkServiceNb.getActiveLinksRequest request = LinkServiceNb.getActiveLinksRequest.getDefaultInstance();
+        LinkServiceNb.getActiveLinksReply response;
+
+        try {
+            response = blockingStub.getActiveLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+
+            Set<Link> expectedLinks = new HashSet<Link>(allLinks);
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetDeviceLinks() throws InterruptedException {
+        LinkServiceNb.getDeviceLinksRequest request = LinkServiceNb.getDeviceLinksRequest.newBuilder()
+                .setDeviceId(D1)
+                .build();
+        LinkServiceNb.getDeviceLinksReply response;
+
+        try {
+            response = blockingStub.getDeviceLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(4));
+            expectedLinks.add(allLinks.get(5));
+            expectedLinks.add(allLinks.get(6));
+            expectedLinks.add(allLinks.get(7));
+            expectedLinks.add(allLinks.get(8));
+            expectedLinks.add(allLinks.get(9));
+            expectedLinks.add(allLinks.get(0));
+            expectedLinks.add(allLinks.get(1));
+
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetDeviceEgressLinks() throws InterruptedException {
+        LinkServiceNb.getDeviceEgressLinksRequest request = LinkServiceNb.getDeviceEgressLinksRequest.newBuilder()
+                .setDeviceId(D1)
+                .build();
+        LinkServiceNb.getDeviceEgressLinksReply response;
+
+        try {
+            response = blockingStub.getDeviceEgressLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(0));
+            expectedLinks.add(allLinks.get(5));
+            expectedLinks.add(allLinks.get(7));
+            expectedLinks.add(allLinks.get(9));
+
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetDeviceIngressLinks() throws InterruptedException {
+        LinkServiceNb.getDeviceIngressLinksRequest request = LinkServiceNb.getDeviceIngressLinksRequest.newBuilder()
+                .setDeviceId(D1)
+                .build();
+        LinkServiceNb.getDeviceIngressLinksReply response;
+
+        try {
+            response = blockingStub.getDeviceIngressLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(1));
+            expectedLinks.add(allLinks.get(4));
+            expectedLinks.add(allLinks.get(6));
+            expectedLinks.add(allLinks.get(8));
+
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetEgressLinks() throws InterruptedException {
+        LinkServiceNb.getEgressLinksRequest request = LinkServiceNb.getEgressLinksRequest.newBuilder()
+                .setConnectPoint(ConnectPointProtoTranslator.translate(DEVID_1_14))
+                .build();
+        LinkServiceNb.getEgressLinksReply response;
+
+        try {
+            response = blockingStub.getEgressLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(5));
+
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testGetIngressLinks() throws InterruptedException {
+        LinkServiceNb.getIngressLinksRequest request = LinkServiceNb.getIngressLinksRequest.newBuilder()
+                .setConnectPoint(ConnectPointProtoTranslator.translate(DEVID_1_14))
+                .build();
+        LinkServiceNb.getIngressLinksReply response;
+
+        try {
+            response = blockingStub.getIngressLinks(request);
+
+            Set<Link> actualLinks = new HashSet<Link>();
+            for (LinkProtoOuterClass.LinkProto link : response.getLinkList()) {
+                actualLinks.add(LinkProtoTranslator.translate(link));
+            }
+            Set<Link> expectedLinks = new HashSet<Link>();
+            expectedLinks.add(allLinks.get(4));
+
+            assertTrue((expectedLinks).equals(actualLinks));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @BeforeClass
+    public static void beforeClass() throws InstantiationException, IllegalAccessException, IOException {
+        inprocessServer = new InProcessServer<LinkServiceNBServerInternal>(LinkServiceNBServerInternal.class);
+
+        GrpcNbLinkService outer = new GrpcNbLinkService();
+        GrpcNbLinkService.LinkServiceNBServerInternal inner = outer.getInnerClassInstance();
+        outer.linkService = MOCK_LINK;
+        inprocessServer.addServiceToBind(inner);
+
+        inprocessServer.start();
+        channel = InProcessChannelBuilder.forName("test").directExecutor()
+                // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid
+                // needing certificates.
+                .usePlaintext(true).build();
+        blockingStub = LinkServiceGrpc.newBlockingStub(channel);
+
+        populateLinks();
+    }
+
+    @AfterClass
+    public static void afterClass() {
+        channel.shutdownNow();
+
+        inprocessServer.stop();
+    }
+
+    private static class MockLinkService implements LinkService {
+        MockLinkService() {
+        }
+
+        @Override
+        public int getLinkCount() {
+            return allLinks.size();
+        }
+
+        @Override
+        public Iterable<Link> getLinks() {
+            return ImmutableSet.copyOf(allLinks);
+        }
+
+        @Override
+        public Iterable<Link> getActiveLinks() {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> input.state() == Link.State.ACTIVE);
+        }
+
+        @Override
+        public Set<Link> getDeviceLinks(DeviceId deviceId) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.src().deviceId().equals(deviceId)) ||
+                            (input.dst().deviceId().equals(deviceId))).toSet();
+        }
+
+        @Override
+        public Set<Link> getDeviceEgressLinks(DeviceId deviceId) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.src().deviceId().equals(deviceId))).toSet();
+        }
+
+        @Override
+        public Set<Link> getDeviceIngressLinks(DeviceId deviceId) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.dst().deviceId().equals(deviceId))).toSet();
+        }
+
+        @Override
+        public Set<Link> getLinks(ConnectPoint connectPoint) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.src().equals(connectPoint)) || (input.dst().equals(connectPoint))).toSet();
+        }
+
+        @Override
+        public Set<Link> getEgressLinks(ConnectPoint connectPoint) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.src().equals(connectPoint))).toSet();
+        }
+
+        @Override
+        public Set<Link> getIngressLinks(ConnectPoint connectPoint) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.dst().equals(connectPoint))).toSet();
+        }
+
+        @Override
+        public Link getLink(ConnectPoint src, ConnectPoint dst) {
+            return FluentIterable.from(getLinks())
+                    .filter(input -> (input.src().equals(src)) && (input.dst().equals(dst)))
+                    .first().get();
+        }
+
+        @Override
+        public void addListener(org.onosproject.net.link.LinkListener listener) {
+        }
+
+        @Override
+        public void removeListener(org.onosproject.net.link.LinkListener listener) {
+        }
+    }
+}
\ No newline at end of file
diff --git a/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/InProcessServer.java b/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/InProcessServer.java
new file mode 100644
index 0000000..6caa9d9
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/test/java/org/onosproject/incubator/protobuf/services/nb/InProcessServer.java
@@ -0,0 +1,78 @@
+/*
+* Copyright 2017-present Open Networking Foundation
+*
+* 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.incubator.protobuf.services.nb;
+
+import com.google.common.collect.Sets;
+import io.grpc.Server;
+import io.grpc.inprocess.InProcessServerBuilder;
+import io.grpc.internal.AbstractServerImplBuilder;
+
+import java.io.IOException;
+import java.util.Set;
+/**
+ * InProcessServer that manages startup/shutdown of a service within the same process
+ * as the client is running. Used for unit testing purposes.
+ */
+public class InProcessServer<T extends io.grpc.BindableService> {
+    private Server server;
+
+    Set<T> services = Sets.newHashSet();
+
+    private Class<T> clazz;
+
+    public InProcessServer(Class<T> clazz) {
+        this.clazz = clazz;
+    }
+
+    public void addServiceToBind(T service) {
+        if (service != null) {
+            services.add(service);
+        }
+    }
+
+    public void start() throws IOException, InstantiationException, IllegalAccessException {
+
+        AbstractServerImplBuilder builder = InProcessServerBuilder.forName("test").directExecutor();
+        services.forEach(service -> builder.addService(service));
+        server = builder.build().start();
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            @Override
+            public void run() {
+                // Use stderr here since the logger may have been reset by its JVM shutdown hook.
+                System.err.println("*** shutting down gRPC server since JVM is shutting down");
+                InProcessServer.this.stop();
+                System.err.println("*** server shut down");
+            }
+        });
+    }
+
+    void stop() {
+        if (server != null) {
+            server.shutdown();
+        }
+    }
+
+    /**
+     * Await termination on the main thread since the grpc library uses daemon threads.
+     * @throws InterruptedException if there is an issue
+     */
+    public void blockUntilShutdown() throws InterruptedException {
+        if (server != null) {
+            server.awaitTermination();
+        }
+    }
+}
\ No newline at end of file
