alshabib

Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next

package org.onlab.onos.net;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.onos.net.link.LinkDescription;
import com.google.common.base.MoreObjects;
// TODO Consider renaming.
......@@ -10,7 +14,7 @@ import com.google.common.base.MoreObjects;
/**
* Immutable representation of a link identity.
*/
public class LinkKey {
public final class LinkKey {
private final ConnectPoint src;
private final ConnectPoint dst;
......@@ -39,18 +43,40 @@ public class LinkKey {
* @param src source connection point
* @param dst destination connection point
*/
public LinkKey(ConnectPoint src, ConnectPoint dst) {
this.src = src;
this.dst = dst;
private LinkKey(ConnectPoint src, ConnectPoint dst) {
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
}
/**
* Creates a link identifier with source and destination connection point.
*
* @param src source connection point
* @param dst destination connection point
* @return a link identifier
*/
public static LinkKey linkKey(ConnectPoint src, ConnectPoint dst) {
return new LinkKey(src, dst);
}
/**
* Creates a link identifier for the specified link.
*
* @param link link descriptor
* @return a link identifier
*/
public static LinkKey linkKey(Link link) {
return new LinkKey(link.src(), link.dst());
}
/**
* Creates a link identifier for the specified link.
*
* @param desc link description
* @return a link identifier
*/
public LinkKey(Link link) {
this(link.src(), link.dst());
public static LinkKey linkKey(LinkDescription desc) {
return new LinkKey(desc.src(), desc.dst());
}
@Override
......@@ -65,7 +91,7 @@ public class LinkKey {
}
if (obj instanceof LinkKey) {
final LinkKey other = (LinkKey) obj;
return Objects.equals(this.src(), other.src()) &&
return Objects.equals(this.src, other.src) &&
Objects.equals(this.dst, other.dst);
}
return false;
......@@ -74,7 +100,7 @@ public class LinkKey {
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("src", src())
.add("src", src)
.add("dst", dst)
.toString();
}
......
package org.onlab.onos.net.host;
import org.onlab.onos.store.Timestamp;
import org.onlab.packet.MacAddress;
/**
* Interface for a logical clock service that issues per host timestamps.
*/
public interface HostClockService {
/**
* Returns a new timestamp for the specified host mac address.
* @param hostMac host MAC address.
* @return timestamp.
*/
public Timestamp getTimestamp(MacAddress hostMac);
}
......@@ -28,6 +28,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.onlab.onos.net.link.LinkEvent.Type.LINK_REMOVED;
import static org.onlab.onos.net.LinkKey.linkKey;
import static org.onlab.util.Tools.namedThreads;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -82,14 +83,14 @@ public class ObjectiveTracker implements ObjectiveTrackerService {
@Override
public void addTrackedResources(IntentId intentId, Collection<Link> resources) {
for (Link link : resources) {
intentsByLink.put(new LinkKey(link), intentId);
intentsByLink.put(linkKey(link), intentId);
}
}
@Override
public void removeTrackedResources(IntentId intentId, Collection<Link> resources) {
for (Link link : resources) {
intentsByLink.remove(new LinkKey(link), intentId);
intentsByLink.remove(linkKey(link), intentId);
}
}
......@@ -125,7 +126,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService {
if (reason instanceof LinkEvent) {
LinkEvent linkEvent = (LinkEvent) reason;
if (linkEvent.type() == LINK_REMOVED) {
Set<IntentId> intentIds = intentsByLink.get(new LinkKey(linkEvent.subject()));
Set<IntentId> intentIds = intentsByLink.get(linkKey(linkEvent.subject()));
toBeRecompiled.addAll(intentIds);
}
recompileOnly = recompileOnly && linkEvent.type() == LINK_REMOVED;
......
......@@ -1090,7 +1090,7 @@ public class GossipDeviceStore
.toList();
if (nodeIds.size() == 1 && nodeIds.get(0).equals(self)) {
log.info("No other peers in the cluster.");
log.debug("No other peers in the cluster.");
return;
}
......
package org.onlab.onos.store.host.impl;
import static org.slf4j.LoggerFactory.getLogger;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.net.host.HostClockService;
import org.onlab.onos.store.Timestamp;
import org.onlab.onos.store.impl.WallClockTimestamp;
import org.onlab.packet.MacAddress;
import org.slf4j.Logger;
/**
* HostClockService to issue Timestamps based on local wallclock time.
*/
@Component(immediate = true)
@Service
public class HostClockManager implements HostClockService {
private final Logger log = getLogger(getClass());
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
log.info("Stopped");
}
@Override
public Timestamp getTimestamp(MacAddress hostMac) {
return new WallClockTimestamp();
}
}
......@@ -10,8 +10,12 @@ import com.google.common.base.MoreObjects;
import com.google.common.collect.ComparisonChain;
/**
* Default implementation of Timestamp.
* TODO: Better documentation.
* A logical timestamp that derives its value from two things:
* <ul>
* <li> The current mastership term of the device.</li>
* <li> The value of the counter used for tracking topology events observed from
* the device during that current time of a device. </li>
* </ul>
*/
public final class MastershipBasedTimestamp implements Timestamp {
......
package org.onlab.onos.store.impl;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Objects;
import org.onlab.onos.store.Timestamp;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ComparisonChain;
/**
* A Timestamp that derives its value from the prevailing
* wallclock time on the controller where it is generated.
*/
public class WallClockTimestamp implements Timestamp {
private final long unixTimestamp;
public WallClockTimestamp() {
unixTimestamp = System.currentTimeMillis();
}
@Override
public int compareTo(Timestamp o) {
checkArgument(o instanceof WallClockTimestamp,
"Must be WallClockTimestamp", o);
WallClockTimestamp that = (WallClockTimestamp) o;
return ComparisonChain.start()
.compare(this.unixTimestamp, that.unixTimestamp)
.result();
}
@Override
public int hashCode() {
return Objects.hash(unixTimestamp);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof WallClockTimestamp)) {
return false;
}
WallClockTimestamp that = (WallClockTimestamp) obj;
return Objects.equals(this.unixTimestamp, that.unixTimestamp);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("unixTimestamp", unixTimestamp)
.toString();
}
/**
* Returns the unixTimestamp.
*
* @return unix timestamp
*/
public long unixTimestamp() {
return unixTimestamp;
}
}
......@@ -67,6 +67,7 @@ import static org.onlab.onos.net.DefaultAnnotations.union;
import static org.onlab.onos.net.DefaultAnnotations.merge;
import static org.onlab.onos.net.Link.Type.DIRECT;
import static org.onlab.onos.net.Link.Type.INDIRECT;
import static org.onlab.onos.net.LinkKey.linkKey;
import static org.onlab.onos.net.link.LinkEvent.Type.*;
import static org.onlab.util.Tools.namedThreads;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -203,7 +204,7 @@ public class GossipLinkStore
@Override
public Link getLink(ConnectPoint src, ConnectPoint dst) {
return links.get(new LinkKey(src, dst));
return links.get(linkKey(src, dst));
}
@Override
......@@ -237,14 +238,20 @@ public class GossipLinkStore
final Timestamped<LinkDescription> deltaDesc = new Timestamped<>(linkDescription, newTimestamp);
LinkEvent event = createOrUpdateLinkInternal(providerId, deltaDesc);
LinkKey key = linkKey(linkDescription);
final LinkEvent event;
final Timestamped<LinkDescription> mergedDesc;
synchronized (getLinkDescriptions(key)) {
event = createOrUpdateLinkInternal(providerId, deltaDesc);
mergedDesc = getLinkDescriptions(key).get(providerId);
}
if (event != null) {
log.info("Notifying peers of a link update topology event from providerId: "
+ "{} between src: {} and dst: {}",
providerId, linkDescription.src(), linkDescription.dst());
try {
notifyPeers(new InternalLinkEvent(providerId, deltaDesc));
notifyPeers(new InternalLinkEvent(providerId, mergedDesc));
} catch (IOException e) {
log.info("Failed to notify peers of a link update topology event from providerId: "
+ "{} between src: {} and dst: {}",
......@@ -258,7 +265,7 @@ public class GossipLinkStore
ProviderId providerId,
Timestamped<LinkDescription> linkDescription) {
LinkKey key = new LinkKey(linkDescription.value().src(), linkDescription.value().dst());
LinkKey key = linkKey(linkDescription.value());
ConcurrentMap<ProviderId, Timestamped<LinkDescription>> descs = getLinkDescriptions(key);
synchronized (descs) {
......@@ -351,7 +358,7 @@ public class GossipLinkStore
@Override
public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) {
final LinkKey key = new LinkKey(src, dst);
final LinkKey key = linkKey(src, dst);
DeviceId dstDeviceId = dst.deviceId();
Timestamp timestamp = deviceClockService.getTimestamp(dstDeviceId);
......@@ -538,7 +545,7 @@ public class GossipLinkStore
.toList();
if (nodeIds.size() == 1 && nodeIds.get(0).equals(self)) {
log.info("No other peers in the cluster.");
log.debug("No other peers in the cluster.");
return;
}
......
package org.onlab.onos.store.impl;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import org.junit.Test;
import org.onlab.onos.store.Timestamp;
import org.onlab.util.KryoPool;
import com.google.common.testing.EqualsTester;
/**
* Tests for {@link WallClockTimestamp}.
*/
public class WallClockTimestampTest {
@Test
public final void testBasic() throws InterruptedException {
WallClockTimestamp ts1 = new WallClockTimestamp();
Thread.sleep(50);
WallClockTimestamp ts2 = new WallClockTimestamp();
assertTrue(ts1.compareTo(ts1) == 0);
assertTrue(ts2.compareTo(ts1) > 0);
assertTrue(ts1.compareTo(ts2) < 0);
}
@Test
public final void testKryoSerializable() {
WallClockTimestamp ts1 = new WallClockTimestamp();
final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
final KryoPool kryos = KryoPool.newBuilder()
.register(WallClockTimestamp.class)
.build();
kryos.serialize(ts1, buffer);
buffer.flip();
Timestamp copy = kryos.deserialize(buffer);
new EqualsTester()
.addEqualityGroup(ts1, copy)
.testEquals();
}
}
......@@ -3,6 +3,7 @@ package org.onlab.onos.store.link.impl;
import static com.google.common.cache.CacheBuilder.newBuilder;
import static org.onlab.onos.net.Link.Type.DIRECT;
import static org.onlab.onos.net.Link.Type.INDIRECT;
import static org.onlab.onos.net.LinkKey.linkKey;
import static org.onlab.onos.net.link.LinkEvent.Type.LINK_ADDED;
import static org.onlab.onos.net.link.LinkEvent.Type.LINK_REMOVED;
import static org.onlab.onos.net.link.LinkEvent.Type.LINK_UPDATED;
......@@ -122,7 +123,7 @@ public class DistributedLinkStore
@Override
public Link getLink(ConnectPoint src, ConnectPoint dst) {
return links.getUnchecked(new LinkKey(src, dst)).orNull();
return links.getUnchecked(linkKey(src, dst)).orNull();
}
@Override
......@@ -150,7 +151,7 @@ public class DistributedLinkStore
@Override
public LinkEvent createOrUpdateLink(ProviderId providerId,
LinkDescription linkDescription) {
LinkKey key = new LinkKey(linkDescription.src(), linkDescription.dst());
LinkKey key = linkKey(linkDescription);
Optional<DefaultLink> link = links.getUnchecked(key);
if (!link.isPresent()) {
return createLink(providerId, key, linkDescription);
......@@ -216,7 +217,7 @@ public class DistributedLinkStore
@Override
public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) {
synchronized (this) {
LinkKey key = new LinkKey(src, dst);
LinkKey key = linkKey(src, dst);
byte[] keyBytes = serialize(key);
Link link = deserialize(rawLinks.remove(keyBytes));
links.invalidate(key);
......
......@@ -3,6 +3,7 @@ package org.onlab.onos.store.link.impl;
import static org.junit.Assert.*;
import static org.onlab.onos.net.DeviceId.deviceId;
import static org.onlab.onos.net.Link.Type.*;
import static org.onlab.onos.net.LinkKey.linkKey;
import static org.onlab.onos.net.link.LinkEvent.Type.*;
import java.util.HashMap;
......@@ -122,8 +123,8 @@ public class DistributedLinkStoreTest {
assertEquals("initialy empty", 0,
Iterables.size(linkStore.getLinks()));
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId1 = linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -134,7 +135,7 @@ public class DistributedLinkStoreTest {
Map<LinkKey, Link> links = new HashMap<>();
for (Link link : linkStore.getLinks()) {
links.put(new LinkKey(link.src(), link.dst()), link);
links.put(linkKey(link), link);
}
assertLink(linkId1, DIRECT, links.get(linkId1));
......@@ -143,9 +144,9 @@ public class DistributedLinkStoreTest {
@Test
public final void testGetDeviceEgressLinks() {
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -166,9 +167,9 @@ public class DistributedLinkStoreTest {
@Test
public final void testGetDeviceIngressLinks() {
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -191,7 +192,7 @@ public class DistributedLinkStoreTest {
public final void testGetLink() {
ConnectPoint src = new ConnectPoint(DID1, P1);
ConnectPoint dst = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(src, dst);
LinkKey linkId1 = linkKey(src, dst);
putLink(linkId1, DIRECT);
......@@ -206,9 +207,9 @@ public class DistributedLinkStoreTest {
public final void testGetEgressLinks() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = linkKey(d1P1, d2P2);
LinkKey linkId2 = linkKey(d2P2, d1P1);
LinkKey linkId3 = linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -231,9 +232,9 @@ public class DistributedLinkStoreTest {
public final void testGetIngressLinks() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = linkKey(d1P1, d2P2);
LinkKey linkId2 = linkKey(d2P2, d1P1);
LinkKey linkId3 = linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -282,8 +283,8 @@ public class DistributedLinkStoreTest {
public final void testRemoveLink() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId1 = linkKey(d1P1, d2P2);
LinkKey linkId2 = linkKey(d2P2, d1P1);
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -306,7 +307,7 @@ public class DistributedLinkStoreTest {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
final LinkKey linkId1 = new LinkKey(d1P1, d2P2);
final LinkKey linkId1 = linkKey(d1P1, d2P2);
final CountDownLatch addLatch = new CountDownLatch(1);
LinkStoreDelegate checkAdd = new LinkStoreDelegate() {
......
......@@ -31,6 +31,6 @@ public class LinkKeySerializer extends Serializer<LinkKey> {
public LinkKey read(Kryo kryo, Input input, Class<LinkKey> type) {
ConnectPoint src = (ConnectPoint) kryo.readClassAndObject(input);
ConnectPoint dst = (ConnectPoint) kryo.readClassAndObject(input);
return new LinkKey(src, dst);
return LinkKey.linkKey(src, dst);
}
}
......
......@@ -108,7 +108,7 @@ public class KryoSerializerTest {
testSerialized(ImmutableSet.of());
testSerialized(IpPrefix.valueOf("192.168.0.1/24"));
testSerialized(IpAddress.valueOf("192.168.0.1"));
testSerialized(new LinkKey(CP1, CP2));
testSerialized(LinkKey.linkKey(CP1, CP2));
testSerialized(new NodeId("SomeNodeIdentifier"));
testSerialized(P1);
testSerialized(PID);
......
......@@ -42,6 +42,7 @@ import static org.onlab.onos.net.DefaultAnnotations.union;
import static org.onlab.onos.net.DefaultAnnotations.merge;
import static org.onlab.onos.net.Link.Type.DIRECT;
import static org.onlab.onos.net.Link.Type.INDIRECT;
import static org.onlab.onos.net.LinkKey.linkKey;
import static org.onlab.onos.net.link.LinkEvent.Type.*;
import static org.slf4j.LoggerFactory.getLogger;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
......@@ -120,7 +121,7 @@ public class SimpleLinkStore
@Override
public Link getLink(ConnectPoint src, ConnectPoint dst) {
return links.get(new LinkKey(src, dst));
return links.get(linkKey(src, dst));
}
@Override
......@@ -148,7 +149,7 @@ public class SimpleLinkStore
@Override
public LinkEvent createOrUpdateLink(ProviderId providerId,
LinkDescription linkDescription) {
LinkKey key = new LinkKey(linkDescription.src(), linkDescription.dst());
LinkKey key = linkKey(linkDescription);
ConcurrentMap<ProviderId, LinkDescription> descs = getLinkDescriptions(key);
synchronized (descs) {
......@@ -225,7 +226,7 @@ public class SimpleLinkStore
@Override
public LinkEvent removeLink(ConnectPoint src, ConnectPoint dst) {
final LinkKey key = new LinkKey(src, dst);
final LinkKey key = linkKey(src, dst);
ConcurrentMap<ProviderId, LinkDescription> descs = getLinkDescriptions(key);
synchronized (descs) {
Link link = links.remove(key);
......
......@@ -136,8 +136,8 @@ public class SimpleLinkStoreTest {
assertEquals("initialy empty", 0,
Iterables.size(linkStore.getLinks()));
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId1 = LinkKey.linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = LinkKey.linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -148,7 +148,7 @@ public class SimpleLinkStoreTest {
Map<LinkKey, Link> links = new HashMap<>();
for (Link link : linkStore.getLinks()) {
links.put(new LinkKey(link.src(), link.dst()), link);
links.put(LinkKey.linkKey(link), link);
}
assertLink(linkId1, DIRECT, links.get(linkId1));
......@@ -157,9 +157,9 @@ public class SimpleLinkStoreTest {
@Test
public final void testGetDeviceEgressLinks() {
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = LinkKey.linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = LinkKey.linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = LinkKey.linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -180,9 +180,9 @@ public class SimpleLinkStoreTest {
@Test
public final void testGetDeviceIngressLinks() {
LinkKey linkId1 = new LinkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = new LinkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = LinkKey.linkKey(new ConnectPoint(DID1, P1), new ConnectPoint(DID2, P2));
LinkKey linkId2 = LinkKey.linkKey(new ConnectPoint(DID2, P2), new ConnectPoint(DID1, P1));
LinkKey linkId3 = LinkKey.linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -205,7 +205,7 @@ public class SimpleLinkStoreTest {
public final void testGetLink() {
ConnectPoint src = new ConnectPoint(DID1, P1);
ConnectPoint dst = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(src, dst);
LinkKey linkId1 = LinkKey.linkKey(src, dst);
putLink(linkId1, DIRECT);
......@@ -220,9 +220,9 @@ public class SimpleLinkStoreTest {
public final void testGetEgressLinks() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2);
LinkKey linkId2 = LinkKey.linkKey(d2P2, d1P1);
LinkKey linkId3 = LinkKey.linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -245,9 +245,9 @@ public class SimpleLinkStoreTest {
public final void testGetIngressLinks() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId3 = new LinkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2);
LinkKey linkId2 = LinkKey.linkKey(d2P2, d1P1);
LinkKey linkId3 = LinkKey.linkKey(new ConnectPoint(DID1, P2), new ConnectPoint(DID2, P3));
putLink(linkId1, DIRECT);
putLink(linkId2, DIRECT);
......@@ -349,8 +349,8 @@ public class SimpleLinkStoreTest {
public final void testRemoveLink() {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
LinkKey linkId1 = new LinkKey(d1P1, d2P2);
LinkKey linkId2 = new LinkKey(d2P2, d1P1);
LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2);
LinkKey linkId2 = LinkKey.linkKey(d2P2, d1P1);
putLink(linkId1, DIRECT, A1);
putLink(linkId2, DIRECT, A2);
......@@ -406,7 +406,7 @@ public class SimpleLinkStoreTest {
final ConnectPoint d1P1 = new ConnectPoint(DID1, P1);
final ConnectPoint d2P2 = new ConnectPoint(DID2, P2);
final LinkKey linkId1 = new LinkKey(d1P1, d2P2);
final LinkKey linkId1 = LinkKey.linkKey(d1P1, d2P2);
final CountDownLatch addLatch = new CountDownLatch(1);
LinkStoreDelegate checkAdd = new LinkStoreDelegate() {
......