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


Java OFFlowRemoved.getMatch方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: FlowEntryBuilder

import org.projectfloodlight.openflow.protocol.OFFlowRemoved; //导入方法依赖的package包/类
public FlowEntryBuilder(DeviceId deviceId, OFFlowRemoved removed, DriverHandler driverHandler) {
    this.match = removed.getMatch();
    this.removed = removed;
    this.deviceId = deviceId;
    this.instructions = null;
    this.stat = null;
    this.flowMod = null;
    this.type = FlowType.REMOVED;
    this.driverHandler = driverHandler;
    this.afsc = null;
    this.lightWeightStat = null;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:FlowEntryBuilder.java

示例7: 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).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 = match.createBuilder();
	mb.setExact(MatchField.ETH_SRC, match.get(MatchField.ETH_DST))                         
	.setExact(MatchField.ETH_DST, match.get(MatchField.ETH_SRC))                         
	.setExact(MatchField.IPV4_SRC, match.get(MatchField.IPV4_DST))                         
	.setExact(MatchField.IPV4_DST, match.get(MatchField.IPV4_SRC));
	if (match.get(MatchField.IP_PROTO).equals(IpProtocol.TCP)) {
		mb.setExact(MatchField.IP_PROTO, IpProtocol.TCP)
		.setExact(MatchField.TCP_SRC, match.get(MatchField.TCP_DST))
		.setExact(MatchField.TCP_DST, match.get(MatchField.TCP_SRC));
	} else if (match.get(MatchField.IP_PROTO).equals(IpProtocol.UDP)) {
		mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP)
		.setExact(MatchField.UDP_SRC, match.get(MatchField.UDP_DST))
		.setExact(MatchField.UDP_DST, match.get(MatchField.UDP_SRC));
	} else if (match.get(MatchField.IP_PROTO).equals(IpProtocol.SCTP)) {
		mb.setExact(MatchField.IP_PROTO, IpProtocol.SCTP)
		.setExact(MatchField.SCTP_SRC, match.get(MatchField.SCTP_DST))
		.setExact(MatchField.SCTP_DST, match.get(MatchField.SCTP_SRC));
	} else {
		log.debug("In writing reverse LS flow, could not determine L4 proto (was int " + mb.get(MatchField.IP_PROTO).getIpProtocolNumber() + ")");
	}
    this.writeFlowMod(sw, OFFlowModCommand.DELETE, OFBufferId.NO_BUFFER, mb.build(), match.get(MatchField.IN_PORT));
    return Command.CONTINUE;
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:50,代码来源:LearningSwitch.java


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