Laszlo Papp | f50057c | 2018-06-15 14:37:35 +0100 | [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.net.behaviour; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | |
| 21 | import org.onosproject.net.driver.HandlerBehaviour; |
| 22 | |
| 23 | import java.net.URI; |
| 24 | import java.util.concurrent.CompletableFuture; |
| 25 | |
| 26 | /** |
| 27 | * Behaviour that upgrades the software on a device. |
| 28 | * |
| 29 | */ |
| 30 | @Beta |
| 31 | public interface SoftwareUpgrade extends HandlerBehaviour { |
| 32 | |
| 33 | /** |
| 34 | * Completion status of upgrade. |
| 35 | */ |
| 36 | public enum Status { |
| 37 | /** |
| 38 | * Indicates a successfully completed upgrade. |
| 39 | */ |
| 40 | SUCCESS, |
| 41 | |
| 42 | /** |
| 43 | * Indicates an aborted upgrade. |
| 44 | */ |
| 45 | FAILURE |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Configures the uri from where the upgrade will be pulled. |
| 50 | * |
| 51 | * @param uri uri of the software upgrade location |
| 52 | * @return boolean true if the uri was properly configured |
| 53 | */ |
| 54 | boolean configureUri(URI uri); |
| 55 | |
| 56 | /** |
| 57 | * Performs an upgrade. |
| 58 | * |
| 59 | * @return A future that will be completed when the upgrade completes |
| 60 | */ |
| 61 | CompletableFuture<Status> upgrade(); |
| 62 | } |