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


Java IOFSwitch.flush方法代码示例

本文整理汇总了Java中net.floodlightcontroller.core.IOFSwitch.flush方法的典型用法代码示例。如果您正苦于以下问题:Java IOFSwitch.flush方法的具体用法?Java IOFSwitch.flush怎么用?Java IOFSwitch.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.floodlightcontroller.core.IOFSwitch的用法示例。


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

示例1: writeOFMessagesToSwitch

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * Writes a list of OFMessages to a switch
 * @param dpid The datapath ID of the switch to write to
 * @param messages The list of OFMessages to write.
 */
@LogMessageDoc(level="ERROR",
		message="Tried to write to switch {switch} but got {error}",
		explanation="An I/O error occured while trying to write a " +
				"static flow to a switch",
				recommendation=LogMessageDoc.CHECK_SWITCH)
private void writeOFMessagesToSwitch(DatapathId dpid, List<OFMessage> messages) {
	IOFSwitch ofswitch = switchService.getSwitch(dpid);
	if (ofswitch != null) {  // is the switch connected
		if (log.isDebugEnabled()) {
			log.debug("Sending {} new entries to {}", messages.size(), dpid);
		}
		ofswitch.write(messages);
		ofswitch.flush();
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:21,代码来源:StaticFlowEntryPusher.java

示例2: write

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * write the message to the switch according to our dampening settings
 * @param sw
 * @param msg
 * @param flush true to flush the packet immediately
 * @return true if the message was written to the switch, false if
 * the message was dampened. 
 * @throws IOException
 */
public boolean write(IOFSwitch sw, OFMessage msg, boolean flush) throws IOException {
    if (!msgTypesToCache.contains(msg.getType())) {
        sw.write(msg);
        if (flush) {
            sw.flush();
        }
        return true;
    }
    
    DamperEntry entry = new DamperEntry(msg, sw);
    if (cache.update(entry)) {
        // entry exists in cache. Dampening.
        return false; 
    } else {
        sw.write(msg);
        if (flush) {
            sw.flush();
        }
        return true;
    }
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:31,代码来源:OFMessageDamper.java

示例3: sendDiscoveryMessage

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * Send link discovery message out of a given switch port. The discovery
 * message may be a standard LLDP or a modified LLDP, where the dst mac
 * address is set to :ff. TODO: The modified LLDP will updated in the future
 * and may use a different eth-type.
 *
 * @param sw
 * @param port
 * @param isStandard
 *            indicates standard or modified LLDP
 * @param isReverse
 *            indicates whether the LLDP was sent as a response
 */
@LogMessageDoc(level = "ERROR",
		message = "Failure sending LLDP out port {port} on switch {switch}",
		explanation = "An I/O error occured while sending LLDP message "
				+ "to the switch.",
				recommendation = LogMessageDoc.CHECK_SWITCH)
protected void sendDiscoveryMessage(DatapathId sw, OFPort port,
		boolean isStandard, boolean isReverse) {

	// Takes care of all checks including null pointer checks.
	if (!isOutgoingDiscoveryAllowed(sw, port, isStandard, isReverse))
		return;

	IOFSwitch iofSwitch = switchService.getSwitch(sw);
	OFPortDesc ofpPort = iofSwitch.getPort(port);

	if (log.isTraceEnabled()) {
		log.trace("Sending LLDP packet out of swich: {}, port: {}",
				sw.toString(), port.getPortNumber());
	}
	OFPacketOut po = generateLLDPMessage(sw, port, isStandard, isReverse);
	OFPacketOut.Builder pob = po.createBuilder();

	// Add actions
	List<OFAction> actions = getDiscoveryActions(iofSwitch, ofpPort.getPortNo());
	pob.setActions(actions);
	
	// no need to set length anymore

	// send
	// no more try-catch. switch will silently fail
	iofSwitch.write(pob.build());
	iofSwitch.flush();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:47,代码来源:LinkDiscoveryManager.java

示例4: writeFlowModToSwitch

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * Writes an OFFlowMod to a switch
 * @param sw The IOFSwitch to write to
 * @param flowMod The OFFlowMod to write
 */
@LogMessageDoc(level="ERROR",
		message="Tried to write OFFlowMod to {switch} but got {error}",
		explanation="An I/O error occured while trying to write a " +
				"static flow to a switch",
				recommendation=LogMessageDoc.CHECK_SWITCH)
private void writeFlowModToSwitch(IOFSwitch sw, OFFlowMod flowMod) {
	sw.write(flowMod);
	sw.flush();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:15,代码来源:StaticFlowEntryPusher.java


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