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


Java OFActionOutput.setType方法代码示例

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


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

示例1: testAllowedPacketOutALL

import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
 * tests packetOut event slicing
 */
@Test
public void testAllowedPacketOutALL(){
	
	OFPacketOut out = new OFPacketOut();
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionOutput output = new OFActionOutput();
	output.setType(OFActionType.OUTPUT);
	output.setPort(OFPort.OFPP_ALL.getValue());
	actions.add(output);
	out.setActions(actions);
	
	Ethernet pkt = new Ethernet();
	pkt.setVlanID((short)1000);
	pkt.setDestinationMACAddress("aa:bb:cc:dd:ee:ff");
	pkt.setSourceMACAddress("ff:ee:dd:cc:bb:aa");
	pkt.setEtherType((short)35020);
	out.setPacketData(pkt.serialize());
	
	List<OFMessage> outPackets = slicer.allowedPacketOut(out);
	assertTrue("OutPacket size is correct, expected 5 got " + outPackets.size(), outPackets.size() == 5);
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:25,代码来源:VLANSlicerTest.java

示例2: testAllowedPacketOut

import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
 * tests packetOut event slicing
 */
@Test
public void testAllowedPacketOut(){
	
	OFPacketOut out = new OFPacketOut();
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionOutput output = new OFActionOutput();
	output.setType(OFActionType.OUTPUT);
	output.setPort((short)1);
	actions.add(output);
	out.setActions(actions);
	
	Ethernet pkt = new Ethernet();
	pkt.setVlanID((short)1000);
	pkt.setDestinationMACAddress("aa:bb:cc:dd:ee:ff");
	pkt.setSourceMACAddress("ff:ee:dd:cc:bb:aa");
	pkt.setEtherType((short)35020);
	out.setPacketData(pkt.serialize());
	
	List<OFMessage> outPackets = slicer.allowedPacketOut(out);
	assertTrue("OutPacket size is correct, expected 1 got " + outPackets.size(), outPackets.size() == 1);
	
	pkt.setVlanID((short)2000);
	out.setPacketData(pkt.serialize());
	outPackets = slicer.allowedPacketOut(out);
	assertTrue("Packet out was denied", outPackets.size() == 0);
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:30,代码来源:VLANSlicerTest.java

示例3: testAllowedPacketOutManagedMode

import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
 * tests packetOut event slicing
 */
@Test
public void testAllowedPacketOutManagedMode(){
	
	OFPacketOut out = new OFPacketOut();
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionOutput output = new OFActionOutput();
	output.setType(OFActionType.OUTPUT);
	output.setPort((short)1);
	actions.add(output);
	out.setActions(actions);
	
	Ethernet pkt = new Ethernet();
	pkt.setDestinationMACAddress("aa:bb:cc:dd:ee:ff");
	pkt.setSourceMACAddress("ff:ee:dd:cc:bb:aa");
	pkt.setEtherType((short)35021);
	pkt.setPad(true);
	out.setPacketData(pkt.serialize());
	slicer.setTagManagement(true);
	pConfig = new PortConfig();
	pConfig.setPortName("foo");
	VLANRange range = new VLANRange();
	range.setVlanAvail((short)101,true);
	pConfig.setVLANRange(range);
	slicer.setPortConfig("foo", pConfig);
	
	List<OFMessage> outPackets = slicer.managedPacketOut(out);
	assertTrue("OutPacket size is correct, expected 1 got " + outPackets.size(), outPackets.size() == 1);
	OFPacketOut managedPacket = (OFPacketOut) outPackets.get(0);
	List<OFAction> acts = managedPacket.getActions();
	assertTrue("Action list size is 1!!",acts.size() == 1);

	Ethernet managedEthernet = new Ethernet();
	managedEthernet.deserialize(managedPacket.getPacketData(), 0, managedPacket.getPacketData().length);
	assertTrue("VLAN Tag set is correct",managedEthernet.getVlanID() == 101);
	assertTrue("Second action type is OUTPUT", acts.get(0).getType() == OFActionType.OUTPUT);
	OFActionOutput outPort = (OFActionOutput) acts.get(0);
	assertTrue("output port is 1", outPort.getPort() == 1);
	
	pkt.setVlanID((short)2000);
	out.setPacketData(pkt.serialize());
	outPackets = slicer.managedPacketOut(out);
	assertTrue("Packet out was denied", outPackets.size() == 0);
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:47,代码来源:VLANSlicerTest.java


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