Showing
8 changed files
with
33 additions
and
45 deletions
| ... | @@ -170,7 +170,9 @@ public class ReactiveForwarding { | ... | @@ -170,7 +170,9 @@ public class ReactiveForwarding { |
| 170 | // We don't yet support bufferids in the flowservice so packet out first. | 170 | // We don't yet support bufferids in the flowservice so packet out first. |
| 171 | packetOut(context, portNumber); | 171 | packetOut(context, portNumber); |
| 172 | 172 | ||
| 173 | - | 173 | + if (true) { |
| 174 | + return; | ||
| 175 | + } | ||
| 174 | 176 | ||
| 175 | // Install the flow rule to handle this type of message from now on. | 177 | // Install the flow rule to handle this type of message from now on. |
| 176 | Ethernet inPkt = context.inPacket().parsed(); | 178 | Ethernet inPkt = context.inPacket().parsed(); | ... | ... |
| ... | @@ -19,17 +19,16 @@ import org.onlab.onos.net.intent.IntentState; | ... | @@ -19,17 +19,16 @@ import org.onlab.onos.net.intent.IntentState; |
| 19 | description = "Wipes-out the entire network information base, i.e. devices, links, hosts") | 19 | description = "Wipes-out the entire network information base, i.e. devices, links, hosts") |
| 20 | public class WipeOutCommand extends ClustersListCommand { | 20 | public class WipeOutCommand extends ClustersListCommand { |
| 21 | 21 | ||
| 22 | - private static final String DISCLAIMER = "Delete everything please."; | 22 | + private static final String PLEASE = "please"; |
| 23 | 23 | ||
| 24 | - @Argument(index = 0, name = "disclaimer", description = "Device ID", | 24 | + @Argument(index = 0, name = "please", description = "Confirmation phrase", |
| 25 | required = false, multiValued = false) | 25 | required = false, multiValued = false) |
| 26 | - String disclaimer = null; | 26 | + String please = null; |
| 27 | 27 | ||
| 28 | @Override | 28 | @Override |
| 29 | protected void execute() { | 29 | protected void execute() { |
| 30 | - if (disclaimer == null || !disclaimer.equals(DISCLAIMER)) { | 30 | + if (please == null || !please.equals(PLEASE)) { |
| 31 | - print("I'm afraid I can't do that!\nPlease acknowledge with phrase: '%s'", | 31 | + print("I'm afraid I can't do that!\nSay: %s", PLEASE); |
| 32 | - DISCLAIMER); | ||
| 33 | return; | 32 | return; |
| 34 | } | 33 | } |
| 35 | 34 | ... | ... |
| ... | @@ -9,10 +9,12 @@ import java.util.Objects; | ... | @@ -9,10 +9,12 @@ import java.util.Objects; |
| 9 | public abstract class ElementId { | 9 | public abstract class ElementId { |
| 10 | 10 | ||
| 11 | private final URI uri; | 11 | private final URI uri; |
| 12 | + private final String str; | ||
| 12 | 13 | ||
| 13 | // Default constructor for serialization | 14 | // Default constructor for serialization |
| 14 | protected ElementId() { | 15 | protected ElementId() { |
| 15 | this.uri = null; | 16 | this.uri = null; |
| 17 | + this.str = null; | ||
| 16 | } | 18 | } |
| 17 | 19 | ||
| 18 | /** | 20 | /** |
| ... | @@ -22,6 +24,7 @@ public abstract class ElementId { | ... | @@ -22,6 +24,7 @@ public abstract class ElementId { |
| 22 | */ | 24 | */ |
| 23 | protected ElementId(URI uri) { | 25 | protected ElementId(URI uri) { |
| 24 | this.uri = uri; | 26 | this.uri = uri; |
| 27 | + this.str = uri.toString(); | ||
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| ... | @@ -35,7 +38,7 @@ public abstract class ElementId { | ... | @@ -35,7 +38,7 @@ public abstract class ElementId { |
| 35 | 38 | ||
| 36 | @Override | 39 | @Override |
| 37 | public int hashCode() { | 40 | public int hashCode() { |
| 38 | - return Objects.hash(uri); | 41 | + return Objects.hash(str); |
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | @Override | 44 | @Override |
| ... | @@ -46,14 +49,14 @@ public abstract class ElementId { | ... | @@ -46,14 +49,14 @@ public abstract class ElementId { |
| 46 | if (obj instanceof ElementId) { | 49 | if (obj instanceof ElementId) { |
| 47 | final ElementId that = (ElementId) obj; | 50 | final ElementId that = (ElementId) obj; |
| 48 | return this.getClass() == that.getClass() && | 51 | return this.getClass() == that.getClass() && |
| 49 | - Objects.equals(this.uri, that.uri); | 52 | + Objects.equals(this.str, that.str); |
| 50 | } | 53 | } |
| 51 | return false; | 54 | return false; |
| 52 | } | 55 | } |
| 53 | 56 | ||
| 54 | @Override | 57 | @Override |
| 55 | public String toString() { | 58 | public String toString() { |
| 56 | - return uri.toString(); | 59 | + return str; |
| 57 | } | 60 | } |
| 58 | 61 | ||
| 59 | } | 62 | } | ... | ... |
| 1 | package org.onlab.onos.net.flow; | 1 | package org.onlab.onos.net.flow; |
| 2 | 2 | ||
| 3 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 4 | - | ||
| 5 | -import java.util.Collections; | ||
| 6 | -import java.util.LinkedList; | ||
| 7 | -import java.util.List; | ||
| 8 | -import java.util.Objects; | ||
| 9 | - | ||
| 10 | import org.onlab.onos.net.PortNumber; | 3 | import org.onlab.onos.net.PortNumber; |
| 11 | import org.onlab.onos.net.flow.instructions.Instruction; | 4 | import org.onlab.onos.net.flow.instructions.Instruction; |
| 12 | import org.onlab.onos.net.flow.instructions.Instructions; | 5 | import org.onlab.onos.net.flow.instructions.Instructions; |
| 13 | import org.onlab.packet.IpPrefix; | 6 | import org.onlab.packet.IpPrefix; |
| 14 | import org.onlab.packet.MacAddress; | 7 | import org.onlab.packet.MacAddress; |
| 15 | import org.onlab.packet.VlanId; | 8 | import org.onlab.packet.VlanId; |
| 16 | -import org.slf4j.Logger; | 9 | + |
| 10 | +import java.util.Collections; | ||
| 11 | +import java.util.LinkedList; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Objects; | ||
| 17 | 14 | ||
| 18 | /** | 15 | /** |
| 19 | * Default traffic treatment implementation. | 16 | * Default traffic treatment implementation. |
| ... | @@ -58,7 +55,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -58,7 +55,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
| 58 | } | 55 | } |
| 59 | if (obj instanceof DefaultTrafficTreatment) { | 56 | if (obj instanceof DefaultTrafficTreatment) { |
| 60 | DefaultTrafficTreatment that = (DefaultTrafficTreatment) obj; | 57 | DefaultTrafficTreatment that = (DefaultTrafficTreatment) obj; |
| 61 | - return Objects.equals(instructions, that.instructions); | 58 | + return Objects.equals(instructions, that.instructions); |
| 62 | 59 | ||
| 63 | } | 60 | } |
| 64 | return false; | 61 | return false; |
| ... | @@ -70,8 +67,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -70,8 +67,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
| 70 | */ | 67 | */ |
| 71 | public static final class Builder implements TrafficTreatment.Builder { | 68 | public static final class Builder implements TrafficTreatment.Builder { |
| 72 | 69 | ||
| 73 | - private final Logger log = getLogger(getClass()); | ||
| 74 | - | ||
| 75 | boolean drop = false; | 70 | boolean drop = false; |
| 76 | 71 | ||
| 77 | List<Instruction> outputs = new LinkedList<>(); | 72 | List<Instruction> outputs = new LinkedList<>(); |
| ... | @@ -107,7 +102,8 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -107,7 +102,8 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
| 107 | groups.add(instruction); | 102 | groups.add(instruction); |
| 108 | break; | 103 | break; |
| 109 | default: | 104 | default: |
| 110 | - log.warn("Unknown instruction type {}", instruction.type()); | 105 | + throw new IllegalArgumentException("Unknown instruction type: " + |
| 106 | + instruction.type()); | ||
| 111 | } | 107 | } |
| 112 | return this; | 108 | return this; |
| 113 | } | 109 | } | ... | ... |
| 1 | package org.onlab.onos.openflow.controller; | 1 | package org.onlab.onos.openflow.controller; |
| 2 | 2 | ||
| 3 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 4 | - | ||
| 5 | -import java.util.Collections; | ||
| 6 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
| 7 | - | ||
| 8 | import org.onlab.packet.Ethernet; | 3 | import org.onlab.packet.Ethernet; |
| 9 | import org.projectfloodlight.openflow.protocol.OFPacketIn; | 4 | import org.projectfloodlight.openflow.protocol.OFPacketIn; |
| 10 | import org.projectfloodlight.openflow.protocol.OFPacketOut; | 5 | import org.projectfloodlight.openflow.protocol.OFPacketOut; |
| ... | @@ -13,11 +8,11 @@ import org.projectfloodlight.openflow.protocol.action.OFActionOutput; | ... | @@ -13,11 +8,11 @@ import org.projectfloodlight.openflow.protocol.action.OFActionOutput; |
| 13 | import org.projectfloodlight.openflow.protocol.match.MatchField; | 8 | import org.projectfloodlight.openflow.protocol.match.MatchField; |
| 14 | import org.projectfloodlight.openflow.types.OFBufferId; | 9 | import org.projectfloodlight.openflow.types.OFBufferId; |
| 15 | import org.projectfloodlight.openflow.types.OFPort; | 10 | import org.projectfloodlight.openflow.types.OFPort; |
| 16 | -import org.slf4j.Logger; | ||
| 17 | 11 | ||
| 18 | -public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext { | 12 | +import java.util.Collections; |
| 13 | +import java.util.concurrent.atomic.AtomicBoolean; | ||
| 19 | 14 | ||
| 20 | - private final Logger log = getLogger(getClass()); | 15 | +public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext { |
| 21 | 16 | ||
| 22 | private final AtomicBoolean free = new AtomicBoolean(true); | 17 | private final AtomicBoolean free = new AtomicBoolean(true); |
| 23 | private final AtomicBoolean isBuilt = new AtomicBoolean(false); | 18 | private final AtomicBoolean isBuilt = new AtomicBoolean(false); |
| ... | @@ -82,7 +77,7 @@ public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext | ... | @@ -82,7 +77,7 @@ public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext |
| 82 | } | 77 | } |
| 83 | 78 | ||
| 84 | public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s, | 79 | public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s, |
| 85 | - OFPacketIn pkt) { | 80 | + OFPacketIn pkt) { |
| 86 | return new DefaultOpenFlowPacketContext(s, pkt); | 81 | return new DefaultOpenFlowPacketContext(s, pkt); |
| 87 | } | 82 | } |
| 88 | 83 | ... | ... |
| ... | @@ -157,9 +157,7 @@ public class Controller { | ... | @@ -157,9 +157,7 @@ public class Controller { |
| 157 | } | 157 | } |
| 158 | log.debug("OpenFlow port set to {}", this.openFlowPort); | 158 | log.debug("OpenFlow port set to {}", this.openFlowPort); |
| 159 | String threads = configParams.get("workerthreads"); | 159 | String threads = configParams.get("workerthreads"); |
| 160 | - if (threads != null) { | 160 | + this.workerThreads = threads != null ? Integer.parseInt(threads) : 16; |
| 161 | - this.workerThreads = Integer.parseInt(threads); | ||
| 162 | - } | ||
| 163 | log.debug("Number of worker threads set to {}", this.workerThreads); | 161 | log.debug("Number of worker threads set to {}", this.workerThreads); |
| 164 | } | 162 | } |
| 165 | 163 | ... | ... |
| ... | @@ -44,7 +44,6 @@ public class OpenFlowControllerImpl implements OpenFlowController { | ... | @@ -44,7 +44,6 @@ public class OpenFlowControllerImpl implements OpenFlowController { |
| 44 | private final ExecutorService executor = Executors.newFixedThreadPool(16, | 44 | private final ExecutorService executor = Executors.newFixedThreadPool(16, |
| 45 | namedThreads("of-event-%d")); | 45 | namedThreads("of-event-%d")); |
| 46 | 46 | ||
| 47 | - | ||
| 48 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches = | 47 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches = |
| 49 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); | 48 | new ConcurrentHashMap<Dpid, OpenFlowSwitch>(); |
| 50 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches = | 49 | protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches = | ... | ... |
| 1 | package org.onlab.onos.provider.of.packet.impl; | 1 | package org.onlab.onos.provider.of.packet.impl; |
| 2 | 2 | ||
| 3 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 4 | - | ||
| 5 | -import java.util.List; | ||
| 6 | - | ||
| 7 | import org.onlab.onos.net.PortNumber; | 3 | import org.onlab.onos.net.PortNumber; |
| 8 | import org.onlab.onos.net.flow.instructions.Instruction; | 4 | import org.onlab.onos.net.flow.instructions.Instruction; |
| 9 | import org.onlab.onos.net.flow.instructions.Instruction.Type; | 5 | import org.onlab.onos.net.flow.instructions.Instruction.Type; |
| ... | @@ -14,16 +10,16 @@ import org.onlab.onos.net.packet.OutboundPacket; | ... | @@ -14,16 +10,16 @@ import org.onlab.onos.net.packet.OutboundPacket; |
| 14 | import org.onlab.onos.openflow.controller.OpenFlowPacketContext; | 10 | import org.onlab.onos.openflow.controller.OpenFlowPacketContext; |
| 15 | import org.onlab.packet.Ethernet; | 11 | import org.onlab.packet.Ethernet; |
| 16 | import org.projectfloodlight.openflow.types.OFPort; | 12 | import org.projectfloodlight.openflow.types.OFPort; |
| 17 | -import org.slf4j.Logger; | ||
| 18 | 13 | ||
| 19 | -public class OpenFlowCorePacketContext extends DefaultPacketContext { | 14 | +import java.util.List; |
| 20 | 15 | ||
| 21 | - private final Logger log = getLogger(getClass()); | 16 | +public class OpenFlowCorePacketContext extends DefaultPacketContext { |
| 22 | 17 | ||
| 23 | private final OpenFlowPacketContext ofPktCtx; | 18 | private final OpenFlowPacketContext ofPktCtx; |
| 24 | 19 | ||
| 25 | protected OpenFlowCorePacketContext(long time, InboundPacket inPkt, | 20 | protected OpenFlowCorePacketContext(long time, InboundPacket inPkt, |
| 26 | - OutboundPacket outPkt, boolean block, OpenFlowPacketContext ofPktCtx) { | 21 | + OutboundPacket outPkt, boolean block, |
| 22 | + OpenFlowPacketContext ofPktCtx) { | ||
| 27 | super(time, inPkt, outPkt, block); | 23 | super(time, inPkt, outPkt, block); |
| 28 | this.ofPktCtx = ofPktCtx; | 24 | this.ofPktCtx = ofPktCtx; |
| 29 | } | 25 | } |
| ... | @@ -36,9 +32,8 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { | ... | @@ -36,9 +32,8 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { |
| 36 | } else { | 32 | } else { |
| 37 | Ethernet eth = new Ethernet(); | 33 | Ethernet eth = new Ethernet(); |
| 38 | eth.deserialize(outPacket().data().array(), 0, | 34 | eth.deserialize(outPacket().data().array(), 0, |
| 39 | - outPacket().data().array().length); | 35 | + outPacket().data().array().length); |
| 40 | sendPacket(eth); | 36 | sendPacket(eth); |
| 41 | - | ||
| 42 | } | 37 | } |
| 43 | 38 | ||
| 44 | } | 39 | } |
| ... | @@ -61,6 +56,7 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { | ... | @@ -61,6 +56,7 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { |
| 61 | } | 56 | } |
| 62 | ofPktCtx.send(); | 57 | ofPktCtx.send(); |
| 63 | } | 58 | } |
| 59 | + | ||
| 64 | private OFPort buildPort(PortNumber port) { | 60 | private OFPort buildPort(PortNumber port) { |
| 65 | return OFPort.of((int) port.toLong()); | 61 | return OFPort.of((int) port.toLong()); |
| 66 | } | 62 | } | ... | ... |
-
Please register or login to post a comment