blob: 242bc94b0ec15ea9639129e962a3abea48efaa44 [file] [log] [blame]
Yi Tseng890dc3f2018-11-01 13:23:11 -07001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.gnmi.api;
18
19import com.google.common.annotations.Beta;
20
21import gnmi.Gnmi.CapabilityResponse;
22import gnmi.Gnmi.GetResponse;
23import gnmi.Gnmi.GetRequest;
24import gnmi.Gnmi.SetRequest;
25import gnmi.Gnmi.SetResponse;
26import org.onosproject.grpc.api.GrpcClient;
27
28import java.util.concurrent.CompletableFuture;
29
30/**
31 * Client to control a gNMI server.
32 */
33@Beta
34public interface GnmiClient extends GrpcClient {
35
36 /**
37 * Gets capability from a target. This allows device driver behavior
38 * to validate the service version and models which gNMI device supported.
39 *
40 * @return the capability response
41 */
42 CompletableFuture<CapabilityResponse> capability();
43
44 /**
45 * Retrieve a snapshot of data from the device.
46 *
47 * @param request the get request
48 * @return the snapshot of data from the device
49 */
50 CompletableFuture<GetResponse> get(GetRequest request);
51
52 /**
53 * Modifies the state of data on the device.
54 *
55 * @param request the set request
56 * @return the set result
57 */
58 CompletableFuture<SetResponse> set(SetRequest request);
59
Yi Tseng5f7fef52018-11-05 11:30:47 -080060 /**
61 * Check weather the gNMI service is available or not by sending a
62 * dummy get request message.
63 *
64 * @return true if gNMI service available; false otherwise
65 */
66 CompletableFuture<Boolean> isServiceAvailable();
67
Yi Tseng890dc3f2018-11-01 13:23:11 -070068 // TODO: Support gNMI subscription
69}