Fixed traffic selector builder to allow only one criterion.
Temporarily disabled flow rule time-out.
diff --git a/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
index 00619b3..db82eed 100644
--- a/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
@@ -242,15 +242,16 @@
}
private boolean checkRuleLiveness(FlowRule swRule, FlowRule storedRule) {
- int timeout = storedRule.timeout();
- if (storedRule.packets() != swRule.packets()) {
- deadRounds.get(swRule).set(0);
- return true;
- }
-
- return (deadRounds.get(swRule).getAndIncrement() *
- FlowRuleProvider.POLL_INTERVAL) <= timeout;
-
+ return true;
+// int timeout = storedRule.timeout();
+// if (storedRule.packets() != swRule.packets()) {
+// deadRounds.get(swRule).set(0);
+// return true;
+// }
+//
+// return (deadRounds.get(swRule).getAndIncrement() *
+// FlowRuleProvider.POLL_INTERVAL) <= timeout;
+//
}
// Posts the specified event to the local event dispatcher.
diff --git a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
index c9e0442..628f424 100644
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
@@ -150,7 +150,7 @@
List<Instruction> instructions = new ArrayList<>();
instructions.add(Instructions.createOutput(port.number()));
- TrafficTreatment treatment = new DefaultTrafficTreatment.Builder()
+ TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setOutput(port.number())
.build();
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/PathIntentInstaller.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/PathIntentInstaller.java
index 524aa6e..6aa9f66 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/PathIntentInstaller.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/PathIntentInstaller.java
@@ -1,7 +1,5 @@
package org.onlab.onos.net.intent.impl;
-import java.util.Iterator;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -17,24 +15,25 @@
import org.onlab.onos.net.flow.FlowRuleService;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
-import org.onlab.onos.net.flow.criteria.Criterion;
import org.onlab.onos.net.intent.IntentExtensionService;
import org.onlab.onos.net.intent.IntentInstaller;
import org.onlab.onos.net.intent.PathIntent;
+import java.util.Iterator;
+
/**
- * An intent installer for {@link PathIntent}.
+ * Installer for {@link PathIntent path connectivity intents}.
*/
@Component(immediate = true)
-public class PathIntentInstaller
- implements IntentInstaller<PathIntent> {
+public class PathIntentInstaller implements IntentInstaller<PathIntent> {
+
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected IntentExtensionService intentManager;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- private FlowRuleService flowRuleService;
+ protected FlowRuleService flowRuleService;
- private final ApplicationId appId = ApplicationId.valueOf(1);
+ private final ApplicationId appId = ApplicationId.getAppId();
@Activate
public void activate() {
@@ -48,24 +47,21 @@
@Override
public void install(PathIntent intent) {
- TrafficSelector.Builder builder = new DefaultTrafficSelector.Builder();
- TrafficSelector selector = intent.getTrafficSelector();
- for (Criterion c : selector.criteria()) {
- builder.add(c);
- }
-
+ TrafficSelector.Builder builder =
+ DefaultTrafficSelector.builder(intent.getTrafficSelector());
Iterator<Link> links = intent.getPath().links().iterator();
ConnectPoint prev = links.next().dst();
while (links.hasNext()) {
builder.matchInport(prev.port());
Link link = links.next();
- TrafficTreatment.Builder treat = new DefaultTrafficTreatment.Builder();
+ TrafficTreatment.Builder treat = DefaultTrafficTreatment.builder();
treat.setOutput(link.src().port());
- FlowRule f = new DefaultFlowRule(link.src().deviceId(),
- builder.build(), treat.build(), 0, appId, 0);
- flowRuleService.applyFlowRules(f);
+ FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
+ builder.build(), treat.build(),
+ 0, appId, 30);
+ flowRuleService.applyFlowRules(rule);
prev = link.dst();
}
diff --git a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
index 6e07c3e..3570948 100644
--- a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
@@ -43,7 +43,6 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
-
@Component(immediate = true)
@Service
public class ProxyArpManager implements ProxyArpService {
@@ -128,7 +127,7 @@
Ethernet arpReply = buildArpReply(dst, eth);
// TODO: check send status with host service.
- TrafficTreatment.Builder builder = new DefaultTrafficTreatment.Builder();
+ TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
builder.setOutput(src.location().port());
packetService.emit(new DefaultOutboundPacket(src.location().deviceId(),
builder.build(), ByteBuffer.wrap(arpReply.serialize())));
@@ -148,7 +147,7 @@
if (h == null) {
flood(eth);
} else {
- TrafficTreatment.Builder builder = new DefaultTrafficTreatment.Builder();
+ TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
builder.setOutput(h.location().port());
packetService.emit(new DefaultOutboundPacket(h.location().deviceId(),
builder.build(), ByteBuffer.wrap(eth.serialize())));
@@ -166,7 +165,7 @@
synchronized (externalPorts) {
for (Entry<Device, PortNumber> entry : externalPorts.entries()) {
- builder = new DefaultTrafficTreatment.Builder();
+ builder = DefaultTrafficTreatment.builder();
builder.setOutput(entry.getValue());
packetService.emit(new DefaultOutboundPacket(entry.getKey().id(),
builder.build(), buf));