blob: d69540e2bee35defafd8bf497726f919fb9a2cd9 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
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;
19
Brian O'Connorb876bf12014-10-02 14:59:37 -070020/**
tom85258ee2014-10-07 00:10:02 -070021 * Representation of the phases an intent may attain during its lifecycle.
Brian O'Connorb876bf12014-10-02 14:59:37 -070022 */
Brian O'Connor9476fa12015-06-25 15:17:17 -040023@Beta
Brian O'Connorb876bf12014-10-02 14:59:37 -070024public enum IntentState {
tom85258ee2014-10-07 00:10:02 -070025
Brian O'Connorb876bf12014-10-02 14:59:37 -070026 /**
tom85258ee2014-10-07 00:10:02 -070027 * 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 Vachuska4b420772014-10-30 16:46:17 -070030 * <p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070031 * All intent in the runtime take this state first.
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080032 * </p><p>
33 * Intents will also pass through this state when they are updated.
Thomas Vachuska4b420772014-10-30 16:46:17 -070034 * </p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070035 */
Brian O'Connorcff03322015-02-03 15:28:59 -080036 INSTALL_REQ, // TODO submit_REQ?
Brian O'Connorb876bf12014-10-02 14:59:37 -070037
38 /**
tom85258ee2014-10-07 00:10:02 -070039 * 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'Connorb876bf12014-10-02 14:59:37 -070042 */
Brian O'Connorea4d7d12015-01-28 16:37:46 -080043 COMPILING, //TODO do we really need this?
Brian O'Connorb876bf12014-10-02 14:59:37 -070044
45 /**
tom85258ee2014-10-07 00:10:02 -070046 * 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'Connorb876bf12014-10-02 14:59:37 -070058 */
59 INSTALLED,
60
61 /**
tom85258ee2014-10-07 00:10:02 -070062 * 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 Vachuska4b420772014-10-30 16:46:17 -070066 * <p>
tom85258ee2014-10-07 00:10:02 -070067 * 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 Vachuska4b420772014-10-30 16:46:17 -070070 * </p>
tom85258ee2014-10-07 00:10:02 -070071 */
Brian O'Connorcff03322015-02-03 15:28:59 -080072 RECOMPILING, // TODO perhaps repurpose as BROKEN.
tom85258ee2014-10-07 00:10:02 -070073
74 /**
Brian O'Connor427a1762014-11-19 18:40:32 -080075 * Indicates that an application has requested that an intent be withdrawn.
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080076 * 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'Connor427a1762014-11-19 18:40:32 -080078 */
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080079 WITHDRAW_REQ,
Brian O'Connor427a1762014-11-19 18:40:32 -080080
81 /**
tom85258ee2014-10-07 00:10:02 -070082 * 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'Connorb876bf12014-10-02 14:59:37 -070086 */
87 WITHDRAWING,
88
89 /**
tom85258ee2014-10-07 00:10:02 -070090 * Indicates that the intent has been successfully withdrawn.
Brian O'Connorb876bf12014-10-02 14:59:37 -070091 */
92 WITHDRAWN,
93
94 /**
Brian O'Connorf0c5a052015-04-27 00:34:53 -070095 * 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'Connorb876bf12014-10-02 14:59:37 -070099 */
Brian O'Connorf0c5a052015-04-27 00:34:53 -0700100 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 Milkey8c6d00e2015-03-13 14:14:34 -0700108
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'Connorb876bf12014-10-02 14:59:37 -0700117}