diff --git a/features/odl-telemetry-all/pom.xml b/features/odl-telemetry-all/pom.xml
old mode 100644
new mode 100755
index 5b731fa..f44d5df
--- a/features/odl-telemetry-all/pom.xml
+++ b/features/odl-telemetry-all/pom.xml
@@ -21,7 +21,7 @@
org.opendaylight.telemetry
- odl-telemetry-grpcserver
+ odl-telemetry-grpc
${project.version}
xml
features
diff --git a/features/odl-telemetry-grpcserver/pom.xml b/features/odl-telemetry-grpc/pom.xml
old mode 100644
new mode 100755
similarity index 89%
rename from features/odl-telemetry-grpcserver/pom.xml
rename to features/odl-telemetry-grpc/pom.xml
index 7ca37ad..383cd0b
--- a/features/odl-telemetry-grpcserver/pom.xml
+++ b/features/odl-telemetry-grpc/pom.xml
@@ -12,7 +12,7 @@
org.opendaylight.telemetry
- odl-telemetry-grpcserver
+ odl-telemetry-grpc
0.1.0-SNAPSHOT
feature
@@ -32,12 +32,12 @@
${project.groupId}
- grpcserver-api
+ grpc-api
${project.version}
${project.groupId}
- grpcserver-impl
+ grpc-impl
${project.version}
diff --git a/grpcserver/api/pom.xml b/grpc/api/pom.xml
old mode 100644
new mode 100755
similarity index 88%
rename from grpcserver/api/pom.xml
rename to grpc/api/pom.xml
index 17f82df..4176902
--- a/grpcserver/api/pom.xml
+++ b/grpc/api/pom.xml
@@ -18,13 +18,20 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
org.opendaylight.telemetry
- grpcserver-api
+ grpc-api
0.1.0-SNAPSHOT
ODL :: telemetry :: ${project.artifactId}
bundle
+
+
+ org.opendaylight.mdsal.model
+ ietf-inet-types-2013-07-15
+
+
+
diff --git a/grpc/api/src/main/yang/grpc.yang b/grpc/api/src/main/yang/grpc.yang
new file mode 100644
index 0000000..86d8b03
--- /dev/null
+++ b/grpc/api/src/main/yang/grpc.yang
@@ -0,0 +1,22 @@
+module grpc {
+ yang-version 1.1;
+ namespace "urn:opendaylight:params:xml:ns:yang:grpc";
+ prefix "grpc";
+
+ revision "2017-08-30" {
+ description "Initial revision of grpc model";
+ }
+
+ import ietf-inet-types {
+ prefix "inet";
+ revision-date 2013-07-15;
+ }
+
+ rpc start-grpc-server {
+ input {
+ leaf port {
+ type inet:port-number;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/grpcserver/impl/pom.xml b/grpc/impl/pom.xml
old mode 100644
new mode 100755
similarity index 54%
rename from grpcserver/impl/pom.xml
rename to grpc/impl/pom.xml
index a6652c5..e9c3dc0
--- a/grpcserver/impl/pom.xml
+++ b/grpc/impl/pom.xml
@@ -19,7 +19,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
org.opendaylight.telemetry
- grpcserver-impl
+ grpc-impl
0.1.0-SNAPSHOT
@@ -27,183 +27,100 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
bundle
- 3.2.0
- 3.2.0
- 1.3.0
- 4.1.8.Final
- 2.7
- 2.0.19
- 0.3.0
- 0.1.6
- ${project.build.directory}/generated-source/protobuf
+ 3.5.1
+ 1.8.0
+ 0.0.3
+ ${project.build.directory}/generated-source/protobuf
-
-
- org.opendaylight.controller
- mdsal-artifacts
- 1.7.0-SNAPSHOT
- pom
- import
-
-
+
+
+ org.opendaylight.controller
+ mdsal-artifacts
+ 1.7.0-SNAPSHOT
+ pom
+ import
+
+
+ com.google.protobuf
+ protobuf-java
+ ${protobuf.version}
+
+
+ com.google.protobuf
+ protobuf-java-util
+ ${protobuf.version}
+
+
+ io.grpc
+ grpc-all
+ ${grpc.version}
+
+
+ com.google.api.grpc
+ googleapis-common-protos
+ ${common.protos.version}
+
+
+ io.grpc
+ grpc-core
+ ${grpc.version}
+
+
${project.groupId}
- grpcserver-api
+ grpc-api
${project.version}
-
org.opendaylight.controller
sal-binding-api
-
com.google.protobuf
protobuf-java
- ${protobuf.java.version}
true
com.google.protobuf
protobuf-java-util
- ${protobuf.java.util.version}
true
- io.grpc
- grpc-netty
- ${grpc.version}
- true
-
-
- io.grpc
- grpc-protobuf
- ${grpc.version}
- true
-
-
- io.grpc
- grpc-protobuf-lite
- ${grpc.version}
- true
-
-
- io.grpc
- grpc-stub
- ${grpc.version}
- true
-
-
- io.grpc
- grpc-core
- ${grpc.version}
- true
-
-
- io.grpc
- grpc-context
- ${grpc.version}
- true
-
-
-
- io.netty
- netty-codec
- ${netty.version}
- true
-
-
- io.netty
- netty-transport
- ${netty.version}
- true
-
-
- io.netty
- netty-resolver
- ${netty.version}
- true
-
-
- io.netty
- netty-handler
- ${netty.version}
- true
-
-
- io.netty
- netty-buffer
- ${netty.version}
- true
-
-
- io.netty
- netty-common
- ${netty.version}
- true
-
-
- io.netty
- netty-codec-http
- ${netty.version}
-
-
- io.netty
- netty-codec-http2
- ${netty.version}
- true
-
-
- io.netty
- netty-handler-proxy
- ${netty.version}
- true
-
-
- io.netty
- netty-codec-socks
- ${netty.version}
- true
-
-
- com.google.code.gson
- gson
- ${gson.version}
- true
-
-
-
- com.google.errorprone
- error_prone_annotations
- ${errorprone.version}
- true
-
-
-
- com.google.instrumentation
- instrumentation-api
- ${instrumentation.version}
- true
+ io.grpc
+ grpc-all
+ true
+
+
+ io.grpc
+ grpc-core
+
+
+
+
+ io.grpc
+ grpc-core
+
+
+ com.google.code.findbugs
+ jsr305
+
+
+
+
+ com.google.api.grpc
+ googleapis-common-protos
+ true
-
-
- com.google.api.grpc
- grpc-google-common-protos
- ${google.protos.version}
-
-
- io.grpc
- grpc-all
-
-
- true
-
-
+
+ com.lmax
+ disruptor
+ 3.3.7
+
junit
@@ -250,9 +167,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
protobuf-maven-plugin
0.5.0
- com.google.protobuf:protoc:3.2.0:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}
grpc-java
- io.grpc:protoc-gen-grpc-java:1.3.0:exe:${os.detected.classifier}
+ io.grpc:protoc-gen-grpc-java:1.8.0:exe:${os.detected.classifier}
src/main/proto
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/StreamDataHandler.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/StreamDataHandler.java
new file mode 100755
index 0000000..ddb2819
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/StreamDataHandler.java
@@ -0,0 +1,14 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+
+public interface StreamDataHandler {
+ void process(TelemetryStreamRequest data);
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEvent.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEvent.java
new file mode 100755
index 0000000..2b62a1d
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEvent.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+
+public class TelemetryEvent {
+ private TelemetryStreamRequest value;
+ public void setValue(TelemetryStreamRequest value) {
+ this.value = value;
+ }
+
+ public TelemetryStreamRequest getValue() {
+ return value;
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventConsumer.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventConsumer.java
new file mode 100755
index 0000000..3c9f1fa
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventConsumer.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+import com.lmax.disruptor.EventHandler;
+
+import java.util.Collection;
+
+public class TelemetryEventConsumer implements EventHandler {
+ private final String TELEMETRY_DATA = "TD";
+ private volatile Multimap map = ArrayListMultimap.create();
+
+ @Override
+ public void onEvent(TelemetryEvent event, long sequence, boolean endOfBatch) throws Exception {
+ Collection subscribers = map.get(TELEMETRY_DATA);
+ for(StreamDataHandler handler : subscribers) {
+ handler.process(event.getValue());
+ }
+ }
+
+ public void addSubscriber(StreamDataHandler handler) {
+ map.put(TELEMETRY_DATA, handler);
+ }
+
+ public void removeSubscriber(StreamDataHandler handler) {
+ map.get(TELEMETRY_DATA).remove(handler);
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventFactory.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventFactory.java
new file mode 100755
index 0000000..06ce651
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventFactory.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+import com.lmax.disruptor.EventFactory;
+
+public class TelemetryEventFactory implements EventFactory {
+ @Override
+ public TelemetryEvent newInstance() {
+ return new TelemetryEvent();
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventProducer.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventProducer.java
new file mode 100755
index 0000000..a72cd7d
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryEventProducer.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+import com.lmax.disruptor.RingBuffer;
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+
+public class TelemetryEventProducer {
+ private RingBuffer ringBuffer;
+
+ public TelemetryEventProducer(RingBuffer ringBuffer) {
+ this.ringBuffer = ringBuffer;
+ }
+
+ public void onData(TelemetryStreamRequest data) {
+ long sequence = ringBuffer.next();
+ try {
+ TelemetryEvent event = ringBuffer.get(sequence);
+ event.setValue(data);
+ }
+ finally {
+ ringBuffer.publish(sequence);
+ }
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotification.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotification.java
new file mode 100755
index 0000000..473ff38
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotification.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+
+public final class TelemetryNotification {
+ private static TelemetryNotificationImpl instance = TelemetryNotificationImpl.getInstance();
+
+ public static void subscribe(StreamDataHandler handler) {
+ instance.subscribe(handler);
+ }
+
+ public static void unsubscribe(StreamDataHandler handler) {
+ instance.unsubscribe(handler);
+ }
+
+ public static void publish(TelemetryStreamRequest data) {
+ if (data != null) {
+ instance.publish(data);
+ }
+ }
+
+ public static void shutdown() {
+ instance.shutdown();
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotificationImpl.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotificationImpl.java
new file mode 100755
index 0000000..c9eec56
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/notification/TelemetryNotificationImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.notification;
+
+import com.lmax.disruptor.RingBuffer;
+import com.lmax.disruptor.WaitStrategy;
+import com.lmax.disruptor.YieldingWaitStrategy;
+import com.lmax.disruptor.dsl.Disruptor;
+import com.lmax.disruptor.dsl.ProducerType;
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public class TelemetryNotificationImpl {
+ private static TelemetryNotificationImpl instance = new TelemetryNotificationImpl();
+ private Disruptor disruptor;
+ private TelemetryEventProducer producer;
+ private TelemetryEventConsumer consumer;
+ private ExecutorService executorService;
+ private TelemetryEventFactory factory;
+ private WaitStrategy waitStrategy;
+ private Integer BUFFER_SIZE = 2048;
+
+ private TelemetryNotificationImpl() {
+ init();
+ }
+
+ public static TelemetryNotificationImpl getInstance() {
+ return instance;
+ }
+
+ private void init() {
+ initConsumer();
+ initDisruptor();
+ initProducer();
+ }
+
+ private void initDisruptor() {
+ factory = new TelemetryEventFactory();
+ executorService = Executors.newCachedThreadPool();
+ waitStrategy = new YieldingWaitStrategy();
+ disruptor = new Disruptor<>(factory, BUFFER_SIZE, executorService, ProducerType.SINGLE, waitStrategy);
+ disruptor.handleEventsWith(consumer);
+ disruptor.start();
+ }
+
+ private void initProducer() {
+ RingBuffer ringBuffer = disruptor.getRingBuffer();
+ producer = new TelemetryEventProducer(ringBuffer);
+ }
+
+ private void initConsumer() {
+ consumer = new TelemetryEventConsumer();
+ }
+
+ public void publish(TelemetryStreamRequest data) {
+ producer.onData(data);
+ }
+
+ public void subscribe(StreamDataHandler handler) {
+ consumer.addSubscriber(handler);
+ }
+
+ public void unsubscribe(StreamDataHandler handler) {
+ consumer.removeSubscriber(handler);
+ }
+
+ public void shutdown() {
+ if (disruptor != null) {
+ disruptor.shutdown();
+ }
+
+ if (executorService != null) {
+ executorService.shutdown();
+ }
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/GrpcProvider.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/GrpcProvider.java
new file mode 100644
index 0000000..11403ae
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/GrpcProvider.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.server;
+
+import com.google.common.util.concurrent.SettableFuture;
+import io.grpc.Server;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.grpc.rev170830.GrpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.grpc.rev170830.StartGrpcServerInput;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GrpcProvider implements GrpcService {
+ private static final Logger LOG = LoggerFactory.getLogger(GrpcProvider.class);
+ private final DataBroker dataBroker;
+ private Server server;
+
+ public GrpcProvider(final DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ }
+
+ public void init() {
+ LOG.info("gRPC Provider Session Initiated");
+ }
+
+ public void close() {
+ LOG.info("GrpcServerProvider Closed");
+ }
+
+ private void stop() {
+ if (null != server) {
+ server.shutdown();
+ }
+ }
+
+ @Override
+ public Future> startGrpcServer(StartGrpcServerInput input) {
+ int port = input.getPort().getValue();
+ SettableFuture> future = SettableFuture.create();
+
+ new Thread(() -> {
+ try {
+ TelemetryServer server = new TelemetryServer(port);
+ server.start();
+ server.blockUntilShutdown();
+ } catch (Exception e) {
+ future.set(RpcResultBuilder
+ .failed()
+ .withError(RpcError.ErrorType.APPLICATION, "Start gRPC server failed.").build());
+ }
+ }).start();
+
+ return future;
+ }
+}
diff --git a/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/TelemetryServer.java b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/TelemetryServer.java
new file mode 100644
index 0000000..36208cb
--- /dev/null
+++ b/grpc/impl/src/main/java/org/opendaylight/telemetry/grpc/server/TelemetryServer.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.telemetry.grpc.server;
+
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+import io.grpc.stub.StreamObserver;
+import org.opendaylight.telemetry.grpc.notification.TelemetryNotification;
+import org.opendaylight.telemetry.grpc.proto.TelemetryGrpc;
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamRequest;
+import org.opendaylight.telemetry.grpc.proto.TelemetryStreamResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * gRPC server that serve the Telemetry service.
+ */
+public class TelemetryServer {
+ private static final Logger LOG = LoggerFactory.getLogger(TelemetryServer.class);
+ private int port;
+ private Server server;
+
+ /**
+ * Create a server listening on {@code port}.
+ * @param port listening port, e.g. 50051;
+ */
+ public TelemetryServer(int port) {
+ this.port = port;
+ server = ServerBuilder.forPort(port).addService(new TelemetryService()).build();
+ }
+
+ /**
+ * Start gRPC server.
+ * @throws IOException
+ */
+ public void start() throws IOException {
+ server.start();
+ LOG.info("Telemetry server started, listening on port " + port);
+ Runtime.getRuntime().addShutdownHook(new Thread(()->{
+ System.err.println("*** shutting down gRPC server since JVM is shutting down");
+ TelemetryServer.this.stop();
+ System.err.println("*** server shut down");
+ }));
+ }
+
+ /**
+ * Stop gRPC server.
+ */
+ public void stop() {
+ if (server != null) {
+ server.shutdown();
+ }
+ }
+
+ /**
+ * Await termination on the main thread since the gRPC server uses daemon threads.
+ * @throws InterruptedException
+ */
+ public void blockUntilShutdown() throws InterruptedException {
+ if (server != null) {
+ server.awaitTermination();
+ }
+ }
+
+ private static class TelemetryService extends TelemetryGrpc.TelemetryImplBase {
+ public StreamObserver report(StreamObserver responseObserver) {
+ return new StreamObserver() {
+ @Override
+ public void onNext(TelemetryStreamRequest telemetryStreamRequest) {
+ TelemetryNotification.publish(telemetryStreamRequest);
+ }
+
+ @Override
+ public void onError(Throwable throwable) {
+ LOG.info("report error");
+ }
+
+ @Override
+ public void onCompleted() {
+ responseObserver.onCompleted();
+ }
+ };
+ }
+ }
+}
diff --git a/grpc/impl/src/main/proto/telemetry.proto b/grpc/impl/src/main/proto/telemetry.proto
new file mode 100755
index 0000000..cba778d
--- /dev/null
+++ b/grpc/impl/src/main/proto/telemetry.proto
@@ -0,0 +1,27 @@
+syntax = "proto3";
+option java_multiple_files = true;
+option java_package = "org.opendaylight.telemetry.grpc.proto";
+option java_outer_classname = "TelemetryProto";
+
+package telemetry;
+
+service Telemetry {
+ rpc report(stream TelemetryStreamRequest) returns (TelemetryStreamResponse) {};
+}
+
+message KeyValue {
+ string key = 1;
+ oneof value {
+ uint64 int_value = 2;
+ string str_value = 3;
+ }
+}
+
+message TelemetryStreamRequest {
+ string system_id = 1;
+ uint64 timestamp = 2;
+ string key_prefix = 3;
+ repeated KeyValue kv = 4;
+}
+
+message TelemetryStreamResponse {}
diff --git a/grpcserver/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/grpc/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
similarity index 91%
rename from grpcserver/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
rename to grpc/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index fba295d..4a535e5 100644
--- a/grpcserver/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/grpc/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -16,7 +16,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
odl:type="default" />
diff --git a/grpcserver/pom.xml b/grpc/pom.xml
old mode 100644
new mode 100755
similarity index 90%
rename from grpcserver/pom.xml
rename to grpc/pom.xml
index 34d42f2..bfb126e
--- a/grpcserver/pom.xml
+++ b/grpc/pom.xml
@@ -16,18 +16,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
org.opendaylight.telemetry
- grpcserver-aggregator
+ grpc-aggregator
0.1.0-SNAPSHOT
ODL :: telemetry :: ${project.artifactId}
pom
-
- scm:git:ssh://git.opendaylight.org:29418/grpcserver.git
- scm:git:ssh://git.opendaylight.org:29418/grpcserver.git
- HEAD
- https://wiki.opendaylight.org/view/grpcserver:Main
-
-
api
impl
diff --git a/grpcserver/api/src/main/yang/grpcserver.yang b/grpcserver/api/src/main/yang/grpcserver.yang
deleted file mode 100644
index 04f13fd..0000000
--- a/grpcserver/api/src/main/yang/grpcserver.yang
+++ /dev/null
@@ -1,9 +0,0 @@
-module grpcserver {
- yang-version 1.1;
- namespace "urn:opendaylight:params:xml:ns:yang:grpcserver";
- prefix "grpcserver";
-
- revision "2017-08-30" { // TODO change revision to date of model creation
- description "Initial revision of grpcserver model";
- }
-}
diff --git a/grpcserver/impl/src/main/java/org/opendaylight/telemetry/grpc/server/impl/GrpcServerProvider.java b/grpcserver/impl/src/main/java/org/opendaylight/telemetry/grpc/server/impl/GrpcServerProvider.java
deleted file mode 100644
index 33ff87c..0000000
--- a/grpcserver/impl/src/main/java/org/opendaylight/telemetry/grpc/server/impl/GrpcServerProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright © 2017 ZTE, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.telemetry.grpc.server.impl;
-
-import io.grpc.Server;
-import io.grpc.ServerBuilder;
-import io.grpc.examples.helloworld.GreeterGrpc;
-import io.grpc.examples.helloworld.HelloReply;
-import io.grpc.examples.helloworld.HelloRequest;
-import io.grpc.stub.StreamObserver;
-import java.io.IOException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GrpcServerProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(GrpcServerProvider.class);
-
- private final DataBroker dataBroker;
-
- private Server server;
-
- public GrpcServerProvider(final DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- }
-
- /**
- * Method called when the blueprint container is created.
- */
- public void init() {
- LOG.info("GrpcServerProvider Session Initiated");
- try {
- start();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- * Method called when the blueprint container is destroyed.
- */
- public void close() {
- LOG.info("GrpcServerProvider Closed");
- }
-
- private void start() throws IOException {
- int port = 50051;
- server = ServerBuilder.forPort(port).addService(new GreeterImpl()).build().start();
- LOG.info("Server started, listening on " + port);
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- System.err.println("*** shutting down gRPC server since JVM is shutting down");
- stopnow();
- System.err.println("*** server shut down");
- }
- });
- }
-
- private void stopnow() {
- if (null != server) {
- server.shutdown();
- }
- }
-
- static class GreeterImpl extends GreeterGrpc.GreeterImplBase {
- @Override
- public void sayHello(HelloRequest req, StreamObserver responseObserver) {
- HelloReply reply = HelloReply.newBuilder().setMessage("Hello beautiful " + req.getName()).build();
- responseObserver.onNext(reply);
- responseObserver.onCompleted();
- }
- }
-}
diff --git a/grpcserver/impl/src/main/proto/helloworld.proto b/grpcserver/impl/src/main/proto/helloworld.proto
deleted file mode 100644
index 688974b..0000000
--- a/grpcserver/impl/src/main/proto/helloworld.proto
+++ /dev/null
@@ -1,24 +0,0 @@
-syntax = "proto3";
-
-option java_multiple_files = true;
-option java_package = "io.grpc.examples.helloworld";
-option java_outer_classname = "HelloWorldProto";
-option objc_class_prefix = "HLW";
-
-package helloworld;
-
-// The greeting service definition.
-service Greeter {
- // Sends a greeting
- rpc SayHello (HelloRequest) returns (HelloReply) {}
-}
-
-// The request message containing the user's name.
-message HelloRequest {
- string name = 1;
-}
-
-// The response message containing the greetings
-message HelloReply {
- string message = 1;
-}
diff --git a/pom.xml b/pom.xml
old mode 100644
new mode 100755
index 8afa0fd..5ad51d4
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
- grpcserver
+ grpc
configurator
core