Brian O'Connor

Adding mac to intentperf selector and making Distributed flow store smaller

Change-Id: Id057ec6337519617dab8a5e352feb2922b40897d
......@@ -22,6 +22,7 @@ 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.Reference;
import org.onlab.packet.MacAddress;
import org.onlab.util.Counter;
import org.onosproject.cluster.ClusterService;
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
TrafficSelector selector = DefaultTrafficSelector.builder().build();
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthDst(MacAddress.valueOf(count)).build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1));
ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2));
......
......@@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
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.Component;
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.StoredFlowEntry;
import org.onosproject.store.AbstractStore;
import org.onosproject.store.Timestamp;
import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
import org.onosproject.store.cluster.messaging.ClusterMessage;
import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
......@@ -625,15 +624,8 @@ public class DistributedFlowRuleStore
.register(MastershipBasedTimestamp.class);
private final ClockService<FlowId, StoredFlowEntry> clockService =
new ClockService<FlowId, StoredFlowEntry>() {
@Override
public Timestamp getTimestamp(FlowId flowId, StoredFlowEntry flowEntry) {
if (flowEntry == null) {
return null;
}
return deviceClockService.getTimestamp(flowEntry.deviceId());
}
};
(flowId, flowEntry) ->
(flowEntry == null) ? null : deviceClockService.getTimestamp(flowEntry.deviceId());
private final EventuallyConsistentMap<FlowId, StoredFlowEntry> backupMap =
new EventuallyConsistentMapImpl<>("flow-backup",
......@@ -653,8 +645,8 @@ public class DistributedFlowRuleStore
if (nodes.isEmpty()) {
return ImmutableList.of();
} else {
Collections.shuffle(nodes);
return ImmutableList.of(nodes.get(0));
// get a random peer
return ImmutableList.of(nodes.get(RandomUtils.nextInt(nodes.size())));
}
}
......