blob: 1ad828d174365bda58933a2f8b7b411300bd8fb8 [file] [log] [blame]
weibitf32383b2014-10-22 10:17:31 -07001package org.onlab.onos.net.intent;
2
3import java.util.Collection;
weibitf32383b2014-10-22 10:17:31 -07004
weibit7e583462014-10-23 10:14:05 -07005import org.onlab.onos.ApplicationId;
weibitf32383b2014-10-22 10:17:31 -07006import org.onlab.onos.net.ConnectPoint;
7import org.onlab.onos.net.Link;
8import org.onlab.onos.net.Path;
9import org.onlab.onos.net.flow.TrafficSelector;
10import org.onlab.onos.net.flow.TrafficTreatment;
11
12import com.google.common.base.MoreObjects;
13
weibit7e583462014-10-23 10:14:05 -070014public class OpticalPathIntent extends OpticalConnectivityIntent {
weibitf32383b2014-10-22 10:17:31 -070015 private final Path path;
16 private final TrafficSelector opticalMatch;
17 private final TrafficTreatment opticalAction;
18
weibit7e583462014-10-23 10:14:05 -070019 public OpticalPathIntent(ApplicationId appId,
20 ConnectPoint src,
21 ConnectPoint dst,
22 TrafficSelector match,
23 TrafficTreatment action,
24 Path path) {
25 super(appId, src, dst);
weibitf32383b2014-10-22 10:17:31 -070026 this.opticalMatch = match;
27 this.opticalAction = action;
28 this.path = path;
29 }
30
31 public OpticalPathIntent() {
32 this.opticalMatch = null;
33 this.opticalAction = null;
34 this.path = null;
35 }
36
37 public Path path() {
38 return path;
39 }
40
41 public TrafficSelector selector() {
42 return opticalMatch;
43 }
44
45 public TrafficTreatment treatment() {
46 return opticalAction;
47 }
48
49 @Override
weibit7e583462014-10-23 10:14:05 -070050 public boolean isInstallable() {
weibitf32383b2014-10-22 10:17:31 -070051 return true;
52 }
53
54 @Override
weibitf32383b2014-10-22 10:17:31 -070055 public String toString() {
56 return MoreObjects.toStringHelper(getClass())
57 .add("id", id())
58 .add("match", opticalMatch)
59 .add("action", opticalAction)
60 .add("ingressPort", this.getSrcConnectPoint())
61 .add("egressPort", this.getDst())
62 .add("path", path)
63 .toString();
64 }
65
weibitf32383b2014-10-22 10:17:31 -070066 public Collection<Link> requiredLinks() {
67 return path.links();
68 }
69}