Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 16 | package org.onlab.onos.net.intent; |
| 17 | |
| 18 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 19 | * Representation of the phases an intent may attain during its lifecycle. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 20 | */ |
| 21 | public enum IntentState { |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 22 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 23 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 24 | * Signifies that the intent has been submitted and will start compiling |
| 25 | * shortly. However, this compilation may not necessarily occur on the |
| 26 | * local controller instance. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 27 | * <p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 28 | * All intent in the runtime take this state first. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 29 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 30 | */ |
| 31 | SUBMITTED, |
| 32 | |
| 33 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 34 | * Signifies that the intent is being compiled into installable intents. |
| 35 | * This is a transitional state after which the intent will enter either |
| 36 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 37 | */ |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 38 | COMPILING, |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 41 | * Signifies that the resulting installable intents are being installed |
| 42 | * into the network environment. This is a transitional state after which |
| 43 | * the intent will enter either {@link #INSTALLED} state or |
| 44 | * {@link #RECOMPILING} state. |
| 45 | */ |
| 46 | INSTALLING, |
| 47 | |
| 48 | /** |
| 49 | * The intent has been successfully installed. This is a state where the |
| 50 | * intent may remain parked until it is withdrawn by the application or |
| 51 | * until the network environment changes in some way to make the original |
| 52 | * set of installable intents untenable. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 53 | */ |
| 54 | INSTALLED, |
| 55 | |
| 56 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 57 | * Signifies that the intent is being recompiled into installable intents |
| 58 | * as an attempt to adapt to an anomaly in the network environment. |
| 59 | * This is a transitional state after which the intent will enter either |
| 60 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 61 | * <p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 62 | * Exit to the {@link #FAILED} state may be caused by failure to compile |
| 63 | * or by compiling into the same set of installable intents which have |
| 64 | * previously failed to be installed. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 65 | * </p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 66 | */ |
| 67 | RECOMPILING, |
| 68 | |
| 69 | /** |
| 70 | * Indicates that the intent is being withdrawn. This is a transitional |
| 71 | * state, triggered by invocation of the |
| 72 | * {@link IntentService#withdraw(Intent)} but one with only one outcome, |
| 73 | * which is the the intent being placed in the {@link #WITHDRAWN} state. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 74 | */ |
| 75 | WITHDRAWING, |
| 76 | |
| 77 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 78 | * Indicates that the intent has been successfully withdrawn. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 79 | */ |
| 80 | WITHDRAWN, |
| 81 | |
| 82 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 83 | * Signifies that the intent has failed compiling, installing or |
| 84 | * recompiling states. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 85 | */ |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 86 | FAILED |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 87 | } |