当前位置: 首页>>代码示例>>Java>>正文


Java OFFlowRemoved类代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFFlowRemoved的典型用法代码示例。如果您正苦于以下问题:Java OFFlowRemoved类的具体用法?Java OFFlowRemoved怎么用?Java OFFlowRemoved使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFFlowRemoved类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFFlowRemoved类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flowRemovedProcess

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
        public void flowRemovedProcess(Dpid dpid, OFFlowRemoved flowRemoved) {
            FlowRemovedFeature frf = new FlowRemovedFeature();

            UnitFlowRemovedInformation ufri = new UnitFlowRemovedInformation(flowRemoved.getReason(),
                    flowRemoved.getDurationSec(), flowRemoved.getDurationNsec(),
                    flowRemoved.getIdleTimeout(), flowRemoved.getHardTimeout(),
                    flowRemoved.getPacketCount().getValue(), flowRemoved.getByteCount().getValue());
            Date date = new java.sql.Timestamp(Calendar.getInstance().getTime().getTime());

            ufri.setDate(date);

            FeatureIndex fi = matchToFeatureIndex(flowRemoved.getMatch());
            fi.setSwitchDatapathId(dpid.value());

            // extract rich feature -> store to UnitFlowstatistics
            ufri = (UnitFlowRemovedInformation) extractRichFeature(fi, ufri, AthenaFeatureField.FLOW_REMOVED);
            frf.addFeatureData(fi, ufri);

//            printFlowRemovedLFT(frStatisticsLFT);
            providerService.flowRemovedHandler(frf);
        }
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:FeatureCollectorProvider.java

示例2: receive

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public net.floodlightcontroller.core.IListener.Command receive(
		IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
	System.out.println("flow expired: "+sw.toString() + msg.toString());
	
	//OFFlowRemoved flowRemoved = (OFFlowRemoved) msg;
	
	if (!switchStates.containsKey(sw))
		switchStates.put(sw, new ObfuscationSwitchState(sw));
	
	if (msg.getType() == OFType.FLOW_REMOVED) {
		OFFlowRemoved flowRemoved = (OFFlowRemoved) msg;
		System.out.println("flow expired: "+sw.toString() + "dst: " + flowRemoved.getCookie());
		long dst = flowRemoved.getCookie().getValue();
		ObfuscationHeader oHeader = new ObfuscationHeader();
		Match match = flowRemoved.getMatch();
		
		switchStates.get(sw).removeDestinationID(dst);
	
	}
	
	return Command.CONTINUE;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:24,代码来源:ObfuscationSwitchStateManager.java

示例3: receive

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
	switch (msg.getType()) {
	case PACKET_IN:
		System.out.println("SXT_DBG:LearningSwitch:514----receive  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:
		log.error("received an unexpected message {} from switch {}", msg, sw);
		return Command.CONTINUE;
	}
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:17,代码来源:LearningSwitch.java

示例4: receive

import org.projectfloodlight.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;
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:17,代码来源:LearningSwitch.java

示例5: handleFlowRemoved

import org.projectfloodlight.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) {
	U64 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 (OFFlowRemovedReason.DELETE.equals(msg.getReason()))
			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;
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:26,代码来源:StaticFlowEntryPusher.java

示例6: FlowEntryBuilder

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
public FlowEntryBuilder(DeviceId deviceId, OFFlowRemoved removed, DriverService driverService) {
    this.match = removed.getMatch();
    this.removed = removed;
    this.deviceId = deviceId;
    this.instructions = null;
    this.stat = null;
    this.flowMod = null;
    this.type = FlowType.REMOVED;
    this.driverService = driverService;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:FlowEntryBuilder.java

示例7: handleFlowRemovedMessage

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
private Command handleFlowRemovedMessage(IOFSwitch sw, OFFlowRemoved ofr){
	HashMap<Long, FlowAlias> faList = cMap.get(sw.getId());
	
	if (faList != null){
		if (faList.remove(ofr.getCookie()) != null){
			log.debug("Clear Flow Alias corresponding to removed Flow Mod.");
			
		}else{//cannot find to-remove flow alias
			log.error("Cannot find Flow Alias corresponding to removed Flow Mod.");
		}
	}
	
	cMap.put(sw.getId(), faList);
	return Command.CONTINUE;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:16,代码来源:SecurityKernel.java

示例8: receive

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
public net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg,
		FloodlightContext cntx) {
	
	switch (msg.getType()) {
	case FLOW_REMOVED:
		return this.handleFlowRemovedMessage(sw, (OFFlowRemoved) msg);	
	default:
		return Command.CONTINUE;
	}

}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:13,代码来源:SecurityKernel.java

示例9: processFlowRemovedMessage

import org.projectfloodlight.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().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
		return Command.CONTINUE;
	}
	if (log.isTraceEnabled()) {
		log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
	}
	Match 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, match.get(MatchField.ETH_SRC), 
			match.get(MatchField.VLAN_VID) == null 
			? VlanVid.ZERO 
			: match.get(MatchField.VLAN_VID).getVlanVid());

	// 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.
	Match.Builder mb = sw.getOFFactory().buildMatch();
	mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
	.setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
	if (match.get(MatchField.VLAN_VID) != null) {
		mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));                    
	}
	this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
	return Command.CONTINUE;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:39,代码来源:LearningSwitch.java

示例10: receive

import org.projectfloodlight.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:
		log.error("received an unexpected message {} from switch {}", msg, sw);
		return Command.CONTINUE;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:16,代码来源:LearningSwitch.java

示例11: receive

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
@Override
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;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:10,代码来源:StaticFlowEntryPusher.java

示例12: processOFMessage

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
/**
 * Process an OF message received on the channel and
 * update state accordingly.
 *
 * The main "event" of the state machine. Process the received message,
 * send follow up message if required and update state if required.
 *
 * Switches on the message type and calls more specific event handlers
 * for each individual OF message type. If we receive a message that
 * is supposed to be sent from a controller to a switch we throw
 * a SwitchStateExeption.
 *
 * The more specific handlers can also throw SwitchStateExceptions
 *
 * @param h The OFChannelHandler that received the message
 * @param m The message we received.
 * @throws SwitchStateException
 * @throws IOException
 */
void processOFMessage(OFMessage m) {
	roleChanger.checkTimeout();
	switch(m.getType()) {
	case BARRIER_REPLY:
		processOFBarrierReply((OFBarrierReply) m);
		break;
	case ERROR:
		processOFError((OFErrorMsg) m);
		break;
	case FLOW_REMOVED:
		processOFFlowRemoved((OFFlowRemoved) m);
		break;
	case GET_CONFIG_REPLY:
		processOFGetConfigReply((OFGetConfigReply) m);
		break;
	case PACKET_IN:
		processOFPacketIn((OFPacketIn) m);
		break;
	case PORT_STATUS:
		processOFPortStatus((OFPortStatus) m);
		break;
	case QUEUE_GET_CONFIG_REPLY:
		processOFQueueGetConfigReply((OFQueueGetConfigReply) m);
		break;
	case STATS_REPLY:
		processOFStatsReply((OFStatsReply) m);
		break;
	case ROLE_REPLY:
		processOFRoleReply((OFRoleReply) m);
		break;
	case EXPERIMENTER:
		processOFExperimenter((OFExperimenter) m);
		break;
	default:
		illegalMessageReceived(m);
		break;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:58,代码来源:OFSwitchHandshakeHandler.java

示例13: receive

import org.projectfloodlight.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;
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:16,代码来源:StaticFlowEntryPusher.java

示例14: processFlowRemovedMessage

import org.projectfloodlight.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().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) {
		return Command.CONTINUE;
	}
	if (log.isTraceEnabled()) {
		log.trace("{} flow entry removed {}", sw, flowRemovedMessage);
	}
	Match 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, match.get(MatchField.ETH_SRC),
			match.get(MatchField.VLAN_VID) == null
			? VlanVid.ZERO
			: match.get(MatchField.VLAN_VID).getVlanVid());

	// 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.
	Match.Builder mb = sw.getOFFactory().buildMatch();
	mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))
	.setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC));
	if (match.get(MatchField.VLAN_VID) != null) {
		mb.setExact(MatchField.VLAN_VID, match.get(MatchField.VLAN_VID));
	}
	this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
	return Command.CONTINUE;
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:39,代码来源:LearningSwitch.java

示例15: FlowEntryBuilder

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入依赖的package包/类
public FlowEntryBuilder(Dpid dpid, OFFlowRemoved removed, Type tableType) {
    this.match = removed.getMatch();
    this.removed = removed;

    this.dpid = dpid;
    this.instructions = null;
    this.stat = null;
    this.flowMod = null;
    this.type = FlowType.REMOVED;
    this.tableType = tableType;

}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:13,代码来源:FlowEntryBuilder.java


注:本文中的org.projectfloodlight.openflow.protocol.OFFlowRemoved类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。