本文整理汇总了Java中org.openflow.protocol.OFFlowRemoved类的典型用法代码示例。如果您正苦于以下问题:Java OFFlowRemoved类的具体用法?Java OFFlowRemoved怎么用?Java OFFlowRemoved使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFFlowRemoved类属于org.openflow.protocol包,在下文中一共展示了OFFlowRemoved类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
switch (msg.getType()) {
case PACKET_IN:
return this.processPacketInMessage(sw, (OFPacketIn) msg, cntx);
case FLOW_REMOVED:
return this.processFlowRemovedMessage(sw, (OFFlowRemoved) msg);
case ERROR:
log.info("received an error {} from switch {}", msg, sw);
return Command.CONTINUE;
default:
break;
}
log.error("received an unexpected message {} from switch {}", msg, sw);
return Command.CONTINUE;
}
示例2: handleFlowRemoved
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* Handles a flow removed message from a switch. If the flow was removed
* and we did not explicitly delete it we re-install it. If we explicitly
* removed the flow we stop the processing of the flow removed message.
* @param sw The switch that sent the flow removed message.
* @param msg The flow removed message.
* @param cntx The associated context.
* @return Whether to continue processing this message.
*/
public Command handleFlowRemoved(IOFSwitch sw, OFFlowRemoved msg, FloodlightContext cntx) {
long cookie = msg.getCookie();
/**
* This is just to sanity check our assumption that static flows
* never expire.
*/
if (AppCookie.extractApp(cookie) == STATIC_FLOW_APP_ID) {
if (msg.getReason() != OFFlowRemoved.OFFlowRemovedReason.OFPRR_DELETE)
log.error("Got a FlowRemove message for a infinite " +
"timeout flow: {} from switch {}", msg, sw);
// Stop the processing chain since we sent the delete.
return Command.STOP;
}
return Command.CONTINUE;
}
示例3: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
switch (msg.getType()) {
case PACKET_IN:
return this.processPacketInMessage(sw, (OFPacketIn) msg, cntx);
case FLOW_REMOVED:
return this.processFlowRemovedMessage(sw, (OFFlowRemoved) msg);
case ERROR:
log.info("received an error {} from switch {}", (OFError) msg, sw);
return Command.CONTINUE;
default:
break;
}
log.error("received an unexpected message {} from switch {}", msg, sw);
return Command.CONTINUE;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:17,代码来源:LearningSwitch.java
示例4: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg, ListenerContext cntx) {
switch (msg.getType()) {
case PACKET_IN:
return this.processPacketInMessage(sw, (OFPacketIn) msg, cntx);
case FLOW_REMOVED:
return this.processFlowRemovedMessage(sw, (OFFlowRemoved) msg);
case ERROR:
log.info("received an error {} from switch {}", (OFError) msg, sw);
return Command.CONTINUE;
default:
break;
}
log.error("received an unexpected message {} from switch {}", msg, sw);
return Command.CONTINUE;
}
示例5: handleFlowRemoved
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* Handles a flow removed message from a switch. If the flow was removed
* and we did not explicitly delete it we re-install it. If we explicitly
* removed the flow we stop the processing of the flow removed message.
* @param sw The switch that sent the flow removed message.
* @param msg The flow removed message.
* @param cntx The associated context.
* @return Whether to continue processing this message.
*/
public Command handleFlowRemoved(IOFSwitch sw, OFFlowRemoved msg, ListenerContext cntx) {
long cookie = msg.getCookie();
/**
* This is just to sanity check our assumption that static flows
* never expire.
*/
if (AppCookie.extractApp(cookie) == STATIC_FLOW_APP_ID) {
if (msg.getReason() != OFFlowRemoved.OFFlowRemovedReason.OFPRR_DELETE)
log.error("Got a FlowRemove message for a infinite " +
"timeout flow: {} from switch {}", msg, sw);
// Stop the processing chain since we sent the delete.
return Command.STOP;
}
return Command.CONTINUE;
}
示例6: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg,
ListenerContext cntx) {
switch (msg.getType()) {
case FLOW_REMOVED:
// this is meant for tunnel liveness detection but is currently unused
return this.flowRemoved(sw, (OFFlowRemoved) msg, cntx);
case PACKET_IN:
// this takes the sdnplatform Topology Manager path
return this.processPacketInMessage(sw,
(OFPacketIn) msg, cntx);
default:
break;
}
return Command.CONTINUE;
}
示例7: handleFlowRemoved
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* Handles a flow removed message from a switch. If the flow was removed
* and we did not explicitly delete it we re-install it. If we explicitly
* removed the flow we stop the processing of the flow removed message.
* @param sw The switch that sent the flow removed message.
* @param msg The flow removed message.
* @param cntx The associated context.
* @return Whether to continue processing this message.
*/
public Command handleFlowRemoved(IOFSwitch sw, OFFlowRemoved msg, FloodlightContext cntx) {
long cookie = msg.getCookie();
/**
* This is just to sanity check our assumption that static flows
* never expire.
*/
if (AppCookie.extractApp(cookie) == STATIC_FLOW_APP_ID) {
if (msg.getReason() != OFFlowRemoved.OFFlowRemovedReason.OFPRR_DELETE)
log.error("Got a FlowRemove message for a infinite " +
"timeout flow: {} from switch {}", msg, sw);
// Stop the processing chain since we sent the delete.
return Command.STOP;
}
return Command.CONTINUE;
}
示例8: processFlowRemovedMessage
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
* the switch's table.
* @param sw The switch that sent the flow removed message.
* @param flowRemovedMessage The flow removed message.
* @return Whether to continue processing this message or stop.
*/
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
if (flowRemovedMessage.getCookie() != LearningSwitch.LEARNING_SWITCH_COOKIE) {
return Command.CONTINUE;
}
if (log.isTraceEnabled()) {
log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
}
OFMatch match = flowRemovedMessage.getMatch();
// When a flow entry expires, it means the device with the matching source
// MAC address and VLAN either stopped sending packets or moved to a different
// port. If the device moved, we can't know where it went until it sends
// another packet, allowing us to re-learn its port. Meanwhile we remove
// it from the macVlanToPortMap to revert to flooding packets to this device.
this.removeFromPortMap(sw, Ethernet.toLong(match.getDataLayerSource()),
match.getDataLayerVirtualLan());
// Also, if packets keep coming from another device (e.g. from ping), the
// corresponding reverse flow entry will never expire on its own and will
// send the packets to the wrong port (the matching input port of the
// expired flow entry), so we must delete the reverse entry explicitly.
this.writeFlowMod(sw, OFFlowMod.OFPFC_DELETE, -1, match.clone()
.setWildcards(((Integer)sw.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).intValue()
& ~OFMatch.OFPFW_DL_VLAN & ~OFMatch.OFPFW_DL_SRC & ~OFMatch.OFPFW_DL_DST
& ~OFMatch.OFPFW_NW_SRC_MASK & ~OFMatch.OFPFW_NW_DST_MASK)
.setDataLayerSource(match.getDataLayerDestination())
.setDataLayerDestination(match.getDataLayerSource())
.setNetworkSource(match.getNetworkDestination())
.setNetworkDestination(match.getNetworkSource())
.setTransportSource(match.getTransportDestination())
.setTransportDestination(match.getTransportSource()),
match.getInputPort());
return Command.CONTINUE;
}
示例9: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
@LogMessageDoc(level="ERROR",
message="Got a FlowRemove message for a infinite " +
"timeout flow: {flow} from switch {switch}",
explanation="Flows with infinite timeouts should not expire. " +
"The switch has expired the flow anyway.",
recommendation=LogMessageDoc.REPORT_SWITCH_BUG)
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
switch (msg.getType()) {
case FLOW_REMOVED:
return handleFlowRemoved(sw, (OFFlowRemoved) msg, cntx);
default:
return Command.CONTINUE;
}
}
示例10: processFlowRemovedMessage
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* Processes a flow removed message. We will delete the learned MAC/VLAN mapping from
* the switch's table.
* @param sw The switch that sent the flow removed message.
* @param flowRemovedMessage The flow removed message.
* @return Whether to continue processing this message or stop.
*/
private Command processFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved flowRemovedMessage) {
if (flowRemovedMessage.getCookie() != LearningSwitch.LEARNING_SWITCH_COOKIE) {
return Command.CONTINUE;
}
if (log.isTraceEnabled()) {
log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
}
OFMatch match = flowRemovedMessage.getMatch();
// When a flow entry expires, it means the device with the matching source
// MAC address and VLAN either stopped sending packets or moved to a different
// port. If the device moved, we can't know where it went until it sends
// another packet, allowing us to re-learn its port. Meanwhile we remove
// it from the macVlanToPortMap to revert to flooding packets to this device.
this.removeFromPortMap(sw, Ethernet.toLong(match.getDataLayerSource()),
match.getDataLayerVirtualLan());
// Also, if packets keep coming from another device (e.g. from ping), the
// corresponding reverse flow entry will never expire on its own and will
// send the packets to the wrong port (the matching input port of the
// expired flow entry), so we must delete the reverse entry explicitly.
this.writeFlowMod(sw, OFFlowMod.OFPFC_DELETE, -1, match.clone()
.setWildcards(((Integer)sw.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).intValue()
& ~OFMatch.OFPFW_DL_VLAN & ~OFMatch.OFPFW_DL_SRC & ~OFMatch.OFPFW_DL_DST
& ~OFMatch.OFPFW_NW_SRC_MASK & ~OFMatch.OFPFW_NW_DST_MASK)
.setDataLayerSource(match.getDataLayerDestination())
.setDataLayerDestination(match.getDataLayerSource())
.setNetworkSource(match.getNetworkDestination())
.setNetworkDestination(match.getNetworkSource())
.setTransportSource(match.getTransportDestination())
.setTransportDestination(match.getTransportSource()),
match.getInputPort());
return Command.CONTINUE;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:41,代码来源:LearningSwitch.java
示例11: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
@LogMessageDoc(level="ERROR",
message="Got a FlowRemove message for a infinite " +
"timeout flow: {flow} from switch {switch}",
explanation="Flows with infinite timeouts should not expire. " +
"The switch has expired the flow anyway.",
recommendation=LogMessageDoc.REPORT_SWITCH_BUG)
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
switch (msg.getType()) {
case FLOW_REMOVED:
break;
default:
return Command.CONTINUE;
}
OFFlowRemoved flowRemoved = (OFFlowRemoved) msg;
long cookie = flowRemoved.getCookie();
/**
* This is just to sanity check our assumption that static flows
* never expire.
*/
if( AppCookie.extractApp(cookie) == STATIC_FLOW_APP_ID) {
if (flowRemoved.getReason() !=
OFFlowRemoved.OFFlowRemovedReason.OFPRR_DELETE)
log.error("Got a FlowRemove message for a infinite " +
"timeout flow: {} from switch {}", msg, sw);
return Command.STOP; // only for us
} else
return Command.CONTINUE;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:30,代码来源:StaticFlowEntryPusher.java
示例12: processFlowModRemovalMsg
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
protected void processFlowModRemovalMsg(IOFSwitch sw,
OFFlowRemoved flowRemMsg, ListenerContext cntx) {
if (logger.isTraceEnabled()) {
logger.trace("Recvd. flow-mod removal message from switch {}, wildcard=0x{} fm={}",
new Object[]{HexString.toHexString(sw.getId()),
Integer.toHexString(flowRemMsg.getMatch().getWildcards()),
flowRemMsg.getMatch().toString()});
}
boolean remStatus = false;
/* if one or both the source and destination devices have moved to a
* different app then we won't know in which app they were when the
* flow-mod was programmed. (Perhaps we do need to use the cookie for
* this.) So if the deletion from flow-cache fails we then try to delete
* the flow in other apps, stopping on success. Assumption here is that
* the flow can belong to exactly one app, the source app.
*/
for (String applIName : bfcDb.flowCache.keySet()) {
if (bfcDb.isFlowCacheAlmostFull()) {
remStatus = deleteFlow(applIName, flowRemMsg, sw.getId());
} else {
remStatus = deactivateFlow(applIName, flowRemMsg, sw.getId());
}
if ((remStatus == true) && (logger.isTraceEnabled())) {
logger.trace("Removed flow from appl. inst. name: {}",
applIName);
break;
}
}
}
示例13: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg,
ListenerContext cntx) {
switch (msg.getType()) {
case FLOW_REMOVED:
OFFlowRemoved flowRemMsg = (OFFlowRemoved) msg;
processFlowModRemovalMsg(sw, flowRemMsg, cntx);
break;
case STATS_REPLY:
OFStatisticsReply statsReplyMsg = (OFStatisticsReply)msg;
processStatsReplyMsg(sw, statsReplyMsg, cntx);
/** Stats_Reply is not called from pktIn pipeline, but
* directly as a switch callback.
* It needs to flush the counters.
*/
updateFlush();
break;
default:
if (logger.isDebugEnabled()) {
logger.debug("Ignoring mesg type: {}", msg.getType());
}
break;
}
return Command.CONTINUE;
}
示例14: receive
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
@LogMessageDoc(level="ERROR",
message="Got a FlowRemove message for a infinite " +
"timeout flow: {flow} from switch {switch}",
explanation="Flows with infinite timeouts should not expire. " +
"The switch has expired the flow anyway.",
recommendation=LogMessageDoc.REPORT_SWITCH_BUG)
public Command receive(IOFSwitch sw, OFMessage msg, ListenerContext cntx) {
switch (msg.getType()) {
case FLOW_REMOVED:
return handleFlowRemoved(sw, (OFFlowRemoved) msg, cntx);
default:
return Command.CONTINUE;
}
}
示例15: flowRemoved
import org.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
* To use this method to finally check for tunnel status when flowmods
* are being removed.
*/
private Command flowRemoved(IOFSwitch sw, OFFlowRemoved msg,
ListenerContext cntx) {
/*
if (tunnelManager == null) return Command.CONTINUE;
OFMatch match = msg.getMatch();
long dpid = sw.getId();
int srcIp = match.getNetworkSource();
int dstIp = match.getNetworkDestination();
Long srcDPID = tunnelManager.getSwitchDpid(srcIp);
Long dstDPID = tunnelManager.getSwitchDpid(dstIp);
if (srcDPID != null && dstDPID != null && !srcDPID.equals(dstDPID)) {
if (srcDPID.equals(dpid)) {
// the traffic is from the tunnel IP to tunnel IP.
this.detectTunnelSource(srcDPID, dstDPID);
} else if (dstDPID.equals(dpid)) {
// the traffic is destined
this.detectTunnelDestination(srcDPID, dstDPID);
}
}
*/
return Command.CONTINUE;
}