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 | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 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. |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 29 | * </p><p> |
| 30 | * Intents will also pass through this state when they are updated. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 31 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 32 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 33 | INSTALL_REQ, // TODO submit_REQ? |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 36 | * Signifies that the intent is being compiled into installable intents. |
| 37 | * This is a transitional state after which the intent will enter either |
| 38 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 39 | */ |
Brian O'Connor | ea4d7d1 | 2015-01-28 16:37:46 -0800 | [diff] [blame] | 40 | COMPILING, //TODO do we really need this? |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 43 | * Signifies that the resulting installable intents are being installed |
| 44 | * into the network environment. This is a transitional state after which |
| 45 | * the intent will enter either {@link #INSTALLED} state or |
| 46 | * {@link #RECOMPILING} state. |
| 47 | */ |
| 48 | INSTALLING, |
| 49 | |
| 50 | /** |
| 51 | * The intent has been successfully installed. This is a state where the |
| 52 | * intent may remain parked until it is withdrawn by the application or |
| 53 | * until the network environment changes in some way to make the original |
| 54 | * set of installable intents untenable. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 55 | */ |
| 56 | INSTALLED, |
| 57 | |
| 58 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 59 | * Signifies that the intent is being recompiled into installable intents |
| 60 | * as an attempt to adapt to an anomaly in the network environment. |
| 61 | * This is a transitional state after which the intent will enter either |
| 62 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 63 | * <p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 64 | * Exit to the {@link #FAILED} state may be caused by failure to compile |
| 65 | * or by compiling into the same set of installable intents which have |
| 66 | * previously failed to be installed. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 67 | * </p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 68 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 69 | RECOMPILING, // TODO perhaps repurpose as BROKEN. |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 70 | |
| 71 | /** |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 72 | * Indicates that an application has requested that an intent be withdrawn. |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 73 | * It will start withdrawing shortly, but not necessarily on this instance. |
| 74 | * Intents can also be parked here if it is impossible to withdraw them. |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 75 | */ |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 76 | WITHDRAW_REQ, |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 79 | * Indicates that the intent is being withdrawn. This is a transitional |
| 80 | * state, triggered by invocation of the |
| 81 | * {@link IntentService#withdraw(Intent)} but one with only one outcome, |
| 82 | * 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] | 83 | */ |
| 84 | WITHDRAWING, |
| 85 | |
| 86 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 87 | * Indicates that the intent has been successfully withdrawn. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 88 | */ |
| 89 | WITHDRAWN, |
| 90 | |
| 91 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 92 | * Signifies that the intent has failed compiling, installing or |
| 93 | * recompiling states. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 94 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 95 | FAILED //TODO consider renaming to UNSAT. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 96 | } |