Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 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 | |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
| 19 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 20 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 21 | * Representation of the phases an intent may attain during its lifecycle. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 22 | */ |
Brian O'Connor | 9476fa1 | 2015-06-25 15:17:17 -0400 | [diff] [blame] | 23 | @Beta |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 24 | public enum IntentState { |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 25 | |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 26 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 27 | * Signifies that the intent has been submitted and will start compiling |
| 28 | * shortly. However, this compilation may not necessarily occur on the |
| 29 | * local controller instance. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 30 | * <p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 31 | * All intent in the runtime take this state first. |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 32 | * </p><p> |
| 33 | * Intents will also pass through this state when they are updated. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 34 | * </p> |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 35 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 36 | INSTALL_REQ, // TODO submit_REQ? |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 39 | * Signifies that the intent is being compiled into installable intents. |
| 40 | * This is a transitional state after which the intent will enter either |
| 41 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 42 | */ |
Brian O'Connor | ea4d7d1 | 2015-01-28 16:37:46 -0800 | [diff] [blame] | 43 | COMPILING, //TODO do we really need this? |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 46 | * Signifies that the resulting installable intents are being installed |
| 47 | * into the network environment. This is a transitional state after which |
| 48 | * the intent will enter either {@link #INSTALLED} state or |
| 49 | * {@link #RECOMPILING} state. |
| 50 | */ |
| 51 | INSTALLING, |
| 52 | |
| 53 | /** |
| 54 | * The intent has been successfully installed. This is a state where the |
| 55 | * intent may remain parked until it is withdrawn by the application or |
| 56 | * until the network environment changes in some way to make the original |
| 57 | * set of installable intents untenable. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 58 | */ |
| 59 | INSTALLED, |
| 60 | |
| 61 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 62 | * Signifies that the intent is being recompiled into installable intents |
| 63 | * as an attempt to adapt to an anomaly in the network environment. |
| 64 | * This is a transitional state after which the intent will enter either |
| 65 | * {@link #FAILED} state or {@link #INSTALLING} state. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 66 | * <p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 67 | * Exit to the {@link #FAILED} state may be caused by failure to compile |
| 68 | * or by compiling into the same set of installable intents which have |
| 69 | * previously failed to be installed. |
Thomas Vachuska | 4b42077 | 2014-10-30 16:46:17 -0700 | [diff] [blame] | 70 | * </p> |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 71 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 72 | RECOMPILING, // TODO perhaps repurpose as BROKEN. |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 73 | |
| 74 | /** |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 75 | * Indicates that an application has requested that an intent be withdrawn. |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 76 | * It will start withdrawing shortly, but not necessarily on this instance. |
| 77 | * 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] | 78 | */ |
Brian O'Connor | 7a71d5d | 2014-12-02 00:12:27 -0800 | [diff] [blame] | 79 | WITHDRAW_REQ, |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 80 | |
| 81 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 82 | * Indicates that the intent is being withdrawn. This is a transitional |
| 83 | * state, triggered by invocation of the |
| 84 | * {@link IntentService#withdraw(Intent)} but one with only one outcome, |
| 85 | * 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] | 86 | */ |
| 87 | WITHDRAWING, |
| 88 | |
| 89 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 90 | * Indicates that the intent has been successfully withdrawn. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 91 | */ |
| 92 | WITHDRAWN, |
| 93 | |
| 94 | /** |
Brian O'Connor | f0c5a05 | 2015-04-27 00:34:53 -0700 | [diff] [blame] | 95 | * Signifies that the intent has failed to be installed and cannot be |
| 96 | * satisfied given current network conditions. But, the framework will |
| 97 | * reattempt to install it when network conditions change until it is |
| 98 | * withdrawn by an application. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 99 | */ |
Brian O'Connor | f0c5a05 | 2015-04-27 00:34:53 -0700 | [diff] [blame] | 100 | FAILED, //TODO consider renaming to UNSATISFIABLE |
| 101 | |
| 102 | /** |
| 103 | * Signifies that an intent has failed either installation or withdrawal, |
| 104 | * and still hold some or all of its resources. |
| 105 | * (e.g. link reservations, flow rules on the data plane, etc.) |
| 106 | */ |
| 107 | CORRUPT, //TODO consider renaming to ERROR |
Ray Milkey | 8c6d00e | 2015-03-13 14:14:34 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Indicates that the intent should be purged from the database. |
| 111 | * <p> |
| 112 | * Note: This operation will only be performed if the intent is already |
| 113 | * in WITHDRAWN or FAILED. |
| 114 | * </p> |
| 115 | */ |
| 116 | PURGE_REQ |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 117 | } |