Ray Milkey
Committed by Gerrit Code Review

Add a builder for DefaultLink to hide multiplying constructors

Change-Id: Iaf073d07989c398a8f44541ffdb8dd93e5715162
Showing 30 changed files with 363 additions and 88 deletions
......@@ -342,8 +342,13 @@ public class EcmpShortestPathGraph {
private Link copyDefaultLink(Link link) {
DefaultLink src = (DefaultLink) link;
DefaultLink defaultLink = new DefaultLink(src.providerId(), src.src(),
src.dst(), src.type(), src.annotations());
DefaultLink defaultLink = DefaultLink.builder()
.providerId(src.providerId())
.src(src.src())
.dst(src.dst())
.type(src.type())
.annotations(src.annotations())
.build();
return defaultLink;
}
......
......@@ -21,6 +21,9 @@ import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import static org.onosproject.net.Link.State.ACTIVE;
import static org.onosproject.net.DefaultAnnotations.EMPTY;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Default infrastructure link model implementation.
......@@ -42,7 +45,7 @@ public class DefaultLink extends AbstractModel implements Link {
* @param type link type
* @param annotations optional key/value annotations
*/
public DefaultLink(ProviderId providerId, ConnectPoint src, ConnectPoint dst,
protected DefaultLink(ProviderId providerId, ConnectPoint src, ConnectPoint dst,
Type type, Annotations... annotations) {
this(providerId, src, dst, type, ACTIVE, false, annotations);
}
......@@ -60,7 +63,7 @@ public class DefaultLink extends AbstractModel implements Link {
* @param isExpected indicates if the link is preconfigured
* @param annotations optional key/value annotations
*/
public DefaultLink(ProviderId providerId, ConnectPoint src, ConnectPoint dst,
private DefaultLink(ProviderId providerId, ConnectPoint src, ConnectPoint dst,
Type type, State state,
boolean isExpected, Annotations... annotations) {
super(providerId, annotations);
......@@ -129,8 +132,130 @@ public class DefaultLink extends AbstractModel implements Link {
.add("dst", dst)
.add("type", type)
.add("state", state)
.add("configured", isExpected)
.add("expected", isExpected)
.toString();
}
/**
* Creates a new default link builder.
*
* @return default link builder
*/
public static Builder builder() {
return new Builder();
}
/**
* Builder for DefaultLink objects.
*/
public static final class Builder {
private ProviderId providerId;
private Annotations annotations = EMPTY;
private ConnectPoint src;
private ConnectPoint dst;
private Type type;
private State state = ACTIVE;
private boolean isExpected = false;
private Builder() {
// Hide constructor
}
/**
* Sets the providerId to be used by the builder.
*
* @param providerId new provider id
* @return self
*/
public Builder providerId(ProviderId providerId) {
this.providerId = providerId;
return this;
}
/**
* Sets the annotations to be used by the builder.
*
* @param annotations new annotations
* @return self
*/
public Builder annotations(Annotations annotations) {
this.annotations = annotations;
return this;
}
/**
* Sets the source connect point to be used by the builder.
*
* @param src source connect point
* @return self
*/
public Builder src(ConnectPoint src) {
this.src = src;
return this;
}
/**
* Sets the destination connect point to be used by the builder.
*
* @param dst new destination connect point
* @return self
*/
public Builder dst(ConnectPoint dst) {
this.dst = dst;
return this;
}
/**
* Sets the link type to be used by the builder.
*
* @param type new link type
* @return self
*/
public Builder type(Type type) {
this.type = type;
return this;
}
/**
* Sets the link state to be used by the builder.
*
* @param state new link state
* @return self
*/
public Builder state(State state) {
this.state = state;
return this;
}
/**
* Sets the expected flag to be used by the builder.
*
* @param isExpected new expected flag
* @return self
*/
public Builder isExpected(boolean isExpected) {
this.isExpected = isExpected;
return this;
}
/**
* Builds a default link object from the accumulated parameters.
*
* @return default link object
*/
public DefaultLink build() {
checkNotNull(src, "Source connect point cannot be null");
checkNotNull(dst, "Destination connect point cannot be null");
checkNotNull(type, "Type cannot be null");
checkNotNull(providerId, "Provider Id cannot be null");
return new DefaultLink(providerId, src, dst,
type, state,
isExpected, annotations);
}
}
}
......
......@@ -51,8 +51,18 @@ public class PathIntentTest extends ConnectivityIntentTest {
private final ConnectPoint cp2 = new ConnectPoint(device1, port2);
private final ConnectPoint cp3 = new ConnectPoint(device2, port3);
private final ConnectPoint cp4 = new ConnectPoint(device2, port4);
private final DefaultLink link1 = new DefaultLink(provider1, cp1, cp2, DIRECT);
private final DefaultLink link2 = new DefaultLink(provider1, cp1, cp2, DIRECT);
private final DefaultLink link1 = DefaultLink.builder()
.providerId(provider1)
.src(cp1)
.dst(cp2)
.type(DIRECT)
.build();
private final DefaultLink link2 = DefaultLink.builder()
.providerId(provider1)
.src(cp1)
.dst(cp2)
.type(DIRECT)
.build();
private final double cost = 1;
@Test
......
......@@ -59,7 +59,12 @@ public class AnnotationConstraintTest {
DefaultAnnotations annotations = DefaultAnnotations.builder().set(KEY, String.valueOf(VALUE)).build();
link = new DefaultLink(PID, cp(DID1, PID1), cp(DID2, PID2), DIRECT, annotations);
link = DefaultLink.builder()
.providerId(PID)
.src(cp(DID1, PID1))
.dst(cp(DID2, PID2))
.type(DIRECT)
.annotations(annotations).build();
}
/**
......
......@@ -69,8 +69,20 @@ public class LatencyConstraintTest {
Annotations annotations1 = DefaultAnnotations.builder().set(LATENCY, LATENCY1).build();
Annotations annotations2 = DefaultAnnotations.builder().set(LATENCY, LATENCY2).build();
link1 = new DefaultLink(PROVIDER_ID, cp(DID1, PN1), cp(DID2, PN2), DIRECT, annotations1);
link2 = new DefaultLink(PROVIDER_ID, cp(DID2, PN3), cp(DID3, PN4), DIRECT, annotations2);
link1 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID1, PN1))
.dst(cp(DID2, PN2))
.type(DIRECT)
.annotations(annotations1)
.build();
link2 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID2, PN3))
.dst(cp(DID3, PN4))
.type(DIRECT)
.annotations(annotations2)
.build();
path = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), 10);
}
......
......@@ -62,8 +62,18 @@ public class ObstacleConstraintTest {
public void setUp() {
linkResourceService = createMock(LinkResourceService.class);
link1 = new DefaultLink(PROVIDER_ID, cp(DID1, PN1), cp(DID2, PN2), DIRECT);
link2 = new DefaultLink(PROVIDER_ID, cp(DID2, PN3), cp(DID3, PN4), DIRECT);
link1 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID1, PN1))
.dst(cp(DID2, PN2))
.type(DIRECT)
.build();
link2 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID2, PN3))
.dst(cp(DID3, PN4))
.type(DIRECT)
.build();
path = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), 10);
}
......
......@@ -62,8 +62,19 @@ public class WaypointConstraintTest {
public void setUp() {
linkResourceService = createMock(LinkResourceService.class);
link1 = new DefaultLink(PROVIDER_ID, cp(DID1, PN1), cp(DID2, PN2), DIRECT);
link2 = new DefaultLink(PROVIDER_ID, cp(DID2, PN3), cp(DID3, PN4), DIRECT);
link1 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID1, PN1))
.dst(cp(DID2, PN2))
.type(DIRECT)
.build();
link2 = DefaultLink.builder()
.providerId(PROVIDER_ID)
.src(cp(DID2, PN3))
.dst(cp(DID3, PN4))
.type(DIRECT)
.build();
path = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), 10);
}
......
......@@ -31,10 +31,12 @@ import static org.onosproject.net.PortNumber.portNumber;
public class LinkEventTest extends AbstractEventTest {
private Link createLink() {
return new DefaultLink(new ProviderId("of", "foo"),
new ConnectPoint(deviceId("of:foo"), portNumber(1)),
new ConnectPoint(deviceId("of:bar"), portNumber(2)),
Link.Type.INDIRECT);
return DefaultLink.builder()
.providerId(new ProviderId("of", "foo"))
.src(new ConnectPoint(deviceId("of:foo"), portNumber(1)))
.dst(new ConnectPoint(deviceId("of:bar"), portNumber(2)))
.type(Link.Type.INDIRECT)
.build();
}
@Test
......
......@@ -49,9 +49,19 @@ public class DefaultTopologyEdgeTest {
static final ProviderId PID = new ProviderId("foo", "bar");
/** D1:P1 -> D2:P1. */
static final Link L1 = new DefaultLink(PID, CP1, CP2, Link.Type.INDIRECT);
static final Link L1 = DefaultLink.builder()
.providerId(PID)
.src(CP1)
.dst(CP2)
.type(Link.Type.INDIRECT)
.build();
/** D2:P1 -> D1:P2. */
static final Link L2 = new DefaultLink(PID, CP3, CP4, Link.Type.INDIRECT);
static final Link L2 = DefaultLink.builder()
.providerId(PID)
.src(CP3)
.dst(CP4)
.type(Link.Type.INDIRECT)
.build();
@Test
public void basics() {
......
......@@ -75,6 +75,13 @@ public final class LinkCodec extends AnnotatedCodec<Link> {
Type type = Type.valueOf(json.get(TYPE).asText());
Annotations annotations = extractAnnotations(json, context);
return new DefaultLink(pid, src, dst, type, annotations);
return DefaultLink
.builder()
.providerId(pid)
.src(src)
.dst(dst)
.type(type)
.annotations(annotations)
.build();
}
}
......
......@@ -33,13 +33,15 @@ import org.onosproject.net.device.DeviceServiceAdapter;
*/
public class LinkCodecTest {
private final Link link = new DefaultLink(JsonCodecUtils.PID,
JsonCodecUtils.CP1,
JsonCodecUtils.CP2,
Link.Type.DIRECT,
Link.State.ACTIVE,
false,
JsonCodecUtils.A1);
private final Link link = DefaultLink.builder()
.providerId(JsonCodecUtils.PID)
.src(JsonCodecUtils.CP1)
.dst(JsonCodecUtils.CP2)
.type(Link.Type.DIRECT)
.state(Link.State.ACTIVE)
.isExpected(false)
.annotations(JsonCodecUtils.A1)
.build();
@Test
public void linkCodecTest() {
......
......@@ -122,9 +122,11 @@ public class DefaultTopologyTest {
// Short-hand for creating a link.
public static Link link(String src, int sp, String dst, int dp) {
return new DefaultLink(PID, new ConnectPoint(did(src), portNumber(sp)),
new ConnectPoint(did(dst), portNumber(dp)),
Link.Type.DIRECT);
return DefaultLink.builder().providerId(PID)
.src(new ConnectPoint(did(src), portNumber(sp)))
.dst(new ConnectPoint(did(dst), portNumber(dp)))
.type(Link.Type.DIRECT)
.build();
}
// Crates a new device with the specified id
......
......@@ -76,11 +76,13 @@ public class SimpleLinkResourceStoreTest {
.set(AnnotationKeys.OPTICAL_WAVES, "80")
.set(AnnotationKeys.BANDWIDTH, "1000")
.build();
return new DefaultLink(
new ProviderId("of", "foo"),
new ConnectPoint(deviceId(dev1), portNumber(port1)),
new ConnectPoint(deviceId(dev2), portNumber(port2)),
DIRECT, annotations);
return DefaultLink.builder()
.providerId(new ProviderId("of", "foo"))
.src(new ConnectPoint(deviceId(dev1), portNumber(port1)))
.dst(new ConnectPoint(deviceId(dev2), portNumber(port2)))
.type(DIRECT)
.annotations(annotations)
.build();
}
@Before
......
......@@ -196,11 +196,14 @@ public class SimpleLinkStore
if (link.isDurable()) {
return link.state() == INACTIVE ? null :
updateLink(linkKey(link.src(), link.dst()), link,
new DefaultLink(link.providerId(),
link.src(), link.dst(),
link.type(), INACTIVE,
link.isDurable(),
link.annotations()));
DefaultLink.builder()
.providerId(link.providerId())
.src(link.src())
.dst(link.dst())
.type(link.type())
.state(INACTIVE)
.isExpected(link.isExpected())
.annotations(link.annotations()).build());
}
return removeLink(src, dst);
}
......@@ -327,7 +330,15 @@ public class SimpleLinkStore
}
boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
return new DefaultLink(primary, src, dst, type, ACTIVE, isDurable, annotations);
return DefaultLink.builder()
.providerId(primary)
.src(src)
.dst(dst)
.type(type)
.state(ACTIVE)
.isExpected(isDurable)
.annotations(annotations)
.build();
}
private Map<ProviderId, LinkDescription> getOrCreateLinkDescriptions(LinkKey key) {
......
......@@ -88,8 +88,13 @@ public class HostToHostIntentCompiler
// Produces a reverse variant of the specified link.
private Link reverseLink(Link link) {
return new DefaultLink(link.providerId(), link.dst(), link.src(),
link.type(), link.state(), link.isDurable());
return DefaultLink.builder().providerId(link.providerId())
.src(link.dst())
.dst(link.src())
.type(link.type())
.state(link.state())
.isExpected(link.isExpected())
.build();
}
// Creates a path intent from the specified path and original connectivity intent.
......
......@@ -65,9 +65,9 @@ public class LinkCollectionIntentCompilerTest {
private final ConnectPoint d1p0 = connectPoint("s1", 10);
private final Set<Link> links = ImmutableSet.of(
new DefaultLink(PID, d1p1, d2p0, DIRECT),
new DefaultLink(PID, d2p1, d3p1, DIRECT),
new DefaultLink(PID, d1p1, d3p1, DIRECT));
DefaultLink.builder().providerId(PID).src(d1p1).dst(d2p0).type(DIRECT).build(),
DefaultLink.builder().providerId(PID).src(d2p1).dst(d3p1).type(DIRECT).build(),
DefaultLink.builder().providerId(PID).src(d1p1).dst(d3p1).type(DIRECT).build());
private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
......
......@@ -77,8 +77,8 @@ public class MplsPathIntentCompilerTest {
private final List<Link> links = Arrays.asList(
createEdgeLink(d1pi, true),
new DefaultLink(PID, d1p1, d2p0, DIRECT),
new DefaultLink(PID, d2p1, d3p1, DIRECT),
DefaultLink.builder().providerId(PID).src(d1p1).dst(d2p0).type(DIRECT).build(),
DefaultLink.builder().providerId(PID).src(d2p1).dst(d3p1).type(DIRECT).build(),
createEdgeLink(d3pe, false)
);
......
......@@ -64,8 +64,8 @@ public class OpticalPathIntentCompilerTest {
private final ConnectPoint d3p1 = connectPoint("s3", 1);
private final List<Link> links = Arrays.asList(
new DefaultLink(PID, d1p1, d2p0, DIRECT),
new DefaultLink(PID, d2p1, d3p1, DIRECT)
DefaultLink.builder().providerId(PID).src(d1p1).dst(d2p0).type(DIRECT).build(),
DefaultLink.builder().providerId(PID).src(d2p1).dst(d3p1).type(DIRECT).build()
);
private final int hops = links.size() + 1;
private OpticalPathIntent intent;
......
......@@ -84,8 +84,8 @@ public class PathIntentCompilerTest {
private final List<Link> links = Arrays.asList(
createEdgeLink(d1p0, true),
new DefaultLink(PID, d1p1, d2p0, DIRECT),
new DefaultLink(PID, d2p1, d3p1, DIRECT),
DefaultLink.builder().providerId(PID).src(d1p1).dst(d2p0).type(DIRECT).build(),
DefaultLink.builder().providerId(PID).src(d2p1).dst(d3p1).type(DIRECT).build(),
createEdgeLink(d3p0, false)
);
private final int hops = links.size() - 1;
......
......@@ -70,7 +70,8 @@ public class CompilingTest {
private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
private final ConnectPoint cp4 = new ConnectPoint(deviceId("2"), portNumber(2));
private final List<Link> links = Collections.singletonList(new DefaultLink(pid, cp2, cp4, DIRECT));
private final List<Link> links = Collections.singletonList(
DefaultLink.builder().providerId(pid).src(cp2).dst(cp4).type(DIRECT).build());
private final Path path = new DefaultPath(pid, links, 10);
private PointToPointIntent input;
......
......@@ -317,7 +317,15 @@ public class ECLinkStore
});
boolean isDurable = Objects.equals(annotations.get().value(AnnotationKeys.DURABLE), "true");
return new DefaultLink(baseProviderId, src, dst, type, ACTIVE, isDurable, annotations.get());
return DefaultLink.builder()
.providerId(baseProviderId)
.src(src)
.dst(dst)
.type(type)
.state(ACTIVE)
.isExpected(isDurable)
.annotations(annotations.get())
.build();
}
// Updates, if necessary the specified link and returns the appropriate event.
......@@ -346,11 +354,15 @@ public class ECLinkStore
// FIXME: this will not sync link state!!!
return link.state() == INACTIVE ? null :
updateLink(linkKey(link.src(), link.dst()), link,
new DefaultLink(link.providerId(),
link.src(), link.dst(),
link.type(), INACTIVE,
link.isDurable(),
link.annotations()));
DefaultLink.builder()
.providerId(link.providerId())
.src(link.src())
.dst(link.dst())
.type(link.type())
.state(INACTIVE)
.isExpected(link.isExpected())
.annotations(link.annotations())
.build());
}
return removeLink(src, dst);
}
......
......@@ -361,11 +361,15 @@ public class GossipLinkStore
// FIXME: this is not the right thing to call for the gossip store; will not sync link state!!!
return link.state() == INACTIVE ? null :
updateLink(linkKey(link.src(), link.dst()), link,
new DefaultLink(link.providerId(),
link.src(), link.dst(),
link.type(), INACTIVE,
link.isDurable(),
link.annotations()));
DefaultLink.builder()
.providerId(link.providerId())
.src(link.src())
.dst(link.dst())
.type(link.type())
.state(INACTIVE)
.isExpected(link.isExpected())
.annotations(link.annotations())
.build());
}
return removeLink(src, dst);
}
......@@ -605,7 +609,15 @@ public class GossipLinkStore
}
boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
return new DefaultLink(baseProviderId, src, dst, type, ACTIVE, isDurable, annotations);
return DefaultLink.builder()
.providerId(baseProviderId)
.src(src)
.dst(dst)
.type(type)
.state(ACTIVE)
.isExpected(isDurable)
.annotations(annotations)
.build();
}
private Map<ProviderId, Timestamped<LinkDescription>> getOrCreateLinkDescriptions(LinkKey key) {
......
......@@ -56,6 +56,13 @@ public class DefaultLinkSerializer extends Serializer<DefaultLink> {
Type linkType = (Type) kryo.readClassAndObject(input);
State state = (State) kryo.readClassAndObject(input);
boolean isDurable = input.readBoolean();
return new DefaultLink(providerId, src, dst, linkType, state, isDurable);
return DefaultLink.builder()
.providerId(providerId)
.src(src)
.dst(dst)
.type(linkType)
.state(state)
.isExpected(isDurable)
.build();
}
}
......
......@@ -183,8 +183,19 @@ public class KryoSerializerTest {
@Test
public void testDefaultLink() {
testSerializedEquals(new DefaultLink(PID, CP1, CP2, Link.Type.DIRECT));
testSerializedEquals(new DefaultLink(PID, CP1, CP2, Link.Type.DIRECT, A1));
testSerializedEquals(DefaultLink.builder()
.providerId(PID)
.src(CP1)
.dst(CP2)
.type(Link.Type.DIRECT)
.build());
testSerializedEquals(DefaultLink.builder()
.providerId(PID)
.src(CP1)
.dst(CP2)
.type(Link.Type.DIRECT)
.annotations(A1)
.build());
}
@Test
......@@ -367,7 +378,9 @@ public class KryoSerializerTest {
.addBandwidthRequest(32.195)
.build();
Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
allocations.put(new DefaultLink(PID, CP1, CP2, Type.DIRECT),
allocations.put(DefaultLink.builder()
.providerId(PID)
.src(CP1).dst(CP2).type(Type.DIRECT).build(),
ImmutableSet.of(new BandwidthResourceAllocation(new BandwidthResource(Bandwidth.bps(10.0))),
new LambdaResourceAllocation(LambdaResource.valueOf(1))));
testSerializable(new DefaultLinkResourceAllocations(request, allocations));
......
......@@ -55,6 +55,13 @@ public class OvsdbTunnelProviderTest {
private final TestTunnelRegistry tunnelRegistry = new TestTunnelRegistry();
private TestTunnelProviderService providerService;
Link link = DefaultLink.builder()
.providerId(this.provider.id())
.src(ConnectPoint.deviceConnectPoint("192.168.2.3/20"))
.dst(ConnectPoint.deviceConnectPoint("192.168.2.4/30"))
.type(Link.Type.DIRECT)
.build();
@Before
public void setUp() {
provider.providerRegistry = tunnelRegistry;
......@@ -75,11 +82,7 @@ public class OvsdbTunnelProviderTest {
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
Link link = new DefaultLink(
this.provider.id(),
ConnectPoint.deviceConnectPoint("192.168.2.3/20"),
ConnectPoint.deviceConnectPoint("192.168.2.4/30"),
Link.Type.DIRECT);
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
......@@ -104,11 +107,7 @@ public class OvsdbTunnelProviderTest {
.valueOf("192.168.1.3"));
SparseAnnotations annotations = DefaultAnnotations.builder()
.set("bandwidth", "1024").build();
Link link = new DefaultLink(
this.provider.id(),
ConnectPoint.deviceConnectPoint("192.168.2.3/20"),
ConnectPoint.deviceConnectPoint("192.168.2.4/30"),
Link.Type.DIRECT);
List<Link> links = new ArrayList<Link>();
links.add(link);
TunnelDescription tunnel = new DefaultTunnelDescription(
......
......@@ -480,9 +480,12 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
// Short-hand for creating a link.
private Link link(PcepDpid src, long sp, PcepDpid dst, long dp) {
return new DefaultLink(id(), connectPoint(src, sp), connectPoint(dst,
dp),
Link.Type.TUNNEL);
return DefaultLink.builder()
.providerId(id())
.src(connectPoint(src, sp))
.dst(connectPoint(dst, dp))
.type(Link.Type.TUNNEL)
.build();
}
// Creates a path that leads through the given devices.
......@@ -1132,7 +1135,12 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
} else {
IpAddress dstIp = IpAddress.valueOf(ipv4SubObj.getIpAddress());
dst = new ConnectPoint(IpElementId.ipElement(dstIp), PortNumber.portNumber(0));
Link link = new DefaultLink(providerId, src, dst, Link.Type.DIRECT, EMPTY);
Link link = DefaultLink.builder()
.providerId(providerId)
.src(src)
.dst(dst)
.type(Link.Type.DIRECT)
.build();
links.add(link);
src = dst;
}
......
......@@ -84,7 +84,8 @@ public class PcepReleaseTunnelProviderTest {
ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
Link link = new DefaultLink(pid, src, dst, Link.Type.DIRECT, EMPTY);
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
links.add(link);
path = new DefaultPath(pid, links, 20, EMPTY);
......
......@@ -80,7 +80,8 @@ public class PcepSetupTunnelProviderTest {
ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
Link link = new DefaultLink(pid, src, dst, Link.Type.DIRECT, EMPTY);
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
links.add(link);
path = new DefaultPath(pid, links, 10, EMPTY);
......
......@@ -79,7 +79,8 @@ public class PcepTunnelProviderTest {
ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
Link link = new DefaultLink(pid, src, dst, Link.Type.DIRECT, EMPTY);
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
links.add(link);
path = new DefaultPath(pid, links, 10, EMPTY);
......
......@@ -83,7 +83,8 @@ public class PcepUpdateTunnelProviderTest {
ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
Link link = new DefaultLink(pid, src, dst, Link.Type.DIRECT, EMPTY);
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
links.add(link);
path = new DefaultPath(pid, links, 20, EMPTY);
......