blob: 2c75e7fdce9f02cf13e39bf1ea8c7aa3da540c5c [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
Brian O'Connorb876bf12014-10-02 14:59:37 -070017
Brian O'Connor9476fa12015-06-25 15:17:17 -040018import com.google.common.annotations.Beta;
Antonio Marsico4f68ec92017-03-09 11:16:32 +010019import org.onosproject.net.intent.constraint.NonDisruptiveConstraint;
Brian O'Connor9476fa12015-06-25 15:17:17 -040020
Brian O'Connorb876bf12014-10-02 14:59:37 -070021/**
tom85258ee2014-10-07 00:10:02 -070022 * Representation of the phases an intent may attain during its lifecycle.
Brian O'Connorb876bf12014-10-02 14:59:37 -070023 */
Brian O'Connor9476fa12015-06-25 15:17:17 -040024@Beta
Brian O'Connorb876bf12014-10-02 14:59:37 -070025public enum IntentState {
tom85258ee2014-10-07 00:10:02 -070026
Brian O'Connorb876bf12014-10-02 14:59:37 -070027 /**
tom85258ee2014-10-07 00:10:02 -070028 * Signifies that the intent has been submitted and will start compiling
29 * shortly. However, this compilation may not necessarily occur on the
30 * local controller instance.
Thomas Vachuska4b420772014-10-30 16:46:17 -070031 * <p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070032 * All intent in the runtime take this state first.
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080033 * </p><p>
34 * Intents will also pass through this state when they are updated.
Thomas Vachuska4b420772014-10-30 16:46:17 -070035 * </p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070036 */
Brian O'Connorcff03322015-02-03 15:28:59 -080037 INSTALL_REQ, // TODO submit_REQ?
Brian O'Connorb876bf12014-10-02 14:59:37 -070038
39 /**
tom85258ee2014-10-07 00:10:02 -070040 * Signifies that the intent is being compiled into installable intents.
41 * This is a transitional state after which the intent will enter either
42 * {@link #FAILED} state or {@link #INSTALLING} state.
Brian O'Connorb876bf12014-10-02 14:59:37 -070043 */
Brian O'Connorea4d7d12015-01-28 16:37:46 -080044 COMPILING, //TODO do we really need this?
Brian O'Connorb876bf12014-10-02 14:59:37 -070045
46 /**
tom85258ee2014-10-07 00:10:02 -070047 * Signifies that the resulting installable intents are being installed
48 * into the network environment. This is a transitional state after which
49 * the intent will enter either {@link #INSTALLED} state or
50 * {@link #RECOMPILING} state.
51 */
52 INSTALLING,
53
54 /**
55 * The intent has been successfully installed. This is a state where the
56 * intent may remain parked until it is withdrawn by the application or
57 * until the network environment changes in some way to make the original
58 * set of installable intents untenable.
Brian O'Connorb876bf12014-10-02 14:59:37 -070059 */
60 INSTALLED,
61
62 /**
tom85258ee2014-10-07 00:10:02 -070063 * Signifies that the intent is being recompiled into installable intents
64 * as an attempt to adapt to an anomaly in the network environment.
65 * This is a transitional state after which the intent will enter either
66 * {@link #FAILED} state or {@link #INSTALLING} state.
Thomas Vachuska4b420772014-10-30 16:46:17 -070067 * <p>
tom85258ee2014-10-07 00:10:02 -070068 * Exit to the {@link #FAILED} state may be caused by failure to compile
69 * or by compiling into the same set of installable intents which have
70 * previously failed to be installed.
Thomas Vachuska4b420772014-10-30 16:46:17 -070071 * </p>
tom85258ee2014-10-07 00:10:02 -070072 */
Brian O'Connorcff03322015-02-03 15:28:59 -080073 RECOMPILING, // TODO perhaps repurpose as BROKEN.
tom85258ee2014-10-07 00:10:02 -070074
75 /**
Brian O'Connor427a1762014-11-19 18:40:32 -080076 * Indicates that an application has requested that an intent be withdrawn.
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080077 * It will start withdrawing shortly, but not necessarily on this instance.
78 * Intents can also be parked here if it is impossible to withdraw them.
Brian O'Connor427a1762014-11-19 18:40:32 -080079 */
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080080 WITHDRAW_REQ,
Brian O'Connor427a1762014-11-19 18:40:32 -080081
82 /**
tom85258ee2014-10-07 00:10:02 -070083 * Indicates that the intent is being withdrawn. This is a transitional
84 * state, triggered by invocation of the
85 * {@link IntentService#withdraw(Intent)} but one with only one outcome,
86 * which is the the intent being placed in the {@link #WITHDRAWN} state.
Brian O'Connorb876bf12014-10-02 14:59:37 -070087 */
88 WITHDRAWING,
89
90 /**
tom85258ee2014-10-07 00:10:02 -070091 * Indicates that the intent has been successfully withdrawn.
Brian O'Connorb876bf12014-10-02 14:59:37 -070092 */
93 WITHDRAWN,
94
95 /**
Brian O'Connorf0c5a052015-04-27 00:34:53 -070096 * Signifies that the intent has failed to be installed and cannot be
97 * satisfied given current network conditions. But, the framework will
98 * reattempt to install it when network conditions change until it is
99 * withdrawn by an application.
Brian O'Connorb876bf12014-10-02 14:59:37 -0700100 */
Brian O'Connorf0c5a052015-04-27 00:34:53 -0700101 FAILED, //TODO consider renaming to UNSATISFIABLE
102
103 /**
104 * Signifies that an intent has failed either installation or withdrawal,
105 * and still hold some or all of its resources.
106 * (e.g. link reservations, flow rules on the data plane, etc.)
107 */
108 CORRUPT, //TODO consider renaming to ERROR
Ray Milkey8c6d00e2015-03-13 14:14:34 -0700109
110 /**
111 * Indicates that the intent should be purged from the database.
112 * <p>
113 * Note: This operation will only be performed if the intent is already
114 * in WITHDRAWN or FAILED.
115 * </p>
116 */
Antonio Marsico4f68ec92017-03-09 11:16:32 +0100117 PURGE_REQ,
118
119 /**
120 * Indicates that the intent is being reallocated in a non-disruptive way {@link NonDisruptiveConstraint}.
121 * This state can be used to inform other applications that the intent is performing
122 * the reallocation. In particular type of networks this operation can require
123 * a long time. After all the reallocation stages are completed, the intent
124 * returns to the {@link #INSTALLED} state. If any of the reallocation stages fails,
125 * the intent is flagged as {@link #FAILED}.
126 */
127 REALLOCATING
Brian O'Connorb876bf12014-10-02 14:59:37 -0700128}