Sho SHIMIZU

Use DeviceId instead of ElementId in WaypointConstraint for consistency

- More consistent with ObstacleConstraint

Change-Id: I0988de74a4917ed91580f078c1dae653c030e5bc
...@@ -17,7 +17,7 @@ package org.onlab.onos.net.intent.constraint; ...@@ -17,7 +17,7 @@ package org.onlab.onos.net.intent.constraint;
17 17
18 import com.google.common.base.MoreObjects; 18 import com.google.common.base.MoreObjects;
19 import com.google.common.collect.ImmutableList; 19 import com.google.common.collect.ImmutableList;
20 -import org.onlab.onos.net.ElementId; 20 +import org.onlab.onos.net.DeviceId;
21 import org.onlab.onos.net.Link; 21 import org.onlab.onos.net.Link;
22 import org.onlab.onos.net.Path; 22 import org.onlab.onos.net.Path;
23 import org.onlab.onos.net.intent.Constraint; 23 import org.onlab.onos.net.intent.Constraint;
...@@ -35,20 +35,20 @@ import static com.google.common.base.Preconditions.checkNotNull; ...@@ -35,20 +35,20 @@ import static com.google.common.base.Preconditions.checkNotNull;
35 */ 35 */
36 public class WaypointConstraint implements Constraint { 36 public class WaypointConstraint implements Constraint {
37 37
38 - private final List<ElementId> waypoints; 38 + private final List<DeviceId> waypoints;
39 39
40 /** 40 /**
41 * Creates a new waypoint constraint. 41 * Creates a new waypoint constraint.
42 * 42 *
43 * @param waypoints waypoints 43 * @param waypoints waypoints
44 */ 44 */
45 - public WaypointConstraint(ElementId... waypoints) { 45 + public WaypointConstraint(DeviceId... waypoints) {
46 checkNotNull(waypoints, "waypoints cannot be null"); 46 checkNotNull(waypoints, "waypoints cannot be null");
47 checkArgument(waypoints.length > 0, "length of waypoints should be more than 0"); 47 checkArgument(waypoints.length > 0, "length of waypoints should be more than 0");
48 this.waypoints = ImmutableList.copyOf(waypoints); 48 this.waypoints = ImmutableList.copyOf(waypoints);
49 } 49 }
50 50
51 - public List<ElementId> waypoints() { 51 + public List<DeviceId> waypoints() {
52 return waypoints; 52 return waypoints;
53 } 53 }
54 54
...@@ -60,8 +60,8 @@ public class WaypointConstraint implements Constraint { ...@@ -60,8 +60,8 @@ public class WaypointConstraint implements Constraint {
60 60
61 @Override 61 @Override
62 public boolean validate(Path path, LinkResourceService resourceService) { 62 public boolean validate(Path path, LinkResourceService resourceService) {
63 - LinkedList<ElementId> waypoints = new LinkedList<>(this.waypoints); 63 + LinkedList<DeviceId> waypoints = new LinkedList<>(this.waypoints);
64 - ElementId current = waypoints.poll(); 64 + DeviceId current = waypoints.poll();
65 // This is safe because Path class ensures the number of links are more than 0 65 // This is safe because Path class ensures the number of links are more than 0
66 Link firstLink = path.links().get(0); 66 Link firstLink = path.links().get(0);
67 if (firstLink.src().elementId().equals(current)) { 67 if (firstLink.src().elementId().equals(current)) {
......