Sho SHIMIZU
Committed by Ray Milkey

Add missing getter for waypoints and unit test for equality

Change-Id: If6ca25bd4459c32e30467991039bbbe36f2256f2
......@@ -48,6 +48,10 @@ public class WaypointConstraint implements Constraint {
this.waypoints = ImmutableList.copyOf(waypoints);
}
public List<ElementId> waypoints() {
return waypoints;
}
@Override
public double cost(Link link, LinkResourceService resourceService) {
// Always consider the number of hops
......
......@@ -15,6 +15,7 @@
*/
package org.onlab.onos.net.intent.constraint;
import com.google.common.testing.EqualsTester;
import org.junit.Before;
import org.junit.Test;
import org.onlab.onos.net.DefaultLink;
......@@ -22,6 +23,7 @@ import org.onlab.onos.net.DefaultPath;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.intent.Constraint;
import org.onlab.onos.net.provider.ProviderId;
import org.onlab.onos.net.resource.LinkResourceService;
......@@ -84,4 +86,19 @@ public class WaypointConstraintTest {
assertThat(sut.validate(path, linkResourceService), is(false));
}
@Test
public void testEquality() {
Constraint c1 = new WaypointConstraint(DID1, DID2);
Constraint c2 = new WaypointConstraint(DID1, DID2);
Constraint c3 = new WaypointConstraint(DID2);
Constraint c4 = new WaypointConstraint(DID3);
new EqualsTester()
.addEqualityGroup(c1, c2)
.addEqualityGroup(c3)
.addEqualityGroup(c4)
.testEquals();
}
}
......