Merge remote-tracking branch 'origin/master'
diff --git a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
index e5eac73..08fe0f5 100644
--- a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
+++ b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
@@ -170,7 +170,9 @@
// We don't yet support bufferids in the flowservice so packet out first.
packetOut(context, portNumber);
-
+ if (true) {
+ return;
+ }
// Install the flow rule to handle this type of message from now on.
Ethernet inPkt = context.inPacket().parsed();
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
index fe18ba0..5fd29f2 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/WipeOutCommand.java
@@ -19,17 +19,16 @@
description = "Wipes-out the entire network information base, i.e. devices, links, hosts")
public class WipeOutCommand extends ClustersListCommand {
- private static final String DISCLAIMER = "Delete everything please.";
+ private static final String PLEASE = "please";
- @Argument(index = 0, name = "disclaimer", description = "Device ID",
+ @Argument(index = 0, name = "please", description = "Confirmation phrase",
required = false, multiValued = false)
- String disclaimer = null;
+ String please = null;
@Override
protected void execute() {
- if (disclaimer == null || !disclaimer.equals(DISCLAIMER)) {
- print("I'm afraid I can't do that!\nPlease acknowledge with phrase: '%s'",
- DISCLAIMER);
+ if (please == null || !please.equals(PLEASE)) {
+ print("I'm afraid I can't do that!\nSay: %s", PLEASE);
return;
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/ElementId.java b/core/api/src/main/java/org/onlab/onos/net/ElementId.java
index d2cd398..3f9c88d 100644
--- a/core/api/src/main/java/org/onlab/onos/net/ElementId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/ElementId.java
@@ -9,10 +9,12 @@
public abstract class ElementId {
private final URI uri;
+ private final String str;
// Default constructor for serialization
protected ElementId() {
this.uri = null;
+ this.str = null;
}
/**
@@ -22,6 +24,7 @@
*/
protected ElementId(URI uri) {
this.uri = uri;
+ this.str = uri.toString();
}
/**
@@ -35,7 +38,7 @@
@Override
public int hashCode() {
- return Objects.hash(uri);
+ return Objects.hash(str);
}
@Override
@@ -46,14 +49,14 @@
if (obj instanceof ElementId) {
final ElementId that = (ElementId) obj;
return this.getClass() == that.getClass() &&
- Objects.equals(this.uri, that.uri);
+ Objects.equals(this.str, that.str);
}
return false;
}
@Override
public String toString() {
- return uri.toString();
+ return str;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
index 7182916..269347a 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
@@ -1,19 +1,16 @@
package org.onlab.onos.net.flow;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.onos.net.flow.instructions.Instructions;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
-import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
/**
* Default traffic treatment implementation.
@@ -58,7 +55,7 @@
}
if (obj instanceof DefaultTrafficTreatment) {
DefaultTrafficTreatment that = (DefaultTrafficTreatment) obj;
- return Objects.equals(instructions, that.instructions);
+ return Objects.equals(instructions, that.instructions);
}
return false;
@@ -70,8 +67,6 @@
*/
public static final class Builder implements TrafficTreatment.Builder {
- private final Logger log = getLogger(getClass());
-
boolean drop = false;
List<Instruction> outputs = new LinkedList<>();
@@ -107,7 +102,8 @@
groups.add(instruction);
break;
default:
- log.warn("Unknown instruction type {}", instruction.type());
+ throw new IllegalArgumentException("Unknown instruction type: " +
+ instruction.type());
}
return this;
}
diff --git a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
index 0f69bac..e56a4f9 100644
--- a/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
+++ b/openflow/api/src/main/java/org/onlab/onos/openflow/controller/DefaultOpenFlowPacketContext.java
@@ -1,10 +1,5 @@
package org.onlab.onos.openflow.controller;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.onlab.packet.Ethernet;
import org.projectfloodlight.openflow.protocol.OFPacketIn;
import org.projectfloodlight.openflow.protocol.OFPacketOut;
@@ -13,12 +8,12 @@
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.types.OFBufferId;
import org.projectfloodlight.openflow.types.OFPort;
-import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext {
- private final Logger log = getLogger(getClass());
-
private final AtomicBoolean free = new AtomicBoolean(true);
private final AtomicBoolean isBuilt = new AtomicBoolean(false);
private final OpenFlowSwitch sw;
@@ -82,7 +77,7 @@
}
public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s,
- OFPacketIn pkt) {
+ OFPacketIn pkt) {
return new DefaultOpenFlowPacketContext(s, pkt);
}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
index 53ad55f..168c06d 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/Controller.java
@@ -157,9 +157,7 @@
}
log.debug("OpenFlow port set to {}", this.openFlowPort);
String threads = configParams.get("workerthreads");
- if (threads != null) {
- this.workerThreads = Integer.parseInt(threads);
- }
+ this.workerThreads = threads != null ? Integer.parseInt(threads) : 16;
log.debug("Number of worker threads set to {}", this.workerThreads);
}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
index 716f7ec..685ee9c 100644
--- a/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onlab/onos/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -44,7 +44,6 @@
private final ExecutorService executor = Executors.newFixedThreadPool(16,
namedThreads("of-event-%d"));
-
protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches =
new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches =
diff --git a/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java b/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
index e7c4443..71ddb0d 100644
--- a/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
+++ b/providers/openflow/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowCorePacketContext.java
@@ -1,9 +1,5 @@
package org.onlab.onos.provider.of.packet.impl;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.List;
-
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.onos.net.flow.instructions.Instruction.Type;
@@ -14,16 +10,16 @@
import org.onlab.onos.openflow.controller.OpenFlowPacketContext;
import org.onlab.packet.Ethernet;
import org.projectfloodlight.openflow.types.OFPort;
-import org.slf4j.Logger;
+
+import java.util.List;
public class OpenFlowCorePacketContext extends DefaultPacketContext {
- private final Logger log = getLogger(getClass());
-
private final OpenFlowPacketContext ofPktCtx;
protected OpenFlowCorePacketContext(long time, InboundPacket inPkt,
- OutboundPacket outPkt, boolean block, OpenFlowPacketContext ofPktCtx) {
+ OutboundPacket outPkt, boolean block,
+ OpenFlowPacketContext ofPktCtx) {
super(time, inPkt, outPkt, block);
this.ofPktCtx = ofPktCtx;
}
@@ -36,9 +32,8 @@
} else {
Ethernet eth = new Ethernet();
eth.deserialize(outPacket().data().array(), 0,
- outPacket().data().array().length);
+ outPacket().data().array().length);
sendPacket(eth);
-
}
}
@@ -61,6 +56,7 @@
}
ofPktCtx.send();
}
+
private OFPort buildPort(PortNumber port) {
return OFPort.of((int) port.toLong());
}