Adding mac to intentperf selector and making Distributed flow store smaller

Change-Id: Id057ec6337519617dab8a5e352feb2922b40897d
This commit is contained in:
Brian O'Connor 2015-03-10 11:19:50 -07:00
parent 54d3499e05
commit b9a91c134f
2 changed files with 8 additions and 14 deletions

View File

@ -22,6 +22,7 @@ import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Reference;
import org.onlab.packet.MacAddress;
import org.onlab.util.Counter; import org.onlab.util.Counter;
import org.onosproject.cluster.ClusterService; import org.onosproject.cluster.ClusterService;
import org.onosproject.core.ApplicationId; import org.onosproject.core.ApplicationId;
@ -200,7 +201,8 @@ public class IntentPerfInstaller {
} }
//FIXME we currently ignore the path length and always use the same device //FIXME we currently ignore the path length and always use the same device
TrafficSelector selector = DefaultTrafficSelector.builder().build(); TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthDst(MacAddress.valueOf(count)).build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1)); ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1));
ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2)); ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2));

View File

@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.lang.math.RandomUtils;
import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Deactivate;
@ -53,7 +53,6 @@ import org.onosproject.net.flow.FlowRuleStore;
import org.onosproject.net.flow.FlowRuleStoreDelegate; import org.onosproject.net.flow.FlowRuleStoreDelegate;
import org.onosproject.net.flow.StoredFlowEntry; import org.onosproject.net.flow.StoredFlowEntry;
import org.onosproject.store.AbstractStore; import org.onosproject.store.AbstractStore;
import org.onosproject.store.Timestamp;
import org.onosproject.store.cluster.messaging.ClusterCommunicationService; import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
import org.onosproject.store.cluster.messaging.ClusterMessage; import org.onosproject.store.cluster.messaging.ClusterMessage;
import org.onosproject.store.cluster.messaging.ClusterMessageHandler; import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
@ -625,15 +624,8 @@ public class DistributedFlowRuleStore
.register(MastershipBasedTimestamp.class); .register(MastershipBasedTimestamp.class);
private final ClockService<FlowId, StoredFlowEntry> clockService = private final ClockService<FlowId, StoredFlowEntry> clockService =
new ClockService<FlowId, StoredFlowEntry>() { (flowId, flowEntry) ->
@Override (flowEntry == null) ? null : deviceClockService.getTimestamp(flowEntry.deviceId());
public Timestamp getTimestamp(FlowId flowId, StoredFlowEntry flowEntry) {
if (flowEntry == null) {
return null;
}
return deviceClockService.getTimestamp(flowEntry.deviceId());
}
};
private final EventuallyConsistentMap<FlowId, StoredFlowEntry> backupMap = private final EventuallyConsistentMap<FlowId, StoredFlowEntry> backupMap =
new EventuallyConsistentMapImpl<>("flow-backup", new EventuallyConsistentMapImpl<>("flow-backup",
@ -653,8 +645,8 @@ public class DistributedFlowRuleStore
if (nodes.isEmpty()) { if (nodes.isEmpty()) {
return ImmutableList.of(); return ImmutableList.of();
} else { } else {
Collections.shuffle(nodes); // get a random peer
return ImmutableList.of(nodes.get(0)); return ImmutableList.of(nodes.get(RandomUtils.nextInt(nodes.size())));
} }
} }