oleksandr.yashchuk@plvision.eu | 3dbcaaf | 2019-03-13 14:44:46 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019-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.gnoi.api; |
| 18 | |
| 19 | import gnoi.system.SystemOuterClass.TimeResponse; |
| 20 | import gnoi.system.SystemOuterClass.RebootRequest; |
| 21 | import gnoi.system.SystemOuterClass.RebootResponse; |
Serhii Boiko | 992bf52 | 2019-03-28 18:38:04 +0200 | [diff] [blame^] | 22 | import gnoi.system.SystemOuterClass.SetPackageRequest; |
| 23 | import gnoi.system.SystemOuterClass.SetPackageResponse; |
| 24 | import gnoi.system.SystemOuterClass.SwitchControlProcessorRequest; |
| 25 | import gnoi.system.SystemOuterClass.SwitchControlProcessorResponse; |
oleksandr.yashchuk@plvision.eu | 3dbcaaf | 2019-03-13 14:44:46 +0200 | [diff] [blame] | 26 | import com.google.common.annotations.Beta; |
| 27 | import org.onosproject.grpc.api.GrpcClient; |
| 28 | import java.util.concurrent.CompletableFuture; |
Serhii Boiko | 992bf52 | 2019-03-28 18:38:04 +0200 | [diff] [blame^] | 29 | import java.util.concurrent.SynchronousQueue; |
oleksandr.yashchuk@plvision.eu | 3dbcaaf | 2019-03-13 14:44:46 +0200 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Client to control a gNOI server. |
| 33 | */ |
| 34 | @Beta |
| 35 | public interface GnoiClient extends GrpcClient { |
| 36 | |
| 37 | /** |
| 38 | * Returns the current time on the target. |
| 39 | * |
| 40 | * @return the TimeResponse result |
| 41 | */ |
| 42 | CompletableFuture<TimeResponse> time(); |
| 43 | |
| 44 | /** |
| 45 | * Causes the target to reboot immediately. |
| 46 | * |
| 47 | * @param request RebootRequest |
| 48 | * @return the RebootResponse result |
| 49 | */ |
| 50 | CompletableFuture<RebootResponse> reboot(RebootRequest request); |
Serhii Boiko | 992bf52 | 2019-03-28 18:38:04 +0200 | [diff] [blame^] | 51 | |
| 52 | /** |
| 53 | * Executes a SetPackage RPC for the given list |
| 54 | * of SetPackageRequest messages. |
| 55 | * |
| 56 | * @param stream list of SetPackageRequests. |
| 57 | * @return SetPackageResponse from device. |
| 58 | */ |
| 59 | CompletableFuture<SetPackageResponse> setPackage(SynchronousQueue<SetPackageRequest> stream); |
| 60 | |
| 61 | /** |
| 62 | * Executes a SwitchControlProcessor RPC given the path |
| 63 | * to the new software agent. |
| 64 | * |
| 65 | * @param request SwitchControlProcessorRequest |
| 66 | * @return SwitchControlProcessorResponse from device. |
| 67 | */ |
| 68 | CompletableFuture<SwitchControlProcessorResponse> switchControlProcessor(SwitchControlProcessorRequest request); |
| 69 | |
oleksandr.yashchuk@plvision.eu | 3dbcaaf | 2019-03-13 14:44:46 +0200 | [diff] [blame] | 70 | } |