Initial gNOI implementation added. Introduced system Time and Reboot RPC

Change-Id: I8accdcc6c1ff247408ce54490ceff3972fdf850f
diff --git a/protocols/gnoi/api/BUILD b/protocols/gnoi/api/BUILD
new file mode 100644
index 0000000..600f437
--- /dev/null
+++ b/protocols/gnoi/api/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//protocols/grpc/api:onos-protocols-grpc-api",
+    "//protocols/gnoi/stub:onos-protocols-gnoi-stub",
+]
+
+osgi_jar(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClient.java b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClient.java
new file mode 100644
index 0000000..d66c6f1
--- /dev/null
+++ b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClient.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2019-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.gnoi.api;
+
+import gnoi.system.SystemOuterClass.TimeResponse;
+import gnoi.system.SystemOuterClass.RebootRequest;
+import gnoi.system.SystemOuterClass.RebootResponse;
+import com.google.common.annotations.Beta;
+import org.onosproject.grpc.api.GrpcClient;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Client to control a gNOI server.
+ */
+@Beta
+public interface GnoiClient extends GrpcClient {
+
+    /**
+     * Returns the current time on the target.
+     *
+     * @return the TimeResponse result
+     */
+    CompletableFuture<TimeResponse> time();
+
+    /**
+     * Causes the target to reboot immediately.
+     *
+     * @param request RebootRequest
+     * @return the RebootResponse result
+     */
+    CompletableFuture<RebootResponse> reboot(RebootRequest request);
+}
diff --git a/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClientKey.java b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClientKey.java
new file mode 100644
index 0000000..e246d74
--- /dev/null
+++ b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiClientKey.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-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.gnoi.api;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.grpc.api.GrpcClientKey;
+import org.onosproject.net.DeviceId;
+
+import java.net.URI;
+
+/**
+ * Key that uniquely identifies a gNOI client.
+ */
+@Beta
+public class GnoiClientKey extends GrpcClientKey {
+
+    private static final String GNOI = "gNOI";
+
+    /**
+     * Creates a new gNOI client key.
+     *
+     * @param deviceId  ONOS device ID
+     * @param serverUri gNOI server URI
+     */
+    public GnoiClientKey(DeviceId deviceId, URI serverUri) {
+        super(GNOI, deviceId, serverUri);
+    }
+}
diff --git a/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiController.java b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiController.java
new file mode 100644
index 0000000..b601e21
--- /dev/null
+++ b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/GnoiController.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2019-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.gnoi.api;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.grpc.api.GrpcClientController;
+
+/**
+ * Controller of gNOI devices.
+ */
+@Beta
+public interface GnoiController
+        extends GrpcClientController<GnoiClientKey, GnoiClient> {
+}
diff --git a/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/package-info.java b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/package-info.java
new file mode 100644
index 0000000..ff86859
--- /dev/null
+++ b/protocols/gnoi/api/src/main/java/org/onosproject/gnoi/api/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * gNOI protocol API.
+ */
+package org.onosproject.gnoi.api;