Committed by
Gerrit Code Review
fix for reactive forwarding failing in a
distributed setting. Change-Id: I992d62bbbd3d873bc8715419592951704903c49d making the ECHostStore respect sequentiality of events. Change-Id: I14fa65fc78742c3ea7d417cddefef9f171472246
Showing
6 changed files
with
82 additions
and
92 deletions
| ... | @@ -27,10 +27,10 @@ import org.apache.felix.scr.annotations.Reference; | ... | @@ -27,10 +27,10 @@ import org.apache.felix.scr.annotations.Reference; |
| 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 27 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 28 | import org.apache.felix.scr.annotations.Service; | 28 | import org.apache.felix.scr.annotations.Service; |
| 29 | import org.onosproject.event.AbstractListenerManager; | 29 | import org.onosproject.event.AbstractListenerManager; |
| 30 | -import org.onosproject.event.Event; | ||
| 31 | import org.onosproject.net.ConnectPoint; | 30 | import org.onosproject.net.ConnectPoint; |
| 32 | import org.onosproject.net.DeviceId; | 31 | import org.onosproject.net.DeviceId; |
| 33 | import org.onosproject.net.device.DeviceEvent; | 32 | import org.onosproject.net.device.DeviceEvent; |
| 33 | +import org.onosproject.net.device.DeviceListener; | ||
| 34 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
| 35 | import org.onosproject.net.edge.EdgePortEvent; | 35 | import org.onosproject.net.edge.EdgePortEvent; |
| 36 | import org.onosproject.net.edge.EdgePortListener; | 36 | import org.onosproject.net.edge.EdgePortListener; |
| ... | @@ -38,17 +38,16 @@ import org.onosproject.net.edge.EdgePortService; | ... | @@ -38,17 +38,16 @@ import org.onosproject.net.edge.EdgePortService; |
| 38 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 38 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 39 | import org.onosproject.net.flow.TrafficTreatment; | 39 | import org.onosproject.net.flow.TrafficTreatment; |
| 40 | import org.onosproject.net.link.LinkEvent; | 40 | import org.onosproject.net.link.LinkEvent; |
| 41 | +import org.onosproject.net.link.LinkListener; | ||
| 42 | +import org.onosproject.net.link.LinkService; | ||
| 41 | import org.onosproject.net.packet.DefaultOutboundPacket; | 43 | import org.onosproject.net.packet.DefaultOutboundPacket; |
| 42 | import org.onosproject.net.packet.OutboundPacket; | 44 | import org.onosproject.net.packet.OutboundPacket; |
| 43 | import org.onosproject.net.packet.PacketService; | 45 | import org.onosproject.net.packet.PacketService; |
| 44 | import org.onosproject.net.topology.Topology; | 46 | import org.onosproject.net.topology.Topology; |
| 45 | -import org.onosproject.net.topology.TopologyEvent; | ||
| 46 | -import org.onosproject.net.topology.TopologyListener; | ||
| 47 | import org.onosproject.net.topology.TopologyService; | 47 | import org.onosproject.net.topology.TopologyService; |
| 48 | import org.slf4j.Logger; | 48 | import org.slf4j.Logger; |
| 49 | 49 | ||
| 50 | import java.nio.ByteBuffer; | 50 | import java.nio.ByteBuffer; |
| 51 | -import java.util.List; | ||
| 52 | import java.util.Map; | 51 | import java.util.Map; |
| 53 | import java.util.Optional; | 52 | import java.util.Optional; |
| 54 | import java.util.Set; | 53 | import java.util.Set; |
| ... | @@ -73,7 +72,9 @@ public class EdgeManager | ... | @@ -73,7 +72,9 @@ public class EdgeManager |
| 73 | 72 | ||
| 74 | private final Map<DeviceId, Set<ConnectPoint>> connectionPoints = Maps.newConcurrentMap(); | 73 | private final Map<DeviceId, Set<ConnectPoint>> connectionPoints = Maps.newConcurrentMap(); |
| 75 | 74 | ||
| 76 | - private final TopologyListener topologyListener = new InnerTopologyListener(); | 75 | + private final LinkListener linkListener = new InnerLinkListener(); |
| 76 | + | ||
| 77 | + private final DeviceListener deviceListener = new InnerDeviceListener(); | ||
| 77 | 78 | ||
| 78 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 79 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 79 | protected PacketService packetService; | 80 | protected PacketService packetService; |
| ... | @@ -84,17 +85,23 @@ public class EdgeManager | ... | @@ -84,17 +85,23 @@ public class EdgeManager |
| 84 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 85 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 85 | protected TopologyService topologyService; | 86 | protected TopologyService topologyService; |
| 86 | 87 | ||
| 88 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 89 | + protected LinkService linkService; | ||
| 90 | + | ||
| 87 | @Activate | 91 | @Activate |
| 88 | public void activate() { | 92 | public void activate() { |
| 89 | eventDispatcher.addSink(EdgePortEvent.class, listenerRegistry); | 93 | eventDispatcher.addSink(EdgePortEvent.class, listenerRegistry); |
| 90 | - topologyService.addListener(topologyListener); | 94 | + deviceService.addListener(deviceListener); |
| 95 | + linkService.addListener(linkListener); | ||
| 96 | + loadAllEdgePorts(); | ||
| 91 | log.info("Started"); | 97 | log.info("Started"); |
| 92 | } | 98 | } |
| 93 | 99 | ||
| 94 | @Deactivate | 100 | @Deactivate |
| 95 | public void deactivate() { | 101 | public void deactivate() { |
| 96 | eventDispatcher.removeSink(EdgePortEvent.class); | 102 | eventDispatcher.removeSink(EdgePortEvent.class); |
| 97 | - topologyService.removeListener(topologyListener); | 103 | + deviceService.removeListener(deviceListener); |
| 104 | + linkService.removeListener(linkListener); | ||
| 98 | log.info("Stopped"); | 105 | log.info("Stopped"); |
| 99 | } | 106 | } |
| 100 | 107 | ||
| ... | @@ -142,31 +149,27 @@ public class EdgeManager | ... | @@ -142,31 +149,27 @@ public class EdgeManager |
| 142 | return new DefaultOutboundPacket(point.deviceId(), builder.build(), data); | 149 | return new DefaultOutboundPacket(point.deviceId(), builder.build(), data); |
| 143 | } | 150 | } |
| 144 | 151 | ||
| 145 | - // Internal listener for topo events used to keep our edge-port cache | 152 | + private class InnerLinkListener implements LinkListener { |
| 146 | - // up to date. | 153 | + |
| 147 | - private class InnerTopologyListener implements TopologyListener { | ||
| 148 | @Override | 154 | @Override |
| 149 | - public void event(TopologyEvent event) { | 155 | + public void event(LinkEvent event) { |
| 150 | - topology = event.subject(); | 156 | + topology = topologyService.currentTopology(); |
| 151 | - List<Event> triggers = event.reasons(); | 157 | + processLinkEvent(event); |
| 152 | - if (triggers != null) { | 158 | + } |
| 153 | - triggers.forEach(reason -> { | 159 | + } |
| 154 | - if (reason instanceof DeviceEvent) { | 160 | + |
| 155 | - processDeviceEvent((DeviceEvent) reason); | 161 | + private class InnerDeviceListener implements DeviceListener { |
| 156 | - } else if (reason instanceof LinkEvent) { | 162 | + |
| 157 | - processLinkEvent((LinkEvent) reason); | 163 | + @Override |
| 158 | - } | 164 | + public void event(DeviceEvent event) { |
| 159 | - }); | 165 | + topology = topologyService.currentTopology(); |
| 160 | - } else { | 166 | + processDeviceEvent(event); |
| 161 | - //FIXME special case of preexisting edgeport & no triggerless events could cause this to never hit and | ||
| 162 | - //never discover an edgeport that should have been discovered. | ||
| 163 | - loadAllEdgePorts(); | ||
| 164 | - } | ||
| 165 | } | 167 | } |
| 166 | } | 168 | } |
| 167 | 169 | ||
| 168 | // Initial loading of the edge port cache. | 170 | // Initial loading of the edge port cache. |
| 169 | private void loadAllEdgePorts() { | 171 | private void loadAllEdgePorts() { |
| 172 | + topology = topologyService.currentTopology(); | ||
| 170 | deviceService.getAvailableDevices().forEach(d -> deviceService.getPorts(d.id()) | 173 | deviceService.getAvailableDevices().forEach(d -> deviceService.getPorts(d.id()) |
| 171 | .forEach(p -> addEdgePort(new ConnectPoint(d.id(), p.number())))); | 174 | .forEach(p -> addEdgePort(new ConnectPoint(d.id(), p.number())))); |
| 172 | } | 175 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -15,26 +15,8 @@ | ... | @@ -15,26 +15,8 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.store.host.impl; | 16 | package org.onosproject.store.host.impl; |
| 17 | 17 | ||
| 18 | -import static com.google.common.base.Preconditions.checkNotNull; | 18 | +import com.google.common.collect.ImmutableSet; |
| 19 | -import static com.google.common.base.Preconditions.checkState; | 19 | +import com.google.common.collect.Sets; |
| 20 | -import static org.onosproject.net.DefaultAnnotations.merge; | ||
| 21 | -import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED; | ||
| 22 | -import static org.onosproject.net.host.HostEvent.Type.HOST_MOVED; | ||
| 23 | -import static org.onosproject.net.host.HostEvent.Type.HOST_REMOVED; | ||
| 24 | -import static org.onosproject.net.host.HostEvent.Type.HOST_UPDATED; | ||
| 25 | -import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.PUT; | ||
| 26 | -import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.REMOVE; | ||
| 27 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 28 | - | ||
| 29 | -import java.util.Collection; | ||
| 30 | -import java.util.HashSet; | ||
| 31 | -import java.util.Map; | ||
| 32 | -import java.util.Objects; | ||
| 33 | -import java.util.Set; | ||
| 34 | -import java.util.concurrent.ConcurrentHashMap; | ||
| 35 | -import java.util.function.Predicate; | ||
| 36 | -import java.util.stream.Collectors; | ||
| 37 | - | ||
| 38 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
| 39 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
| 40 | import org.apache.felix.scr.annotations.Deactivate; | 22 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -60,22 +42,34 @@ import org.onosproject.net.host.HostStoreDelegate; | ... | @@ -60,22 +42,34 @@ import org.onosproject.net.host.HostStoreDelegate; |
| 60 | import org.onosproject.net.provider.ProviderId; | 42 | import org.onosproject.net.provider.ProviderId; |
| 61 | import org.onosproject.store.AbstractStore; | 43 | import org.onosproject.store.AbstractStore; |
| 62 | import org.onosproject.store.serializers.KryoNamespaces; | 44 | import org.onosproject.store.serializers.KryoNamespaces; |
| 63 | -import org.onosproject.store.service.EventuallyConsistentMap; | 45 | +import org.onosproject.store.service.ConsistentMap; |
| 64 | -import org.onosproject.store.service.EventuallyConsistentMapEvent; | 46 | +import org.onosproject.store.service.MapEvent; |
| 65 | -import org.onosproject.store.service.EventuallyConsistentMapListener; | 47 | +import org.onosproject.store.service.MapEventListener; |
| 66 | -import org.onosproject.store.service.LogicalClockService; | 48 | +import org.onosproject.store.service.Serializer; |
| 67 | import org.onosproject.store.service.StorageService; | 49 | import org.onosproject.store.service.StorageService; |
| 68 | import org.slf4j.Logger; | 50 | import org.slf4j.Logger; |
| 69 | 51 | ||
| 70 | -import com.google.common.collect.ImmutableSet; | 52 | +import java.util.Collection; |
| 71 | -import com.google.common.collect.Sets; | 53 | +import java.util.HashSet; |
| 54 | +import java.util.Map; | ||
| 55 | +import java.util.Objects; | ||
| 56 | +import java.util.Set; | ||
| 57 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 58 | +import java.util.function.Predicate; | ||
| 59 | +import java.util.stream.Collectors; | ||
| 60 | + | ||
| 61 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
| 62 | +import static com.google.common.base.Preconditions.checkState; | ||
| 63 | +import static org.onosproject.net.DefaultAnnotations.merge; | ||
| 64 | +import static org.onosproject.net.host.HostEvent.Type.*; | ||
| 65 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 72 | 66 | ||
| 73 | /** | 67 | /** |
| 74 | * Manages the inventory of hosts using a {@code EventuallyConsistentMap}. | 68 | * Manages the inventory of hosts using a {@code EventuallyConsistentMap}. |
| 75 | */ | 69 | */ |
| 76 | @Component(immediate = true) | 70 | @Component(immediate = true) |
| 77 | @Service | 71 | @Service |
| 78 | -public class ECHostStore | 72 | +public class DistributedHostStore |
| 79 | extends AbstractStore<HostEvent, HostStoreDelegate> | 73 | extends AbstractStore<HostEvent, HostStoreDelegate> |
| 80 | implements HostStore { | 74 | implements HostStore { |
| 81 | 75 | ||
| ... | @@ -84,15 +78,13 @@ public class ECHostStore | ... | @@ -84,15 +78,13 @@ public class ECHostStore |
| 84 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 78 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 85 | protected StorageService storageService; | 79 | protected StorageService storageService; |
| 86 | 80 | ||
| 87 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 81 | + private ConsistentMap<HostId, DefaultHost> host; |
| 88 | - protected LogicalClockService clockService; | 82 | + private Map<HostId, DefaultHost> hosts; |
| 89 | - | ||
| 90 | - private EventuallyConsistentMap<HostId, DefaultHost> hosts; | ||
| 91 | 83 | ||
| 92 | private final ConcurrentHashMap<HostId, DefaultHost> prevHosts = | 84 | private final ConcurrentHashMap<HostId, DefaultHost> prevHosts = |
| 93 | new ConcurrentHashMap<>(); | 85 | new ConcurrentHashMap<>(); |
| 94 | 86 | ||
| 95 | - private EventuallyConsistentMapListener<HostId, DefaultHost> hostLocationTracker = | 87 | + private MapEventListener<HostId, DefaultHost> hostLocationTracker = |
| 96 | new HostLocationTracker(); | 88 | new HostLocationTracker(); |
| 97 | 89 | ||
| 98 | @Activate | 90 | @Activate |
| ... | @@ -100,21 +92,22 @@ public class ECHostStore | ... | @@ -100,21 +92,22 @@ public class ECHostStore |
| 100 | KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder() | 92 | KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder() |
| 101 | .register(KryoNamespaces.API); | 93 | .register(KryoNamespaces.API); |
| 102 | 94 | ||
| 103 | - hosts = storageService.<HostId, DefaultHost>eventuallyConsistentMapBuilder() | 95 | + host = storageService.<HostId, DefaultHost>consistentMapBuilder() |
| 104 | .withName("onos-hosts") | 96 | .withName("onos-hosts") |
| 105 | - .withSerializer(hostSerializer) | 97 | + .withRelaxedReadConsistency() |
| 106 | - .withTimestampProvider((k, v) -> clockService.getTimestamp()) | 98 | + .withSerializer(Serializer.using(hostSerializer.build())) |
| 107 | .build(); | 99 | .build(); |
| 108 | 100 | ||
| 109 | - hosts.addListener(hostLocationTracker); | 101 | + hosts = host.asJavaMap(); |
| 102 | + | ||
| 103 | + host.addListener(hostLocationTracker); | ||
| 110 | 104 | ||
| 111 | log.info("Started"); | 105 | log.info("Started"); |
| 112 | } | 106 | } |
| 113 | 107 | ||
| 114 | @Deactivate | 108 | @Deactivate |
| 115 | public void deactivate() { | 109 | public void deactivate() { |
| 116 | - hosts.removeListener(hostLocationTracker); | 110 | + host.removeListener(hostLocationTracker); |
| 117 | - hosts.destroy(); | ||
| 118 | prevHosts.clear(); | 111 | prevHosts.clear(); |
| 119 | 112 | ||
| 120 | log.info("Stopped"); | 113 | log.info("Stopped"); |
| ... | @@ -249,11 +242,11 @@ public class ECHostStore | ... | @@ -249,11 +242,11 @@ public class ECHostStore |
| 249 | return collection.stream().filter(predicate).collect(Collectors.toSet()); | 242 | return collection.stream().filter(predicate).collect(Collectors.toSet()); |
| 250 | } | 243 | } |
| 251 | 244 | ||
| 252 | - private class HostLocationTracker implements EventuallyConsistentMapListener<HostId, DefaultHost> { | 245 | + private class HostLocationTracker implements MapEventListener<HostId, DefaultHost> { |
| 253 | @Override | 246 | @Override |
| 254 | - public void event(EventuallyConsistentMapEvent<HostId, DefaultHost> event) { | 247 | + public void event(MapEvent<HostId, DefaultHost> event) { |
| 255 | - DefaultHost host = checkNotNull(event.value()); | 248 | + DefaultHost host = checkNotNull(event.value().value()); |
| 256 | - if (event.type() == PUT) { | 249 | + if (event.type() == MapEvent.Type.INSERT) { |
| 257 | Host prevHost = prevHosts.put(host.id(), host); | 250 | Host prevHost = prevHosts.put(host.id(), host); |
| 258 | if (prevHost == null) { | 251 | if (prevHost == null) { |
| 259 | notifyDelegate(new HostEvent(HOST_ADDED, host)); | 252 | notifyDelegate(new HostEvent(HOST_ADDED, host)); |
| ... | @@ -262,7 +255,7 @@ public class ECHostStore | ... | @@ -262,7 +255,7 @@ public class ECHostStore |
| 262 | } else if (!Objects.equals(prevHost, host)) { | 255 | } else if (!Objects.equals(prevHost, host)) { |
| 263 | notifyDelegate(new HostEvent(HOST_UPDATED, host, prevHost)); | 256 | notifyDelegate(new HostEvent(HOST_UPDATED, host, prevHost)); |
| 264 | } | 257 | } |
| 265 | - } else if (event.type() == REMOVE) { | 258 | + } else if (event.type() == MapEvent.Type.REMOVE) { |
| 266 | if (prevHosts.remove(host.id()) != null) { | 259 | if (prevHosts.remove(host.id()) != null) { |
| 267 | notifyDelegate(new HostEvent(HOST_REMOVED, host)); | 260 | notifyDelegate(new HostEvent(HOST_REMOVED, host)); |
| 268 | } | 261 | } | ... | ... |
| ... | @@ -113,7 +113,7 @@ public class DistributedProxyArpStore implements ProxyArpStore { | ... | @@ -113,7 +113,7 @@ public class DistributedProxyArpStore implements ProxyArpStore { |
| 113 | 113 | ||
| 114 | @Override | 114 | @Override |
| 115 | public void forward(ConnectPoint outPort, Host subject, ByteBuffer packet) { | 115 | public void forward(ConnectPoint outPort, Host subject, ByteBuffer packet) { |
| 116 | - NodeId nodeId = mastershipService.getMasterFor(outPort.deviceId()); | 116 | + /*NodeId nodeId = mastershipService.getMasterFor(outPort.deviceId()); |
| 117 | if (nodeId.equals(localNodeId)) { | 117 | if (nodeId.equals(localNodeId)) { |
| 118 | if (delegate != null) { | 118 | if (delegate != null) { |
| 119 | delegate.emitResponse(outPort, packet); | 119 | delegate.emitResponse(outPort, packet); |
| ... | @@ -122,7 +122,10 @@ public class DistributedProxyArpStore implements ProxyArpStore { | ... | @@ -122,7 +122,10 @@ public class DistributedProxyArpStore implements ProxyArpStore { |
| 122 | log.info("Forwarding ARP response from {} to {}", subject.id(), outPort); | 122 | log.info("Forwarding ARP response from {} to {}", subject.id(), outPort); |
| 123 | commService.unicast(new ArpResponseMessage(outPort, subject, packet.array()), | 123 | commService.unicast(new ArpResponseMessage(outPort, subject, packet.array()), |
| 124 | ARP_RESPONSE_MESSAGE, serializer::encode, nodeId); | 124 | ARP_RESPONSE_MESSAGE, serializer::encode, nodeId); |
| 125 | - } | 125 | + }*/ |
| 126 | + //FIXME: Code above may be unnecessary and therefore cluster messaging | ||
| 127 | + // and pendingMessages could be pruned as well. | ||
| 128 | + delegate.emitResponse(outPort, packet); | ||
| 126 | } | 129 | } |
| 127 | 130 | ||
| 128 | @Override | 131 | @Override | ... | ... |
| ... | @@ -27,8 +27,6 @@ import org.onosproject.net.HostLocation; | ... | @@ -27,8 +27,6 @@ import org.onosproject.net.HostLocation; |
| 27 | import org.onosproject.net.host.DefaultHostDescription; | 27 | import org.onosproject.net.host.DefaultHostDescription; |
| 28 | import org.onosproject.net.host.HostDescription; | 28 | import org.onosproject.net.host.HostDescription; |
| 29 | import org.onosproject.net.provider.ProviderId; | 29 | import org.onosproject.net.provider.ProviderId; |
| 30 | -import org.onosproject.store.Timestamp; | ||
| 31 | -import org.onosproject.store.service.LogicalClockService; | ||
| 32 | import org.onosproject.store.service.TestStorageService; | 30 | import org.onosproject.store.service.TestStorageService; |
| 33 | 31 | ||
| 34 | import java.util.HashSet; | 32 | import java.util.HashSet; |
| ... | @@ -37,9 +35,9 @@ import java.util.Set; | ... | @@ -37,9 +35,9 @@ import java.util.Set; |
| 37 | /** | 35 | /** |
| 38 | * Tests for the ECHostStore. | 36 | * Tests for the ECHostStore. |
| 39 | */ | 37 | */ |
| 40 | -public class ECHostStoreTest extends TestCase { | 38 | +public class DistributedHostStoreTest extends TestCase { |
| 41 | 39 | ||
| 42 | - private ECHostStore ecXHostStore; | 40 | + private DistributedHostStore ecXHostStore; |
| 43 | 41 | ||
| 44 | private static final HostId HOSTID = HostId.hostId(MacAddress.valueOf("1a:1a:1a:1a:1a:1a")); | 42 | private static final HostId HOSTID = HostId.hostId(MacAddress.valueOf("1a:1a:1a:1a:1a:1a")); |
| 45 | 43 | ||
| ... | @@ -50,10 +48,9 @@ public class ECHostStoreTest extends TestCase { | ... | @@ -50,10 +48,9 @@ public class ECHostStoreTest extends TestCase { |
| 50 | 48 | ||
| 51 | @Before | 49 | @Before |
| 52 | public void setUp() { | 50 | public void setUp() { |
| 53 | - ecXHostStore = new ECHostStore(); | 51 | + ecXHostStore = new DistributedHostStore(); |
| 54 | 52 | ||
| 55 | ecXHostStore.storageService = new TestStorageService(); | 53 | ecXHostStore.storageService = new TestStorageService(); |
| 56 | - ecXHostStore.clockService = new TestLogicalClockService(); | ||
| 57 | ecXHostStore.activate(); | 54 | ecXHostStore.activate(); |
| 58 | } | 55 | } |
| 59 | 56 | ||
| ... | @@ -83,13 +80,4 @@ public class ECHostStoreTest extends TestCase { | ... | @@ -83,13 +80,4 @@ public class ECHostStoreTest extends TestCase { |
| 83 | assertTrue(host.ipAddresses().contains(IP2)); | 80 | assertTrue(host.ipAddresses().contains(IP2)); |
| 84 | } | 81 | } |
| 85 | 82 | ||
| 86 | - /** | ||
| 87 | - * Mocks the LogicalClockService class. | ||
| 88 | - */ | ||
| 89 | - class TestLogicalClockService implements LogicalClockService { | ||
| 90 | - @Override | ||
| 91 | - public Timestamp getTimestamp() { | ||
| 92 | - return null; | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | } | 83 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -15,19 +15,23 @@ from mininet.util import dumpNodeConnections | ... | @@ -15,19 +15,23 @@ from mininet.util import dumpNodeConnections |
| 15 | class AttMplsTopo( Topo ): | 15 | class AttMplsTopo( Topo ): |
| 16 | "Internet Topology Zoo Specimen." | 16 | "Internet Topology Zoo Specimen." |
| 17 | 17 | ||
| 18 | - def build( self ): | 18 | + def __init__( self ): |
| 19 | "Create a topology." | 19 | "Create a topology." |
| 20 | 20 | ||
| 21 | + # Initialize Topology | ||
| 22 | + Topo.__init__( self ) | ||
| 23 | + | ||
| 21 | # add nodes, switches first... | 24 | # add nodes, switches first... |
| 25 | + NY54 = self.addSwitch( 's25' ) # 40.728270, -73.994483 | ||
| 22 | CMBR = self.addSwitch( 's1' ) # 42.373730, -71.109734 | 26 | CMBR = self.addSwitch( 's1' ) # 42.373730, -71.109734 |
| 23 | - CHCG = self.addSwitch( 's2' ) # 41.877461, -87.642892 | 27 | + CHCG = self.addSwitch( 's2', protocols='OpenFlow13' ) # 41.877461, -87.642892 |
| 24 | CLEV = self.addSwitch( 's3' ) # 41.498928, -81.695217 | 28 | CLEV = self.addSwitch( 's3' ) # 41.498928, -81.695217 |
| 25 | RLGH = self.addSwitch( 's4' ) # 35.780150, -78.644026 | 29 | RLGH = self.addSwitch( 's4' ) # 35.780150, -78.644026 |
| 26 | ATLN = self.addSwitch( 's5' ) # 33.749017, -84.394168 | 30 | ATLN = self.addSwitch( 's5' ) # 33.749017, -84.394168 |
| 27 | PHLA = self.addSwitch( 's6' ) # 39.952906, -75.172278 | 31 | PHLA = self.addSwitch( 's6' ) # 39.952906, -75.172278 |
| 28 | WASH = self.addSwitch( 's7' ) # 38.906696, -77.035509 | 32 | WASH = self.addSwitch( 's7' ) # 38.906696, -77.035509 |
| 29 | NSVL = self.addSwitch( 's8' ) # 36.166410, -86.787305 | 33 | NSVL = self.addSwitch( 's8' ) # 36.166410, -86.787305 |
| 30 | - STLS = self.addSwitch( 's9' ) # 38.626418, -90.198143 | 34 | + STLS = self.addSwitch( 's9', protocols='OpenFlow13' ) # 38.626418, -90.198143 |
| 31 | NWOR = self.addSwitch( 's10' ) # 29.951475, -90.078434 | 35 | NWOR = self.addSwitch( 's10' ) # 29.951475, -90.078434 |
| 32 | HSTN = self.addSwitch( 's11' ) # 29.763249, -95.368332 | 36 | HSTN = self.addSwitch( 's11' ) # 29.763249, -95.368332 |
| 33 | SNAN = self.addSwitch( 's12' ) # 29.424331, -98.491745 | 37 | SNAN = self.addSwitch( 's12' ) # 29.424331, -98.491745 |
| ... | @@ -40,12 +44,12 @@ class AttMplsTopo( Topo ): | ... | @@ -40,12 +44,12 @@ class AttMplsTopo( Topo ): |
| 40 | PTLD = self.addSwitch( 's19' ) # 45.523317, -122.677768 | 44 | PTLD = self.addSwitch( 's19' ) # 45.523317, -122.677768 |
| 41 | STTL = self.addSwitch( 's20' ) # 47.607326, -122.331786 | 45 | STTL = self.addSwitch( 's20' ) # 47.607326, -122.331786 |
| 42 | SLKC = self.addSwitch( 's21' ) # 40.759577, -111.895079 | 46 | SLKC = self.addSwitch( 's21' ) # 40.759577, -111.895079 |
| 43 | - LA03 = self.addSwitch( 's22' ) # 34.056346, -118.235951 | 47 | + LA03 = self.addSwitch( 's22', protocols='OpenFlow13' ) # 34.056346, -118.235951 |
| 44 | SNDG = self.addSwitch( 's23' ) # 32.714564, -117.153528 | 48 | SNDG = self.addSwitch( 's23' ) # 32.714564, -117.153528 |
| 45 | PHNX = self.addSwitch( 's24' ) # 33.448289, -112.076299 | 49 | PHNX = self.addSwitch( 's24' ) # 33.448289, -112.076299 |
| 46 | - NY54 = self.addSwitch( 's25' ) # 40.728270, -73.994483 | ||
| 47 | 50 | ||
| 48 | # ... and now hosts | 51 | # ... and now hosts |
| 52 | + NY54_host = self.addHost( 'h25' ) | ||
| 49 | CMBR_host = self.addHost( 'h1' ) | 53 | CMBR_host = self.addHost( 'h1' ) |
| 50 | CHCG_host = self.addHost( 'h2' ) | 54 | CHCG_host = self.addHost( 'h2' ) |
| 51 | CLEV_host = self.addHost( 'h3' ) | 55 | CLEV_host = self.addHost( 'h3' ) |
| ... | @@ -70,7 +74,6 @@ class AttMplsTopo( Topo ): | ... | @@ -70,7 +74,6 @@ class AttMplsTopo( Topo ): |
| 70 | LA03_host = self.addHost( 'h22' ) | 74 | LA03_host = self.addHost( 'h22' ) |
| 71 | SNDG_host = self.addHost( 'h23' ) | 75 | SNDG_host = self.addHost( 'h23' ) |
| 72 | PHNX_host = self.addHost( 'h24' ) | 76 | PHNX_host = self.addHost( 'h24' ) |
| 73 | - NY54_host = self.addHost( 'h25' ) | ||
| 74 | 77 | ||
| 75 | # add edges between switch and corresponding host | 78 | # add edges between switch and corresponding host |
| 76 | self.addLink( NY54 , NY54_host ) | 79 | self.addLink( NY54 , NY54_host ) | ... | ... |
-
Please register or login to post a comment