blob: c6cdb44efbe46d97ead78c6b4cd1c7cba5ff5e02 [file] [log] [blame]
Laszlo Pappf50057c2018-06-15 14:37:35 +01001/*
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.net.behaviour;
18
19import com.google.common.annotations.Beta;
20
21import org.onosproject.net.driver.HandlerBehaviour;
22
Thomas Vachuskac6ea6472020-07-30 20:49:37 +000023import java.net.URI;
Laszlo Pappf50057c2018-06-15 14:37:35 +010024import java.util.concurrent.CompletableFuture;
25
26/**
27 * Behaviour that upgrades the software on a device.
28 *
29 */
30@Beta
31public interface SoftwareUpgrade extends HandlerBehaviour {
32
33 /**
Thomas Vachuskac6ea6472020-07-30 20:49:37 +000034 * Completion status of upgrade.
Laszlo Pappf50057c2018-06-15 14:37:35 +010035 */
Thomas Vachuskac6ea6472020-07-30 20:49:37 +000036 public enum Status {
37 /**
38 * Indicates a successfully completed upgrade.
39 */
40 SUCCESS,
Laszlo Pappf50057c2018-06-15 14:37:35 +010041
Thomas Vachuskac6ea6472020-07-30 20:49:37 +000042 /**
43 * Indicates an aborted upgrade.
44 */
45 FAILURE
Laszlo Pappf50057c2018-06-15 14:37:35 +010046 }
47
Thomas Vachuskac6ea6472020-07-30 20:49:37 +000048 /**
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();
Laszlo Pappf50057c2018-06-15 14:37:35 +010062}