diff --git a/incubator/grpc/features.xml b/incubator/grpc/features.xml
new file mode 100644
index 0000000000..7f5d98cfba
--- /dev/null
+++ b/incubator/grpc/features.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ grpc
+
+ mvn:com.google.protobuf/protobuf-java/3.0.0
+ mvn:${project.groupId}/${project.artifactId}/${project.version}
+
+
+
+ mvn:io.netty/netty-common/${grpc.netty.version}
+ mvn:io.netty/netty-buffer/${grpc.netty.version}
+ mvn:io.netty/netty-transport/${grpc.netty.version}
+ mvn:io.netty/netty-handler/${grpc.netty.version}
+ mvn:io.netty/netty-codec/${grpc.netty.version}
+ mvn:io.netty/netty-codec-http/${grpc.netty.version}
+ mvn:io.netty/netty-codec-http2/${grpc.netty.version}
+ mvn:io.netty/netty-resolver/${grpc.netty.version}
+
+
+
+ grpc-netty
+ wrap:mvn:com.google.auth/google-auth-library-credentials/${google.auth.version}$Bundle-SymbolicName=com.google.auth.google-auth-library-credentials&Bundle-Version=${google.auth.version}
+ wrap:mvn:com.google.auth/google-auth-library-oauth2-http/${google.auth.version}$Bundle-SymbolicName=com.google.auth.google-auth-library-oauth2-http&Bundle-Version=${google.auth.version}
+
+ wrap:mvn:io.grpc/grpc-core/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-core&Bundle-Version=${grpc.package.version}&Export-Package=*;version=${grpc.package.version},io.grpc.internal;version=${grpc.package.version}&
+ wrap:mvn:io.grpc/grpc-protobuf-lite/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-protobuf-lite&Bundle-Version=${grpc.package.version}&
+ wrap:mvn:io.grpc/grpc-protobuf/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-protobuf&Bundle-Version=${grpc.package.version}&
+ wrap:mvn:io.grpc/grpc-stub/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-stub&Bundle-Version=${grpc.package.version}&
+ wrap:mvn:io.grpc/grpc-netty/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-netty&Bundle-Version=${grpc.package.version}&Import-Package=io.netty.*;version=${grpc.netty.package.version},*
+ wrap:mvn:io.grpc/grpc-auth/${grpc.version}$Bundle-SymbolicName=io.grpc.grpc-auth&Bundle-Version=${grpc.package.version}&Import-Package=javax.net.ssl,*
+
+
+
diff --git a/incubator/grpc/pom.xml b/incubator/grpc/pom.xml
new file mode 100644
index 0000000000..7b6fed0b5a
--- /dev/null
+++ b/incubator/grpc/pom.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+ onos-incubator
+ org.onosproject
+ 1.7.0-SNAPSHOT
+
+ 4.0.0
+
+ onos-incubator-grpc
+ bundle
+
+
+ org.onosproject.incubator.grpc
+ gRPC dependency package
+ 3.0.0
+ 1.0.0-pre2
+ 1.0.0
+ 4.1.3.Final
+ 4.1.3
+ 0.4.0
+
+
+
+
+
+
+ io.grpc
+ grpc-core
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-protobuf
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-stub
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-netty
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-auth
+ ${grpc.version}
+
+
+
+ io.netty
+ netty-codec
+ ${grpc.netty.version}
+
+
+ io.netty
+ netty-transport
+ ${grpc.netty.version}
+
+
+ io.netty
+ netty-handler
+ ${grpc.netty.version}
+
+
+ io.netty
+ netty-buffer
+ ${grpc.netty.version}
+
+
+ io.netty
+ netty-common
+ ${grpc.netty.version}
+
+
+
+
+
+
+ io.grpc
+ grpc-core
+
+
+ io.grpc
+ grpc-protobuf
+
+
+ io.grpc
+ grpc-stub
+
+
+ io.grpc
+ grpc-netty
+
+
+ io.grpc
+ grpc-auth
+
+
+
+
+
+
+ org.onosproject
+ onos-maven-plugin
+
+
+
+
+
+
diff --git a/incubator/pom.xml b/incubator/pom.xml
index a8c7f9d839..5dbd8b4331 100644
--- a/incubator/pom.xml
+++ b/incubator/pom.xml
@@ -38,6 +38,9 @@
protobuf
rpc
rpc-grpc
+ rpc-nb
+ protobuf-nb
+ grpc
diff --git a/incubator/protobuf-nb/pom.xml b/incubator/protobuf-nb/pom.xml
new file mode 100644
index 0000000000..7919a43ab2
--- /dev/null
+++ b/incubator/protobuf-nb/pom.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+ onos-incubator
+ org.onosproject
+ 1.7.0-SNAPSHOT
+
+ 4.0.0
+
+ onos-incubator-protobuf-nb
+ bundle
+
+
+ 3.0.0
+ 1.0.0-pre2
+
+
+
+
+ io.grpc
+ grpc-core
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-protobuf
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-stub
+ ${grpc.version}
+
+
+
+
+
+
+ kr.motd.maven
+ os-maven-plugin
+ 1.4.1.Final
+
+
+
+
+
+
+ org.apache.karaf.tooling
+ karaf-maven-plugin
+ 3.0.5
+ true
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ ${basedir}/src/main/java/
+ org.onosproject.grpc.net.mcast
+
+
+
+
+ org.xolstice.maven.plugins
+ protobuf-maven-plugin
+ 0.5.0
+
+
+ com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
+ grpc-java
+ io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
+
+
+
+
+ compile
+ compile-custom
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 1.11
+
+
+ add-source
+ generate-sources
+
+ add-source
+
+
+
+ ${project.build.directory}/generated-sources/protobuf/java
+ ${project.build.directory}/generated-sources/protobuf/grpc-java
+
+
+
+
+
+
+
+
+
diff --git a/incubator/protobuf-nb/src/main/proto/MulticastRouteService.proto b/incubator/protobuf-nb/src/main/proto/MulticastRouteService.proto
new file mode 100644
index 0000000000..f74048abac
--- /dev/null
+++ b/incubator/protobuf-nb/src/main/proto/MulticastRouteService.proto
@@ -0,0 +1,51 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.mcast";
+
+package Multicast;
+
+// TODO move model objects to common protobuf package
+
+message ConnectPoint {
+ string deviceId = 1;
+ uint64 portNumber = 2;
+}
+
+enum MulticastRouteType {
+ PIM = 0;
+ IGMP = 1;
+ STATIC = 2;
+}
+
+enum MulticastOperationResult {
+ SUCCESS = 0;
+ FAIL = 1;
+}
+
+enum MulticastOperation {
+ ADD_ROUTE = 0;
+ ADD_SOURCE = 1;
+ ADD_SINK = 2;
+ REMOVE_ROUTE = 3;
+ REMOVE_SOURCE = 4;
+ REMOVE_SINK = 5;
+}
+
+message MulticastRoute {
+ fixed32 source = 1; // TODO assumes ipv4
+ fixed32 group = 2;
+ MulticastRouteType type = 3;
+}
+
+message MulticastReply {
+ MulticastOperationResult result = 1;
+}
+
+message MulticastRequest {
+ MulticastOperation operation = 1;
+ MulticastRoute route = 2;
+ ConnectPoint connectPoint = 3;
+}
+
+service MulticastRouteService {
+ rpc operation(stream MulticastRequest) returns (stream MulticastReply) {}
+}
diff --git a/incubator/rpc-nb/features.xml b/incubator/rpc-nb/features.xml
new file mode 100644
index 0000000000..e9d7073f61
--- /dev/null
+++ b/incubator/rpc-nb/features.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ onos-api
+ onos-incubator-grpc
+
+ mvn:${project.groupId}/onos-incubator-protobuf-nb/${project.version}
+ mvn:${project.groupId}/${project.artifactId}/${project.version}
+
+
diff --git a/incubator/rpc-nb/pom.xml b/incubator/rpc-nb/pom.xml
new file mode 100644
index 0000000000..e60a47f609
--- /dev/null
+++ b/incubator/rpc-nb/pom.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+ onos-incubator
+ org.onosproject
+ 1.7.0-SNAPSHOT
+
+ 4.0.0
+
+ onos-incubator-rpc-nb
+ bundle
+
+ ONOS northbound RPC based on gRPC
+ http://onosproject.org
+
+
+ org.onosproject.incubator.rpc-nb
+ ONOS gRPC Northbound API
+ org.onosproject.incubator.grpc
+ 1.0.0-pre2
+
+
+
+
+ org.onosproject
+ onos-api
+
+
+
+ org.onosproject
+ onos-incubator-api
+
+
+
+ org.onosproject
+ onlab-osgi
+
+
+
+ io.grpc
+ grpc-core
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-protobuf
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-stub
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-netty
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-auth
+ ${grpc.version}
+
+
+
+ org.onosproject
+ onos-incubator-protobuf-nb
+ ${project.version}
+
+
+
+ org.apache.felix
+ org.apache.felix.scr.annotations
+ provided
+
+
+
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+ generate-scr-srcdescriptor
+
+ scr
+
+
+
+
+
+ true
+
+ bundle
+ war
+
+
+
+
+
+
+
diff --git a/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/GrpcServer.java b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/GrpcServer.java
new file mode 100644
index 0000000000..abd4c4a296
--- /dev/null
+++ b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/GrpcServer.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2016-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.incubator.rpc.nb.impl;
+
+import io.grpc.Server;
+import io.grpc.netty.NettyServerBuilder;
+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.incubator.rpc.nb.mcast.MulticastRouteGrpcService;
+import org.onosproject.net.mcast.MulticastRouteService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * gRPC server for northbound APIs.
+ */
+@Component(immediate = true)
+public class GrpcServer {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected MulticastRouteService multicastRouteService;
+
+ // TODO make configurable
+ private int port = 50051;
+
+ private Server server;
+
+ @Activate
+ public void activate() {
+ start();
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ stop();
+ log.info("Stopped");
+ }
+
+ private void start() {
+ try {
+ server = NettyServerBuilder.forPort(port)
+ .addService(new MulticastRouteGrpcService(multicastRouteService))
+ .build()
+ .start();
+ log.info("gRPC server started listening on " + port);
+ } catch (IOException e) {
+ log.error("Failed to start gRPC server", e);
+ }
+ }
+
+ private void stop() {
+ if (server != null) {
+ server.shutdown();
+ }
+ }
+}
diff --git a/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/package-info.java b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/package-info.java
new file mode 100644
index 0000000000..4aadc111e9
--- /dev/null
+++ b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-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.
+ */
+
+/**
+ * Northbound gPRC implementation.
+ */
+package org.onosproject.incubator.rpc.nb.impl;
diff --git a/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/MulticastRouteGrpcService.java b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/MulticastRouteGrpcService.java
new file mode 100644
index 0000000000..c6347f51f5
--- /dev/null
+++ b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/MulticastRouteGrpcService.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-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.incubator.rpc.nb.mcast;
+
+import io.grpc.stub.StreamObserver;
+import org.onlab.packet.IpAddress;
+import org.onosproject.grpc.net.mcast.MulticastRouteServiceGrpc;
+import org.onosproject.grpc.net.mcast.MulticastRouteServiceOuterClass;
+import org.onosproject.net.mcast.McastRoute;
+import org.onosproject.net.mcast.MulticastRouteService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Implementation of multicast gRPC service.
+ */
+@Beta
+public class MulticastRouteGrpcService
+ extends MulticastRouteServiceGrpc.MulticastRouteServiceImplBase {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private final MulticastRouteService multicastRouteService;
+
+ public MulticastRouteGrpcService(MulticastRouteService service) {
+ this.multicastRouteService = service;
+ }
+
+ @Override
+ public StreamObserver
+ operation(StreamObserver responseObserver) {
+
+ return new MulticastServiceServerProxy(responseObserver);
+ }
+
+ private final class MulticastServiceServerProxy
+ implements StreamObserver {
+
+ private final StreamObserver responseObserver;
+
+ public MulticastServiceServerProxy(
+ StreamObserver responseObserver) {
+ this.responseObserver = responseObserver;
+ }
+
+ @Override
+ public void onNext(MulticastRouteServiceOuterClass.MulticastRequest value) {
+ MulticastRouteServiceOuterClass.MulticastRoute route = value.getRoute();
+
+ switch (value.getOperation()) {
+ case ADD_ROUTE:
+ multicastRouteService.add(
+ new McastRoute(IpAddress.valueOf(route.getSource()),
+ IpAddress.valueOf(route.getGroup()),
+ McastRoute.Type.STATIC));
+ break;
+ case ADD_SOURCE:
+ break;
+ case ADD_SINK:
+ break;
+ case REMOVE_ROUTE:
+ break;
+ case REMOVE_SOURCE:
+ break;
+ case REMOVE_SINK:
+ break;
+ case UNRECOGNIZED:
+ default:
+ break;
+ }
+
+ responseObserver.onNext(MulticastRouteServiceOuterClass.MulticastReply.newBuilder().build());
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ log.warn("Error receiving multicast route", t);
+ }
+
+ @Override
+ public void onCompleted() {
+ // When the client closes their stream, we'll close ours too
+ responseObserver.onCompleted();
+ }
+ }
+}
diff --git a/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/package-info.java b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/package-info.java
new file mode 100644
index 0000000000..9b42471846
--- /dev/null
+++ b/incubator/rpc-nb/src/main/java/org/onosproject/incubator/rpc/nb/mcast/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-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.
+ */
+
+/**
+ * Multicast gRPC implementation.
+ */
+package org.onosproject.incubator.rpc.nb.mcast;