Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.intent; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | import java.util.EventListener; |
| 5 | |
| 6 | import net.onrc.onos.api.batchoperation.BatchOperation; |
| 7 | import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy; |
| 8 | import net.onrc.onos.api.flowmanager.IFlow; |
| 9 | |
| 10 | /** |
| 11 | * An interface class for the Intent-Runtime Service. The role of the |
| 12 | * Intent-Runtime Service is to manage a set of IFlow objects based on the |
| 13 | * specified Intent objects. |
| 14 | * <p> |
| 15 | * It compiles accepted Intents to IFlow objects by allocating resources and |
| 16 | * calculating paths based on the constrains described in the Intents, and |
| 17 | * executes installation/uninstallation of the IFlow objects using FlowManager |
| 18 | * Service. |
| 19 | */ |
| 20 | public interface IIntentRuntimeService { |
| 21 | /** |
| 22 | * Adds specified intent. |
| 23 | * |
| 24 | * @param intent Intent to be added. |
| 25 | * @return true if succeeded, false otherwise. |
| 26 | */ |
| 27 | boolean addIntent(Intent intent); |
| 28 | |
| 29 | /** |
| 30 | * Removes specified intent. |
| 31 | * |
| 32 | * @param id ID of the intent to be removed. |
| 33 | * @return true if succeeded, false otherwise. |
| 34 | */ |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame^] | 35 | boolean removeIntent(IntentId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Overwrites existing intent by new specified intent. |
| 39 | * |
| 40 | * @param id ID of the existing intent to be overwritten. |
| 41 | * @param intent The new intent to be added. |
| 42 | * @return true if succeeded, false otherwise. |
| 43 | */ |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame^] | 44 | boolean updateIntent(IntentId id, Intent intent); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Gets specific intent. |
| 48 | * |
| 49 | * @param id ID of the intent should be retrieved |
| 50 | * @return Intent if it exists, null otherwise. |
| 51 | */ |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame^] | 52 | Intent getIntent(IntentId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Gets all intents. |
| 56 | * |
| 57 | * @return collection of intents. |
| 58 | */ |
| 59 | Collection<Intent> getIntents(); |
| 60 | |
| 61 | /** |
| 62 | * Executes batch operation of intents. |
| 63 | * |
| 64 | * @param ops BatchOperations to be executed. |
| 65 | * @return true if succeeded, false otherwise. |
| 66 | */ |
| 67 | boolean executeBatch(BatchOperation<Intent> ops); |
| 68 | |
| 69 | /** |
| 70 | * Gets IFlow objects managed by the specified intent. |
| 71 | * |
| 72 | * @param intentId ID of the target Intent. |
| 73 | * @return Collection of IFlow objects if exists, null otherwise. |
| 74 | */ |
| 75 | Collection<IFlow> getFlows(String intentId); |
| 76 | |
| 77 | /** |
| 78 | * Gets Intent object which manages the specified IFlow object. |
| 79 | * |
| 80 | * @param flowId ID of the target IFlow object. |
| 81 | * @return Intent which manages the specified IFlow object, null otherwise. |
| 82 | */ |
| 83 | Intent getIntentByFlow(String flowId); |
| 84 | |
| 85 | /** |
| 86 | * Sets a conflict detection policy. |
| 87 | * |
| 88 | * @param policy ConflictDetectionPolicy object to be set. |
| 89 | */ |
| 90 | void setConflictDetectionPolicy(ConflictDetectionPolicy policy); |
| 91 | |
| 92 | /** |
| 93 | * Gets the conflict detection policy. |
| 94 | * |
| 95 | * @return ConflictDetectionPolicy object being applied currently. |
| 96 | */ |
| 97 | ConflictDetectionPolicy getConflictDetectionPolicy(); |
| 98 | |
| 99 | /** |
| 100 | * Adds event listener to this service. |
| 101 | * |
| 102 | * @param listener EventListener to be added. |
| 103 | */ |
| 104 | void addEventListener(EventListener listener); |
| 105 | |
| 106 | /** |
| 107 | * Removes event listener from this service. |
| 108 | * |
| 109 | * @param listener EventListener to be removed. |
| 110 | */ |
| 111 | void removeEventListener(EventListener listener); |
| 112 | } |