blob: 372da91dac488b684e04d3c8a93dbf82a5702d51 [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;
weibitf32383b2014-10-22 10:17:31 -07009
10import com.google.common.base.MoreObjects;
11
Brian O'Connor086724e2014-10-23 15:47:32 -070012public class OpticalPathIntent extends ConnectivityIntent {
13
14 private final ConnectPoint src;
15 private final ConnectPoint dst;
weibitf32383b2014-10-22 10:17:31 -070016 private final Path path;
Brian O'Connor086724e2014-10-23 15:47:32 -070017
weibitf32383b2014-10-22 10:17:31 -070018
weibit7e583462014-10-23 10:14:05 -070019 public OpticalPathIntent(ApplicationId appId,
20 ConnectPoint src,
21 ConnectPoint dst,
weibit7e583462014-10-23 10:14:05 -070022 Path path) {
Brian O'Connor086724e2014-10-23 15:47:32 -070023 super(id(OpticalPathIntent.class, src, dst),
24 appId, resources(path.links()), null, null);
25 this.src = src;
26 this.dst = dst;
weibitf32383b2014-10-22 10:17:31 -070027 this.path = path;
28 }
29
weibit9e622ac2014-10-23 13:45:44 -070030 protected OpticalPathIntent() {
Brian O'Connor086724e2014-10-23 15:47:32 -070031 this.src = null;
32 this.dst = null;
weibitf32383b2014-10-22 10:17:31 -070033 this.path = null;
34 }
35
Brian O'Connor086724e2014-10-23 15:47:32 -070036 public ConnectPoint src() {
37 return src;
38 }
39
40 public ConnectPoint dst() {
41 return dst;
42 }
43
weibitf32383b2014-10-22 10:17:31 -070044 public Path path() {
45 return path;
46 }
weibitf32383b2014-10-22 10:17:31 -070047
weibitf32383b2014-10-22 10:17:31 -070048 @Override
weibit7e583462014-10-23 10:14:05 -070049 public boolean isInstallable() {
weibitf32383b2014-10-22 10:17:31 -070050 return true;
51 }
52
53 @Override
weibitf32383b2014-10-22 10:17:31 -070054 public String toString() {
55 return MoreObjects.toStringHelper(getClass())
56 .add("id", id())
Brian O'Connor086724e2014-10-23 15:47:32 -070057 .add("ingressPort", src)
58 .add("egressPort", dst)
weibitf32383b2014-10-22 10:17:31 -070059 .add("path", path)
60 .toString();
61 }
62
weibitf32383b2014-10-22 10:17:31 -070063 public Collection<Link> requiredLinks() {
64 return path.links();
65 }
66}