mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 19:01:06 +02:00
pkt glitch FIXED... ovs was not sending a bufferid
Change-Id: Id6fedf7c6ed8fbcfefb7308b0ee442e614e5e3af
This commit is contained in:
parent
e94d0d4753
commit
e9d3a32016
@ -1,5 +1,9 @@
|
|||||||
package org.onlab.onos.fwd;
|
package org.onlab.onos.fwd;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
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;
|
||||||
@ -27,10 +31,6 @@ import org.onlab.onos.net.topology.TopologyService;
|
|||||||
import org.onlab.packet.Ethernet;
|
import org.onlab.packet.Ethernet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sample reactive forwarding application.
|
* Sample reactive forwarding application.
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ public class ReactiveForwarding {
|
|||||||
if (path == null) {
|
if (path == null) {
|
||||||
log.warn("Doh... don't know where to go... {} -> {} received on {}",
|
log.warn("Doh... don't know where to go... {} -> {} received on {}",
|
||||||
ethPkt.getSourceMAC(), ethPkt.getDestinationMAC(),
|
ethPkt.getSourceMAC(), ethPkt.getDestinationMAC(),
|
||||||
pkt.receivedFrom().port());
|
pkt.receivedFrom());
|
||||||
flood(context);
|
flood(context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,12 @@ public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext
|
|||||||
private final OFPacketIn pktin;
|
private final OFPacketIn pktin;
|
||||||
private OFPacketOut pktout = null;
|
private OFPacketOut pktout = null;
|
||||||
|
|
||||||
|
private final boolean isBuffered;
|
||||||
|
|
||||||
private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) {
|
private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) {
|
||||||
this.sw = s;
|
this.sw = s;
|
||||||
this.pktin = pkt;
|
this.pktin = pkt;
|
||||||
|
this.isBuffered = pktin.getBufferId() != OFBufferId.NO_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -117,4 +120,9 @@ public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext
|
|||||||
return !free.get();
|
return !free.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuffered() {
|
||||||
|
return isBuffered;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,10 @@ public interface OpenFlowPacketContext {
|
|||||||
* @return the port
|
* @return the port
|
||||||
*/
|
*/
|
||||||
public Integer inPort();
|
public Integer inPort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that this packet is buffered at the switch.
|
||||||
|
* @return buffer indication
|
||||||
|
*/
|
||||||
|
boolean isBuffered();
|
||||||
}
|
}
|
||||||
|
@ -225,5 +225,10 @@ public class OpenFlowHostProviderTest {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuffered() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,19 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext {
|
|||||||
public void send() {
|
public void send() {
|
||||||
if (!this.block()) {
|
if (!this.block()) {
|
||||||
if (outPacket() == null) {
|
if (outPacket() == null) {
|
||||||
sendBufferedPacket();
|
sendPacket(null);
|
||||||
} else {
|
} else {
|
||||||
Ethernet eth = new Ethernet();
|
Ethernet eth = new Ethernet();
|
||||||
eth.deserialize(outPacket().data().array(), 0,
|
eth.deserialize(outPacket().data().array(), 0,
|
||||||
outPacket().data().array().length);
|
outPacket().data().array().length);
|
||||||
ofPktCtx.build(eth, OFPort.FLOOD);
|
sendPacket(eth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendBufferedPacket() {
|
private void sendPacket(Ethernet eth) {
|
||||||
List<Instruction> ins = treatmentBuilder().build().instructions();
|
List<Instruction> ins = treatmentBuilder().build().instructions();
|
||||||
OFPort p = null;
|
OFPort p = null;
|
||||||
//TODO: support arbitrary list of treatments must be supported in ofPacketContext
|
//TODO: support arbitrary list of treatments must be supported in ofPacketContext
|
||||||
@ -53,10 +54,13 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext {
|
|||||||
break; //for now...
|
break; //for now...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (eth == null) {
|
||||||
ofPktCtx.build(p);
|
ofPktCtx.build(p);
|
||||||
|
} else {
|
||||||
|
ofPktCtx.build(eth, p);
|
||||||
|
}
|
||||||
ofPktCtx.send();
|
ofPktCtx.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
private OFPort buildPort(PortNumber port) {
|
private OFPort buildPort(PortNumber port) {
|
||||||
return OFPort.of((int) port.toLong());
|
return OFPort.of((int) port.toLong());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.onlab.onos.provider.of.packet.impl;
|
package org.onlab.onos.provider.of.packet.impl;
|
||||||
|
|
||||||
|
import static org.onlab.onos.openflow.controller.RoleState.SLAVE;
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@ -16,6 +17,7 @@ import org.onlab.onos.net.PortNumber;
|
|||||||
import org.onlab.onos.net.flow.instructions.Instruction;
|
import org.onlab.onos.net.flow.instructions.Instruction;
|
||||||
import org.onlab.onos.net.flow.instructions.Instructions.OutputInstruction;
|
import org.onlab.onos.net.flow.instructions.Instructions.OutputInstruction;
|
||||||
import org.onlab.onos.net.packet.DefaultInboundPacket;
|
import org.onlab.onos.net.packet.DefaultInboundPacket;
|
||||||
|
import org.onlab.onos.net.packet.DefaultOutboundPacket;
|
||||||
import org.onlab.onos.net.packet.OutboundPacket;
|
import org.onlab.onos.net.packet.OutboundPacket;
|
||||||
import org.onlab.onos.net.packet.PacketProvider;
|
import org.onlab.onos.net.packet.PacketProvider;
|
||||||
import org.onlab.onos.net.packet.PacketProviderRegistry;
|
import org.onlab.onos.net.packet.PacketProviderRegistry;
|
||||||
@ -36,8 +38,6 @@ import org.projectfloodlight.openflow.types.OFBufferId;
|
|||||||
import org.projectfloodlight.openflow.types.OFPort;
|
import org.projectfloodlight.openflow.types.OFPort;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import static org.onlab.onos.openflow.controller.RoleState.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provider which uses an OpenFlow controller to detect network
|
* Provider which uses an OpenFlow controller to detect network
|
||||||
@ -152,9 +152,15 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr
|
|||||||
new ConnectPoint(id, PortNumber.portNumber(pktCtx.inPort())),
|
new ConnectPoint(id, PortNumber.portNumber(pktCtx.inPort())),
|
||||||
pktCtx.parsed(), ByteBuffer.wrap(pktCtx.unparsed()));
|
pktCtx.parsed(), ByteBuffer.wrap(pktCtx.unparsed()));
|
||||||
|
|
||||||
|
DefaultOutboundPacket outPkt = null;
|
||||||
|
if (!pktCtx.isBuffered()) {
|
||||||
|
outPkt = new DefaultOutboundPacket(id, null,
|
||||||
|
ByteBuffer.wrap(pktCtx.unparsed()));
|
||||||
|
}
|
||||||
|
|
||||||
OpenFlowCorePacketContext corePktCtx =
|
OpenFlowCorePacketContext corePktCtx =
|
||||||
new OpenFlowCorePacketContext(System.currentTimeMillis(),
|
new OpenFlowCorePacketContext(System.currentTimeMillis(),
|
||||||
inPkt, null, pktCtx.isHandled(), pktCtx);
|
inPkt, outPkt, pktCtx.isHandled(), pktCtx);
|
||||||
providerService.processPacket(corePktCtx);
|
providerService.processPacket(corePktCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user