Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.gnmi.api; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 20 | import gnmi.Gnmi.CapabilityResponse; |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 21 | import gnmi.Gnmi.GetRequest; |
Yi Tseng | d771648 | 2018-10-31 15:34:30 -0700 | [diff] [blame^] | 22 | import gnmi.Gnmi.GetResponse; |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 23 | import gnmi.Gnmi.SetRequest; |
| 24 | import gnmi.Gnmi.SetResponse; |
| 25 | import org.onosproject.grpc.api.GrpcClient; |
| 26 | |
| 27 | import java.util.concurrent.CompletableFuture; |
| 28 | |
| 29 | /** |
| 30 | * Client to control a gNMI server. |
| 31 | */ |
| 32 | @Beta |
| 33 | public interface GnmiClient extends GrpcClient { |
| 34 | |
| 35 | /** |
Yi Tseng | d771648 | 2018-10-31 15:34:30 -0700 | [diff] [blame^] | 36 | * Gets capability from a target. |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 37 | * |
| 38 | * @return the capability response |
| 39 | */ |
| 40 | CompletableFuture<CapabilityResponse> capability(); |
| 41 | |
| 42 | /** |
Yi Tseng | d771648 | 2018-10-31 15:34:30 -0700 | [diff] [blame^] | 43 | * Retrieves a snapshot of data from the device. |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 44 | * |
| 45 | * @param request the get request |
| 46 | * @return the snapshot of data from the device |
| 47 | */ |
| 48 | CompletableFuture<GetResponse> get(GetRequest request); |
| 49 | |
| 50 | /** |
| 51 | * Modifies the state of data on the device. |
| 52 | * |
| 53 | * @param request the set request |
| 54 | * @return the set result |
| 55 | */ |
| 56 | CompletableFuture<SetResponse> set(SetRequest request); |
| 57 | |
Yi Tseng | 5f7fef5 | 2018-11-05 11:30:47 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Check weather the gNMI service is available or not by sending a |
| 60 | * dummy get request message. |
| 61 | * |
| 62 | * @return true if gNMI service available; false otherwise |
| 63 | */ |
| 64 | CompletableFuture<Boolean> isServiceAvailable(); |
| 65 | |
Yi Tseng | 890dc3f | 2018-11-01 13:23:11 -0700 | [diff] [blame] | 66 | // TODO: Support gNMI subscription |
| 67 | } |