blob: ba5889c43f692756afe157e281fc696f986d17f3 [file] [log] [blame]
Jordan Halterman980a8c12017-09-22 18:01:19 -07001/*
2 * Copyright 2017-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 */
16package org.onosproject.upgrade;
17
18import com.google.common.annotations.Beta;
19import org.onosproject.core.Version;
20import org.onosproject.event.ListenerService;
21
22/**
23 * Upgrade service.
24 */
25@Beta
26public interface UpgradeService
27 extends ListenerService<UpgradeEvent, UpgradeEventListener> {
28
29 /**
30 * Returns whether an upgrade is in progress.
31 * <p>
32 * An upgrade is in progress if the upgrade {@link Upgrade.Status} is active, e.g.
33 * {@link Upgrade.Status#INITIALIZED}, {@link Upgrade.Status#UPGRADED}, etc.
34 *
35 * @return indicates whether an upgrade is in progress
36 */
37 boolean isUpgrading();
38
39 /**
40 * Returns the current upgrade state.
41 *
42 * @return the current upgrade state
43 */
44 Upgrade getState();
45
46 /**
47 * Returns the currently active software version.
48 * <p>
49 * The returned version is representative of the version currently in control of the network. When the upgrade
50 * transitions to the {@link Upgrade.Status#UPGRADING} state, control over the network is transferred from
51 * {@link Upgrade#source()} nodes to {@link Upgrade#target()} nodes, and the version returned by this method
52 * represents that change.
53 *
54 * @return the software version
55 */
56 Version getVersion();
57
58 /**
59 * Returns whether the local node is active.
60 * <p>
61 * The local node will be active if its {@link Version} matches the version returned by {@link #getVersion()}.
62 *
63 * @return indicates whether the local node is active according to its version
64 */
65 boolean isLocalActive();
66
67 /**
68 * Returns whether the local node is an upgraded node.
69 *
70 * @return {@code true} if the local node's version matches {@link Upgrade#target()}
71 */
72 boolean isLocalUpgraded();
73
74}