Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 19 | package org.onlab.onos.net.intent; |
| 20 | |
| 21 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 22 | * Representation of the phases an intent may attain during its lifecycle. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 23 | */ |
| 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. |
| 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. |
| 32 | */ |
| 33 | SUBMITTED, |
| 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 | */ |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 40 | COMPILING, |
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. |
| 63 | * <p/> |
| 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. |
| 67 | */ |
| 68 | RECOMPILING, |
| 69 | |
| 70 | /** |
| 71 | * Indicates that the intent is being withdrawn. This is a transitional |
| 72 | * state, triggered by invocation of the |
| 73 | * {@link IntentService#withdraw(Intent)} but one with only one outcome, |
| 74 | * 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] | 75 | */ |
| 76 | WITHDRAWING, |
| 77 | |
| 78 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 79 | * Indicates that the intent has been successfully withdrawn. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 80 | */ |
| 81 | WITHDRAWN, |
| 82 | |
| 83 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 84 | * Signifies that the intent has failed compiling, installing or |
| 85 | * recompiling states. |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 86 | */ |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 87 | FAILED |
Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 88 | } |