Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.intent; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import net.onrc.onos.api.batchoperation.BatchOperation; |
| 6 | import net.onrc.onos.api.batchoperation.IBatchOperationTarget; |
| 7 | import net.onrc.onos.api.flowmanager.IFlow; |
| 8 | |
Sho SHIMIZU | ec4f5a7 | 2014-07-21 18:21:23 -0700 | [diff] [blame^] | 9 | import static com.google.common.base.Preconditions.checkNotNull; |
| 10 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 11 | /** |
| 12 | * The base class for the connectivity abstraction. It allows applications to |
| 13 | * specify end hosts, apply some basic filtering to traffic, and constrain |
| 14 | * traffic. |
| 15 | * <p> |
| 16 | * This class is sub-classed to provide other intent types like shortest path |
| 17 | * connectivity and bandwidth constrained shortest path connectivity. |
| 18 | * <p> |
| 19 | * The reasoning behind "intent" is that the applications can provide some |
| 20 | * abstract representation of how traffic should flow be handled by the |
| 21 | * networking, allowing the network OS to compile, reserve and optimize the |
| 22 | * data-plane to satisfy those constraints. |
| 23 | */ |
| 24 | public abstract class Intent implements IBatchOperationTarget { |
Sho SHIMIZU | ec4f5a7 | 2014-07-21 18:21:23 -0700 | [diff] [blame^] | 25 | private final IntentId id; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 26 | |
| 27 | /** |
| 28 | * Constructor. |
| 29 | * |
| 30 | * @param id ID for this Intent object. |
| 31 | */ |
Sho SHIMIZU | ec4f5a7 | 2014-07-21 18:21:23 -0700 | [diff] [blame^] | 32 | protected Intent(IntentId id) { |
| 33 | this.id = checkNotNull(id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Gets ID for this Intent object. |
| 38 | * |
| 39 | * @return ID for this Intent object. |
| 40 | */ |
| 41 | @Override |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 42 | public IntentId getId() { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 43 | return id; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Compiles this Intent object to the list of FlowOperations. |
| 48 | * <p> |
| 49 | * All Intent object must implement this method and IntentRuntimeModule use |
| 50 | * this method to process this Intent. |
| 51 | * |
| 52 | * @return The list of FlowOperations of this Intent. |
| 53 | */ |
| 54 | public abstract List<BatchOperation<IFlow>> compile(); |
| 55 | } |