blob: be34ba8463e79197946a0ba83ff22a21600a9c03 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.intent;
2
3import java.util.List;
4
5import net.onrc.onos.api.batchoperation.BatchOperation;
6import net.onrc.onos.api.batchoperation.IBatchOperationTarget;
7import net.onrc.onos.api.flowmanager.IFlow;
8
Sho SHIMIZUec4f5a72014-07-21 18:21:23 -07009import static com.google.common.base.Preconditions.checkNotNull;
10
Toshio Koidea03915e2014-07-01 18:39:52 -070011/**
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 */
24public abstract class Intent implements IBatchOperationTarget {
Sho SHIMIZUec4f5a72014-07-21 18:21:23 -070025 private final IntentId id;
Toshio Koidea03915e2014-07-01 18:39:52 -070026
27 /**
28 * Constructor.
29 *
30 * @param id ID for this Intent object.
31 */
Sho SHIMIZUec4f5a72014-07-21 18:21:23 -070032 protected Intent(IntentId id) {
33 this.id = checkNotNull(id);
Toshio Koidea03915e2014-07-01 18:39:52 -070034 }
35
36 /**
37 * Gets ID for this Intent object.
38 *
39 * @return ID for this Intent object.
40 */
41 @Override
Toshio Koide025a9152014-07-21 11:00:34 -070042 public IntentId getId() {
Toshio Koidea03915e2014-07-01 18:39:52 -070043 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}